ROGER Schema

RDF Forms Based on SHACL and DASH

Entwurf vom

Editors:
Max-Ferdinand Zeterberg (Niedersächsische Staats- und Universitätsbibliothek Göttingen)
Nathanael Erik Schweikhard (Niedersächsische Staats- und Universitätsbibliothek Göttingen)
Links to the specification
Permalink to the current version
Collaborate
GitLab-Repository
Change log

About the ROGER Schema

ROGER (Rdf fORms GEneRator) allows for the description of RDF data and of form fields generating these RDF data. A ROGER shapes graph serves for the validation of RDF data and the generation of suitable forms. A ROGER shapes graph is generated on the basis of an RDFS data model.

ROGER is based on the Shapes Constraint Language (SHACL) and on its extension Data Shapes (DASH). SHACL is a W3C specification for the validation of RDF data. DASH is a SHACL-extension which is still in development and has been only published as a draft as of now. Among other things, DASH adopts SHACL's feature to describe user interfaces. For this, DASH offers special shapes for the description of forms.

ROGER software generates forms for data entry on the basis of the [rdf-schema] data model and the ROGER shapes graph. Data are automatically validated while being entered. Further information on the software can be found here.

1. Documentation of ROGER

1.1 About this Documentation

This documentation starts with a short practical example by which basic features of ROGER are illustrated. This is followed by two parts in which all available features are explained: First the two shapes types, then the various properties.

1.2 Document Conventions

Within this document, the following namespace prefix bindings are used:

Prefix Namespace
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: http://www.w3.org/2000/01/rdf-schema#
sh: http://www.w3.org/ns/shacl#
dash: http://datashapes.org/dash#
xsd: http://www.w3.org/2001/XMLSchema#
ex: http://example.com/ns#
exshapes: http://beispiel.de/ns#
roger: https://www.sub.uni-goettingen.de/roger/schema

In this document, color-coded boxes are used to show RDF-graphs in Turtle. These Turtle-fragments use the prefixes listed above.

# This box represents shapes graphs.
# This box represents data graphs.
# This box represents XML code.

1.3 Example

This section is non-normative.

On the basis of the following RDFS data model, persons (ex:Person) shall be described. For this purpose, the name (ex:name), gender (ex:gender), GND-ID (ex:gndID) and friendship relations (ex:friend) to other persons shall be described.

ex:Person a rdfs:Class ;
    rdfs:label "Person" .

ex:name a rdf:Property ;
    rdfs:domain ex:Person ;
    rdfs:label "Name" ;
    rdfs:range rdfs:Literal .

ex:gender a rdf:Property ;
    rdfs:domain ex:Person ;
    rdfs:label "Gender" ;
    rdfs:range rdfs:Literal .

ex:friend a rdf:Property ;
    rdfs:domain ex:Person ;
    rdfs:label "Friend" ;
    rdfs:range ex:Person .

ex:gndID a rdf:Property ;
    rdfs:domain ex:Person ;
    rdfs:label "GND-ID" ;
    rdfs:range xsd:anyURI .

1.3.1 The Node Shape

This section is non-normative.

On the basis of the RDFS data model, the data and the corresponding form fields are described in ROGER: For each class of the RDFS data model with which the instances shall be generated with a form, a unique form is required. The form contains various form fields, which correspond to the properties of the RDFS data model.

The name of a form is generated from the value of rdfs:label of the respective class from the RDFS data model.

The node shape describing the form for ex:Person:

exshapes:PersonShape
    a sh:NodeShape ;
    rdfs:label "Person Shape" ;
    sh:targetClass ex:Person ;
    roger:formNode true ;
    sh:property exshapes:nameShape ,
                exshapes:genderShape ,
                exshapes:friendShape ,
                exshapes:gndIDShape .

A node shape is always an instance of sh:NodeShape. rdfs:label specifies a label for the node shape. (Attention: This is the label for the node shape, not for the form. The label of the form is generated from the value of rdfs:label of the respective class of the RDFS data model). sh:targetClass declares which class in the RDFS data model this node shape shall be applied to. This means that all instances of this class shall be validated on the basis of this node shape. Whether or not a unique form shall be generated on the basis of this node shape results from the property roger:formNode ("true" generates a unique form, "false" doesn't). The property sh:property describes which form fields this form shall contain by listing the property shapes for those edges of the graph which can be connected to this node.

1.3.2 Entering the Name

This section is non-normative.

Property shapes serve for describing the data and the corresponding form fields. Shapes are identified as property shapes via a sh:PropertyShape.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:path ex:name ;
    sh:datatype xsd:string ;
    dash:editor dash:TextFieldEditor ;
    sh:name "Name" ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
    sh:description "Enter the name" ;
    sh:order "0"^^xsd:decimal .

For each property shape, sh:path declares which of the properties defined in the RDFS data model is described by this property shape. sh:datatype names the data type allowed. The kind of input field which the form should display is described in dash:editor. In the case shown here, with dash:TextFieldEditor, a one line free text input field is selected. sh:name describes the label which should be displayed for this input field. The two properties sh:minCount and sh:maxCount declare how often this property can be used minimally and maximally with an instance of the class specified in sh:targetClass (i.e. its cardinality). Once sh:minCount is set to a value higher than 0, this property is obligatory. sh:description contains an additional explanation of the form field. In the application, this explanation is displayed via a pop-over. sh:order describes the order of the form fields in the form. "0" means here that this form field should be shown right at the top. The value set here applies to all the forms in which the respective form is used because property shapes can be used multiple times in a shapes graph. (If on the other hand one would want to specify a different order in another form, one would need to formulate a new property shape for the same property: in the same way as property shapes can be (re-)used in several node shapes, conversely there can also be several different property shapes for the same property).

The form field which is generated on the basis of this property shape looks like this:

1.3.3 Entering the Gender

This section is non-normative.

exshapes:genderShape
    a sh:PropertyShape ;
    sh:path ex:gender ;
    sh:datatype xsd:string ;
    sh:description "Choose the gender" ;
    sh:in ( "female" "male" "other" ) ;
    sh:maxCount 1 ;
    sh:name "Gender" ;
    sh:order "1"^^xsd:decimal .

In this example, there are three options for the gender: "female", "male" and "other", which are listed in sh:in (Attention: The values are separated via spaces here). The property ex:gender can take only one of the values given in sh:in due to the statement in sh:maxCount. Accordingly, a form field with a selection list is generated.

The form field which is generated on the basis of this property shape looks like this:

1.3.4 Entering a Friendship Relationship

This section is non-normative.

exshapes:friendShape
    a sh:PropertyShape ;
    sh:path ex:friend ;
    sh:name "Friend" ;
    sh:class ex:Person ;
    dash:editor dash:AutoCompleteEditor ;
    
    sh:nodeKind sh:IRI ;
    sh:description "Select another person as a friend" ;
    sh:order "2"^^xsd:decimal .

When entering of friendship relationships, the person which is being described is connected with another person. The fact that the value of the property ex:friend has to be a resource represented by an IRI (and therefore mustn't be a literal) is described by the value sh:IRI of the property sh:nodeKind. The class to which this resource needs to belong is described by the property sh:class. The property dash:editor takes the value dash:AutoCompleteEditor in order to generate a form field which supports the selection of a clearly defined amount of possible URIs (IRIs) by the completion of the user input.

The form field which is generated on the basis of this property shape looks like this:

1.3.5 Entering the GND-ID

This section is non-normative.

exshapes:gndIDShape
    a sh:PropertyShape ;
    sh:path ex:gndID ;
    dash:editor [
        a roger:SelectInstanceFromRemoteDatasetEditor ;
        roger:searchQueryURL "https://portal.dnb.de/opac.atom?currentResultId=per%3D%22{searchTerms}%22%26any%26persons&method=search&" ;
        roger:searchQueryType "application/atom+xml"
        ] ;
    sh:datatype xsd:anyURI ;
    sh:nodeKind sh:Literal ;
    sh:description "Select an entry from the GND (Gemeinsame Normdatei) of the German National Library." ;
    sh:name "GND" ;
    sh:order "3"^^xsd:decimal .

The user shall select the GND-ID for the person from an external database (of the GND). For this, the ROGER software offers a special form element, the roger:SelectInstanceFromRemoteDatasetEditor. roger:searchQueryURL describes how exactly the application should search in the database and roger:searchQueryType describes how the search results should be returned from the external database. For this it is important that these properties are a property of the class roger:SelectInstanceFromRemoteDatasetEditor (and not of sh:PropertyShape).

The form field looks like this:

1.3.6 Summary

This section is non-normative.

The form application in this example requires two files in total: The ROGER specification and the RDFS data model. The entire form looks like this:

1.4 Classes

1.4.1 Node Shapes

Node Shapes structure the form and declare the classes from the RDFS data model which the respective object in the form corresponds to.

exshapes:PersonShape
    a sh:NodeShape ;
    rdfs:label "Person Shape" ;
    sh:targetClass ex:Person ;
    roger:formNode true ;
    sh:property exshapes:nameShape ,
                exshapes:genderShape ,
                exshapes:friendShape ,
                exshapes:gndIDShape .

A node shape has the following obligatory properties in the context of ROGER:

  • sh:targetClass declares for which class from the underlying RDFS data model should be generated
  • sh:property describes the edges originating from the node - and thereby the input fields or the subforms, respectively, of the form to be generated

The optional property roger:formNode declares whether on the basis of this node shapes a form shall be generated (true). Node shapes which shall only serve for the generation of subforms can receive roger:formNode false.

1.4.2 Property Shapes

Property Shapes describe the form fields and the data which shall be entered there.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:path ex:name ;
    sh:name "Name" ;
    sh:order "0"^^xsd:decimal ;
    ...

A property shape has the following obligatory properties in the context of ROGER:

  • sh:path declares which property from the underlying RDFS data model is described with the property shape - i.e. for which property data is generated by the form field
  • sh:name declares the name of the form field
  • sh:order describes the position of this form field in the form

1.5 Properties

1.5.1 General

1.5.1.1 sh:name

sh:name is the label of the form field. The name of the form field is displayed in the form as a label of the corresponding input field.

In ROGER, sh:name is an obligatory property for property shapes.

exshapes:genderShape
    a sh:PropertyShape ;
    sh:name "Gender" ;
    ...
1.5.1.2 sh:path

sh:path declares which property from the underlying RDFS data model is described with the property shape - i.e. for which property data is generated by the form field

In ROGER, sh:path is an obligatory property for property shapes.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:path "ex:name" ;
    ...
1.5.1.3 sh:minCount

sh:minCount declares the minimal amount of values. With it, it is specified how often the respective form field has to be filled in at least. By entering a value higher than 0, the respective form field becomes obligatory. In the application, this is marked via a red asterisk.

In ROGER, sh:minCount is an optional property for property shapes.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:minCount 1 ;
    ...
1.5.1.4 sh:maxCount

sh:maxCount declares the maximum amount of the value. With it, it is specified how often the respective form field can be filled out at most. If sh:maxCount is specified, its value must always be higher than 0. If sh:maxCount is not specified, the respective form field is repeatible any number of times. If both sh:minCount and sh:maxCount are specified, the value of sh:maxCount has to be higher or equal to the value of sh:minCount.

In ROGER, sh:maxCount is an optional property for property shapes.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:maxCount 1 ;
    ...
1.5.1.5 sh:defaultValue

sh:defaultValue provides a default value. This value is pre-entered into the form fields or pre-selected in the selection fields, respectively.

In ROGER, sh:defaultValue is an optional property for property shapes.

exshapes:maritalStatusShape
    a sh:PropertyShape ;
    sh:defaultValue "single" ;
    ...

1.5.2 Validation of the Data

1.5.2.1 sh:pattern

sh:pattern declares a regular expression against which the values entered have to validate.

In ROGER, sh:pattern is an optional property for property shapes.

exshapes:birthShape
    a sh:PropertyShape ;
    sh:pattern "\d{4}" ;
    ...
1.5.2.2 sh:datatype

sh:datatype declares the data type allowed.

In ROGER, sh:datatype is an optional property for property shapes.

As a matter of principle, all data types are allowed which are defined in RDF 1.1 Concepts and Abstract Syntax. However, the data types are restricted according to the input field. In the explanations to the input fields, the allowed data types are listed.

Attention: If sh:datatype is used, sh:nodekind can only have the value sh:Literal. The specification via sh:nodekind is optional in this case.

If values are prescribed, for example via sh:in, these values need to conform to the data type specified.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:datatype xsd:string ;
    ...
1.5.2.3 sh:nodekind

sh:nodekind declares what type of node the value has to conform to.

In ROGER, sh:nodekind is an optional property for property shapes.

As a matter of principle, all data types are allowed which are defined in RDF 1.1 Concepts and Abstract Syntax. However, the data types are restricted according to the input field. In the explanations to the input fields, the allowed data types are listed.

Attention: If sh:datatype is used, sh:nodekind can only have the value sh:Literal haben. The specification via sh:nodekind is optional in this case.

exshapes:friendShape
    a sh:PropertyShape ;
    sh:nodeKind sh:IRI ;
    ...
1.5.2.4 sh:class

sh:class declares the class (from the RDFS data model) which the value of the property has to be an instance of.

In ROGER, sh:class is an optional property for property shapes.

exshapes:friendShape
    a sh:PropertyShape ;
    sh:class ex:Person ;
    ...
1.5.2.5 sh:node

sh:node describes which node shape the value of the property has to conform to.

In ROGER, sh:node is an optional property for property shapes.

exshapes:addressShape
    a sh:PropertyShape ;
    sh:node exshapes:AddressShape ;
    ...
1.5.2.6 sh:message

sh:message contains the text of an error message which is diplayed when a validation error is found.

In ROGER, sh:message is an optional property for property shapes.

exshapes:birthShape
    a sh:PropertyShape ;
    sh:message "The year of birth needs to be specified by a number consisting of four digits." ;
    ...

1.5.3 Predefined Values

1.5.3.1 sh:in

sh:in declares possible values for the property shape. In ROGER, this is displayed as an selection field.

Attention: The values are separated via spaces here.

In ROGER, sh:in is an optional property for property shapes.

In combination with sh:in, sh:datatype needs to take one of the following values:

  • xsd:string
  • xsd:decimal
  • xsd:integer
  • xsd:double
  • xsd:float
  • xsd:int
  • xsd:long
  • xsd:anyURI

Via sh:minCountsh:maxCount, it can be specified how many values need to/can be selected.

If sh:in is used together with sh:defaultValue, the value which is specified in sh:defaultValue is pre-selected.

exshapes:genderShape
    a sh:PropertyShape ;
    sh:in ( "female" "male" "other" ) ;
    ...

1.5.4 Input Fields

Input elements are described via the property dash:editor. It specifies the type of the input field.

In ROGER, dash:editor is an optional property for property shapes.

1.5.4.1 Free Text Fields
1.5.4.1.1 dash:TextAreaEditor

dash:TextAreaEditor is a multiline text input field.

In combination with dash:TextAreaEditor, sh:datatype has to take the value xsd:string.

If dash:TextAreaEditor is used in combination with sh:defaultValue, the value specified there is pre-entered in the form field but can be modified.

exshapes:commentShape
    a sh:PropertyShape ;
    dash:editor dash:TextAreaEditor ;
    sh:datatype xsd:string ;
    ...
1.5.4.1.2 dash:TextFieldEditor

dash:TextFieldEditor is a single-line text input field.

In combination with dash:editor dash:TextFieldEditor, sh:datatype has to take one of the following values:

  • xsd:string
  • xsd:decimal
  • xsd:integer
  • xsd:double
  • xsd:float
  • xsd:int
  • xsd:long
  • xsd:anyURI

If dash:TextFieldEditor is used in combination with sh:defaultValue, the value specified there is pre-entered in the form field but can be modified.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:datatype xsd:string ;
    dash:editor dash:TextFieldEditor ;
    ...
1.5.4.1.3 dash:RichTextEditor

dash:RichTextEditor is an input field which allows for the entering of formatted text.

In combination with dash:RichTextEditor, sh:datatype has to take the value rdf:HTML.

exshapes:curriculumVitaeShape
    a sh:PropertyShape ;
    dash:editor dash:RichTextEditor ;
    sh:datatype rdf:HTML ;
    ...
1.5.4.2 Linking to Other Data
1.5.4.2.1 dash:AutoCompleteEditor

dash:AutoCompleteEditor is a search field with an autocomplete feature for the linking to instances of classes whose RDFS data model is known and which are stored in the same data store.

In combination with dash:AutoCompleteEditor, sh:nodeKind has to take the value sh:IRI.

The class which the instances stem from which can be linked to is specified in sh:class.

exshapes:friendShape
    a sh:PropertyShape ;
    sh:class ex:Person ;
    dash:editor dash:AutoCompleteEditor ;
    
    sh:nodeKind sh:IRI ;
    ...
1.5.4.2.2 roger:SelectInstanceFromRemoteDatasetEditor

roger:SelectInstanceFromRemoteDatasetEditor is a search field for the linking with data from an external database (in TURTLE: URI with angle brackets) or for the acquisition of data from an external database (in TURTLE: Literal in quotation marks).

roger:SelectInstanceFromRemoteDatasetEditor has to be configurated: Via roger:searchQueryURL, it is described which database is queried in which way. Via roger:searchQueryType, it is described which type the search results shall have. Two values are possible:

  • If application/atom+xml is specified, the result is an Atom feed. The form application resorts to the following child ements of entry to display the results: title and, if present, content. The content of the child element id is adopted as value.
  • If application/rss+xml is specified, the result is an RSS feed. The form application resorts to the following child ements of item to display the results: title and, if present, description. The content of the child element id is adopted as value.

If a linking to data from an external database is establed via the form field, sh:nodeKind has to take the value sh:IRI.

If data from an external database is acquired via the form field, sh:nodeKind has to take the value sh:Literal . sh:datatype can take one of the following values:

  • xsd:string
  • xsd:decimal
  • xsd:integer
  • xsd:double
  • xsd:float
  • xsd:int
  • xsd:long
  • xsd:anyURI
  • xsd:date
  • xsd:dateTime

Only data that have the same property can be adopted. This is defined via sh:path. For the adoption of for example the surname of a GND entry, the respective property (gndo:surname) needs to be defined via sh:path.

exshapes:gndSurnameShape
    a sh:PropertyShape ;
    dash:editor [
    a roger:SelectInstanceFromRemoteDatasetEditor ;
    roger:searchQueryURL "https://portal.dnb.de/opac.atom?currentResultId=per%3D%22{searchTerms}%22%26any%26persons&method=search&" ;
    roger:searchQueryType "application/atom+xml" ;
    ] ;
    sh:path gndo:surname;
    ...
1.5.4.3 Specific Kinds of Data
1.5.4.3.1 dash:DatePickerEditor

dash:DatePickerEditor is an selection field in the shape of a calendar for the selection of dates.

In combination with dash:DatePickerEditor, sh:datatype has to take the value xsd:date.

exshapes:birthdayShape
    a sh:PropertyShape ;
    dash:editor dash:DatePickerEditor ;
    sh:datatype xsd:date ;
    ...
1.5.4.3.2 dash:DateTimePickerEditor

dash:editor dash:DateTimePickerEditor is an selection field in the shape of a calendar for the selection of dates, including a time of day.

In combination with dash:DateTimePickerEditor, sh:datatype has to take the value xsd:dateTime.

exshapes:nextExamShape
    a sh:PropertyShape ;
    dash:editor dash:DateTimePickerEditor ;
    sh:datatype xsd:dateTime ;
    ...
1.5.4.3.3 dash:URIEditor

dash:URIEditor generates a form field for the entering of IRIs or URIs, respectively, which mustn't be understood as a representation of a resource in the RDF sense (i.e. this field is for URLs or URNs of web resources or similar).

In combination with dash:editor dash:URIEditor, sh:nodekind has to take the value sh:Literal.

In combination with dash:editor dash:URIEditor, sh:datatype has to take the value xsd:anyURI.

exshapes:homepageShape
    a sh:PropertyShape ;
    dash:editor dash:URIEditor ;
    sh:nodeKind sh:Literal ;
    sh:datatype xsd:anyURI
    ...
1.5.4.3.4 dash:BooleanSelectEditor

dash:BooleanSelectEditor generates a form field for the entering of true/false values.

In combination with dash:BooleanSelectEditor, sh:datatype has to take the value xsd:boolean.

exshapes:aliveShape
    a sh:PropertyShape ;
    dash:editor dash:BooleanSelectEditor ;
    sh:datatype xsd:boolean ;
    ...

1.5.5 Description and Structure of the Form

1.5.5.1 roger:formNode

roger:formNode specifies whether a form is generated from a node shape. For this, the value is set to true.

For subforms, roger:formNode false can be specified.

In ROGER, roger:formNode is an optional property for property shapes.

exshapes:PersonShape
    a sh:NodeShape ;
    roger:formNode true ;
    ...
1.5.5.2 sh:property

sh:property specifies which property shapes a node shape refers to. This means, which form fields the (sub)form should have.

In ROGER, sh:property is an obligatory property for node shapes and can be repeated any number of times.

exshapes:PersonShape
    a sh:NodeShape ;
    sh:property exshapes:nameShape ,
                exshapes:genderShape ,
                exshapes:friendShape ,
                exshapes:gndIDShape ;
    ...
1.5.5.3 sh:targetClass

sh:targetClass specifies the class in the RDFS data model whose instances the node shape should be applied to.

In ROGER, sh:targetClass is an obligatory property for node shapes.

exshapes:PersonShape
    a sh:NodeShape ;
    sh:targetClass ex:Person ;
    ...
1.5.5.4 dash:DetailsEditor

dash:DetailsEditor describes a subform.

sh:node refers to the node shape on whose basis the subform is generated.

In combination with dash:DetailsEditor, sh:nodekind has to take the value sh:BlankNode.

exshapes:addressShape
    a sh:PropertyShape ;
    dash:editor dash:DetailsEditor ;
    sh:node exshapes:AddressShape ;
    sh:nodeKind sh:BlankNode ;
    ...
1.5.5.5 sh:description

sh:description describes the form field. This description is displayed in a pop-over in the ROGER application.

In ROGER, sh:description is an optional property for property shapes.

exshapes:nameShape
    a sh:PropertyShape ;
    sh:description "Enter the name" ;
    ...
1.5.5.6 sh:order

sh:order specifies the order of the form fields. For this, the value of sh:order is taken relative to the values of the various other property shapes of the same node shapes.

Attention! Each property shape always receives only exactly one sh:order value. The value of sh:order therefore applies to all node shapes that use this property shape.

In ROGER, sh:order is an obligatory property for property shapes.

Type: Decimal

exshapes:nameShape
    a sh:PropertyShape ;
    sh:order "0"^^xsd:decimal ;
    ...

2. Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

A. References

A.1 Normative references

[rdf11-concepts]
RDF 1.1 Concepts and Abstract Syntax. Richard Cyganiak; David Wood; Markus Lanthaler. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/rdf11-concepts/

A.2 Informative references

[rdf-schema]
RDF Schema 1.1. Dan Brickley; Ramanathan Guha. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/rdf-schema/
[shacl]
Shapes Constraint Language (SHACL). Holger Knublauch; Dimitris Kontokostas. W3C. 20 July 2017. W3C Recommendation. URL: https://www.w3.org/TR/shacl/