diff --git a/docs/assets/images/Fig42.png b/docs/assets/images/Fig42.png new file mode 100644 index 0000000000..898f8eb2dc Binary files /dev/null and b/docs/assets/images/Fig42.png differ diff --git a/docs/user-guide/project.md b/docs/user-guide/project.md index 0e046d35ca..03d8e81c1a 100644 --- a/docs/user-guide/project.md +++ b/docs/user-guide/project.md @@ -106,23 +106,24 @@ Now you can add properties to your class. Your pdf of a book has a number of pag Theoretically, you have two options now. If you defined properties before, you may simply add them here (second option in the following image). If you just start adding properties, you have to choose `Create new from type`. ![Two options for defining properties.](../assets/images/Fig12.png) -By hovering over `Create new from type`, a new dialog box appears: +By hovering over `Create new from type`, a new menu box appears: ![Create new property.](../assets/images/Fig13.png) You can choose from a selection of the following basic types with various subtypes: + - Text (*Short*, *Paragraph*, *Rich Text*) - List (*Dropdown*) - Boolean (*Yes/No* selection; checkbox) - Date / Time (*Date*, *Timestamp*, *Time sequence*) -- Number (*Integer*, *Decimal*) -- Link / Relation (*Resource Class*, *External URL*) +- Number (*Integer*, *Decimal*, *Page number*) +- Link / Relation (*Link to Class*, *Part of Class*, *External URL*) - Location (*Place*; a [geonames-identifier](https://www.geonames.org/)) - Shape (*color*) -Since in our example you want to add a property for the number of pages of your book, you choose `Number`. Now you will see that you can either choose the type `Decimal` or `Integer` for your property. +Since in our example you want to add a property for the number of pages of your book, you choose `Number`. Now you will see that you can either choose the type `Decimal`, `Integer` or `Page number` for your property. ![Property types.](../assets/images/Fig14.png) -Page numbers have no decimal places, thus you will selecet `Integer` as type for your property. The following window pops up: +Page numbers have no decimal places, thus you will selecet `Integer` (or `Page number` which is a special case (s. [next section](#correct-property-selection-in-case-of-special-classes))) as the type for your property. The following window pops up: ![Property of integer type.](../assets/images/Fig15.png) In the field *Property label* add for example *Number of pages*, in the comment section you should add a meaningful explanation. It might also make sense to toggle `Required field?` since every PDF Document consists of a number of pages. If you toggle it, the number of pages MUST be given if you add data to the class *Book* - it would then be a required field, not an optional one and data could only be saved if you add the number of pages. @@ -133,6 +134,15 @@ If you want to define a property which can have more than one value, you should Now you should see the new property in the box as seen below: ![Layout after the creation of the property.](../assets/images/Fig17.png) +### Correct property selection in case of special classes + +#### Book class with pages as individual classes + +If you have single digitized pages of a book in your project, they can be defined as its own individual *Still image* class type. In this case the — let's call it *Page* — class needs two specific properties to work the correct way. One is the `part of`-property which can be found in the list of properties in the section "Link / Relation". This property points to the main class called *Book* (which should be defined first and is type of *Object without representation*). The second property is for the `page number` definition and is also necessary. This default property can be found in the list of properties in the section called "Number". + +This is how a book and the page class could look like: +![Page class as part of Book class](../assets/images/Fig42.png) + ### Define Lists One of the possible property types to choose from is *List*. Lists are very useful if you want to use controlled vocabulary to describe something. Typical examples are keywords. In your book example it may be useful to define a property which describes to which category of literature your pdf of a book belongs. **Before** you can add a property of type *List* to your data model, you have to define this list. For the definiton of a list you have to change to the `Lists` tab: ![List tab.](../assets/images/Fig34.png) diff --git a/src/app/project/ontology/default-data/default-properties.ts b/src/app/project/ontology/default-data/default-properties.ts index 6a386df196..8309469446 100644 --- a/src/app/project/ontology/default-data/default-properties.ts +++ b/src/app/project/ontology/default-data/default-properties.ts @@ -139,7 +139,7 @@ export class DefaultProperties { group: 'Number', elements: [ { - icon: 'money', + icon: '60fps', label: 'Integer', description: 'Integer value', subPropOf: Constants.HasValue, @@ -155,6 +155,15 @@ export class DefaultProperties { objectType: Constants.DecimalValue, guiEle: Constants.SalsahGui + Constants.HashDelimiter + 'Spinbox', // 'Number', group: 'Number' + }, + { + icon: 'filter_3', + label: 'Page number', + description: 'The page number is needed for page classes in case of part of properties', + subPropOf: Constants.KnoraApiV2 + Constants.HashDelimiter + 'seqnum', + objectType: Constants.IntValue, + guiEle: Constants.SalsahGui + Constants.HashDelimiter + 'Spinbox', // 'Number', + group: 'Number' } ] }, @@ -163,13 +172,22 @@ export class DefaultProperties { elements: [ { icon: 'link', - label: 'Resource class', + label: 'Link to class', description: 'Refers to a resource class', subPropOf: Constants.HasLinkTo, objectType: Constants.LinkValue, guiEle: Constants.SalsahGui + Constants.HashDelimiter + 'Searchbox', // 'Autocomplete', group: 'Link / Relation' }, + { + icon: 'extension', + label: 'Part of class', + description: 'Is part of a resource class', + subPropOf: Constants.KnoraApiV2 + Constants.HashDelimiter + 'isPartOf', + objectType: Constants.LinkValue, + guiEle: Constants.SalsahGui + Constants.HashDelimiter + 'Searchbox', // 'Autocomplete', + group: 'Relation' + }, { icon: 'language', label: 'External URL', diff --git a/src/app/project/ontology/property-form/property-form.component.ts b/src/app/project/ontology/property-form/property-form.component.ts index 5a454336f5..ae80ba31f1 100644 --- a/src/app/project/ontology/property-form/property-form.component.ts +++ b/src/app/project/ontology/property-form/property-form.component.ts @@ -485,9 +485,9 @@ export class PropertyFormComponent implements OnInit { newResProp.guiElement = this.propertyInfo.propType.guiEle; newResProp.subPropertyOf = [this.propertyInfo.propType.subPropOf]; - if (this.propertyInfo.propType.subPropOf === Constants.HasLinkTo) { + if (this.propertyInfo.propType.subPropOf === Constants.HasLinkTo || this.propertyInfo.propType.subPropOf === Constants.KnoraApiV2 + Constants.HashDelimiter + 'isPartOf') { newResProp.objectType = guiAttr; - // newResProp.subjectType = classIri; + newResProp.subjectType = this.resClassIri; } else { newResProp.objectType = this.propertyInfo.propType.objectType; } diff --git a/src/app/project/ontology/resource-class-info/resource-class-info.component.ts b/src/app/project/ontology/resource-class-info/resource-class-info.component.ts index 05f35d77f8..429671556a 100644 --- a/src/app/project/ontology/resource-class-info/resource-class-info.component.ts +++ b/src/app/project/ontology/resource-class-info/resource-class-info.component.ts @@ -181,8 +181,7 @@ export class ResourceClassInfoComponent implements OnInit { const propToDisplay = ontoProps.find(obj => obj.id === hasProp.propertyIndex && - ((!obj.isLinkValueProperty) || (obj.subjectType && !obj.subjectType.includes('Standoff'))) - + ((obj.subjectType && !obj.subjectType.includes('Standoff')) && obj.objectType !== Constants.LinkValue || !obj.isLinkValueProperty) ); if (propToDisplay) { @@ -199,7 +198,7 @@ export class ResourceClassInfoComponent implements OnInit { // find corresponding default property to have more prop info if (availableProp.guiElement) { for (const group of this.defaultProperties) { - if (availableProp.subPropertyOf[0] !== Constants.HasLinkTo) { + if (availableProp.subPropertyOf[0] !== Constants.HasLinkTo && availableProp.subPropertyOf[0] !== Constants.KnoraApiV2 + Constants.HashDelimiter + 'isPartOf') { propType = group.elements.find(i => i.guiEle === availableProp.guiElement && i.objectType === availableProp.objectType );