Property Node

Property Nodes express the constraints for a given Property. sh:or holds the possible ranges and their constraints for the property. If there is only 1 possible range, then it is possible to express all range constraints in the property node itself instead of using sh:or in theory. Consequently, any property-key of a RangeNode may be part of a Property Node. However, it is recommended to always use sh:or to wrap the range(s), since within semantify.it the code expects this structure.

Key-value table

Example

Tthe last 2 examples express the same constraints, it is recommeded to use the variant with sh:or:

{
    "@type": "sh:PropertyShape",
    "sh:path": "schema:address",
    "sh:minCount": 1,   
    "sh:maxCount": 1,   
    "sh:order": 12,
    "rdfs:comment": "This Property is required. Its value must be either a String or a PostalAddress entity.",
    "sh:or": [
         ...RangeNodes...
    ]
},
{
    "@type": "sh:PropertyShape",
    "sh:path": "schema:name",
    "sh:or": [
       {
          "sh:datatype": "xsd:string",
          "sh:minLength": 3
       }
    ]
},
{
    "@type": "sh:PropertyShape",
    "sh:path": "schema:name",
    "sh:datatype": "xsd:string",
    "sh:minLength": 3
}

Property-pair constraints

The following property-pair constraints allow to compare the literal values of different properties. It makes sense to define them at property level, rather than at range level.

Regarding the Error generation based on these property-pair constraints, tests were done trying https://shacl.org/playground/:

  • sh:equals produces an error if the specified property to compare does not exist.

  • sh:disjoint does NOT produce an error if the specified property to compare does not exist.

  • sh:lessThan does NOT produce an error if the specified property to compare does not exist.

  • sh:lessThanOrEquals does NOT produce an error if the specified property to compare does not exist.

Textual definition of error generation in the SHACL specification:

Regarding the implementation, have a look at https://www.w3.org/TR/rdf-sparql-query/

Example

{
    "@type": "sh:PropertyShape",
    "sh:path": "schema:name",
    "rdfs:comment": "The full name of a Person. It should not be the same as the 'givenName', which is only the first name of the Person.",
    "sh:disjoint": [
        "schema:givenName"
    ],
    "sh:or": [
       {
          "sh:datatype": "xsd:string"       
       }
    ]
},
{
    "@type": "sh:PropertyShape",
    "sh:path": "schema:givenName",
    "rdfs:comment": "The first name of a person.",
    "sh:or": [
       {
          "sh:datatype": "xsd:string"       
       }
    ]
}

Last updated