Skip to content

SHACL Core components ​

The targets, constraints and paths pgrdf.validate evaluates 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 ​

ComponentSelects
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 ​

ComponentAsserts
sh:minCount nAt least n values on the path.
sh:maxCount nAt most n values on the path.

Value type ​

ComponentAsserts
sh:datatype <xsd:…>Each value is a literal of that datatype.
sh:nodeKind sh:IRI / sh:Literal / sh:BlankNode / sh:IRIOrLiteral / sh:BlankNodeOrIRI / sh:BlankNodeOrLiteralEach value is of that node kind.
sh:class <C>Each value is an instance of class C.

Value range ​

ComponentAsserts
sh:minInclusive n / sh:maxInclusive nInclusive numeric bounds.
sh:minExclusive n / sh:maxExclusive nExclusive numeric bounds.

Strings and languages ​

ComponentAsserts
sh:minLength n / sh:maxLength nLength 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 trueNo two values share a language tag.

Values and property pairs ​

ComponentAsserts
sh:in ( a b c )Each value is one of the listed values.
sh:hasValue vv 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 ​

ComponentAsserts
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:qualifiedMaxCountBetween min and max values conform to the given shape.
sh:and, sh:or, sh:not, sh:xoneBoolean 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:

PathMeaning
ex:worksAtA 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 ​

ComponentEffect
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.

Next: Report as data →

pgRDF is released under the MIT license. Documentation built with VitePress, served via GitHub Pages.