SHACL Core components
The targets, constraints and paths
pgrdf.validateevaluates in the default'native'mode, which is conformant with the W3C SHACL Core test suite (25/25).'pgrdf'mode evaluates SHACL Core as well.
Targets: which nodes to validate
| Component | Selects |
|---|---|
sh:targetClass <C> | Every instance of class C, including instances inferred by materialize. |
sh:targetNode <iri> | That specific node. |
sh:targetSubjectsOf <p> | Every subject of predicate p. |
sh:targetObjectsOf <p> | Every object of predicate p. |
Cardinality
| Component | Asserts |
|---|---|
sh:minCount n | At least n values on the path. |
sh:maxCount n | At most n values on the path. |
Value type
| Component | Asserts |
|---|---|
sh:datatype <xsd:…> | Each value is a literal of that datatype. |
sh:nodeKind sh:IRI / sh:Literal / sh:BlankNode / sh:IRIOrLiteral / sh:BlankNodeOrIRI / sh:BlankNodeOrLiteral | Each value is of that node kind. |
sh:class <C> | Each value is an instance of class C. |
Value range
| Component | Asserts |
|---|---|
sh:minInclusive n / sh:maxInclusive n | Inclusive numeric bounds. |
sh:minExclusive n / sh:maxExclusive n | Exclusive numeric bounds. |
Strings and languages
| Component | Asserts |
|---|---|
sh:minLength n / sh:maxLength n | Length bounds on the lexical form. |
sh:pattern "regex" | The lexical form matches the regular expression (optional sh:flags). |
sh:languageIn ( "en" "fr" ) | Each value's language tag is in the list. |
sh:uniqueLang true | No two values share a language tag. |
Values and property pairs
| Component | Asserts |
|---|---|
sh:in ( a b c ) | Each value is one of the listed values. |
sh:hasValue v | v is among the values. |
sh:equals <p> | The values equal the values of p on the same node. |
sh:disjoint <p> | No value is also a value of p on the same node. |
sh:lessThan <p> / sh:lessThanOrEquals <p> | Each value is less than (or equal to) every value of p. |
Shapes and logic
| Component | Asserts |
|---|---|
sh:property [ … ] | Applies a property shape to the values on its sh:path. |
sh:node <Shape> | Each value conforms to another node shape. |
sh:qualifiedValueShape with sh:qualifiedMinCount / sh:qualifiedMaxCount | Between min and max values conform to the given shape. |
sh:and, sh:or, sh:not, sh:xone | Boolean combinations of shapes. |
sh:closed true (with sh:ignoredProperties) | The node has no properties other than those the shape declares. |
Property paths
sh:path takes a predicate IRI or a SHACL property path. For example:
| Path | Meaning |
|---|---|
ex:worksAt | A single predicate. |
( ex:worksAt ex:locatedIn ) | A sequence: ex:worksAt then ex:locatedIn. |
[ sh:inversePath ex:partOf ] | ex:partOf, followed backwards. |
[ sh:alternativePath ( ex:sku ex:label ) ] | Either predicate. |
[ sh:zeroOrMorePath ex:partOf ] | Zero or more steps of ex:partOf. |
In the report, a path that isn't a single predicate appears in resultPath in a readable form, for example "(http://example.org/worksAt / http://example.org/locatedIn)".
Severity
| Component | Effect |
|---|---|
sh:severity sh:Info / sh:Warning / sh:Violation (default) | Sets resultSeverity on the results that shape produces, reported as "sh:Info", "sh:Warning" or "sh:Violation". |
Filter the report on resultSeverity to treat warnings differently from violations. See Report as data.
Beyond SHACL Core
SHACL-SPARQL constraints (sh:sparql with an sh:select query on a node shape) are evaluated in mode => 'pgrdf', together with all the Core components above. See SHACL-SPARQL for what that mode evaluates, and a limitation to know about.
If a shapes graph uses a component the chosen mode can't evaluate, strict mode refuses and names the component. sh:sparql under 'native' is the common case.