Skip to content

SHACL Core components

What constraint components are supported and what each one asserts.

Target selectors — which nodes to validate

ComponentEffect
sh:targetClass <C>Pick every instance of class C as a focus node.
sh:targetNode <iri>Pick a specific IRI as a focus node.
sh:targetSubjectsOf <p>Pick every subject of predicate p.
sh:targetObjectsOf <p>Pick every object of predicate p.

Cardinality and shape

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

Type constraints

ComponentAsserts
sh:datatype <xsd:string>Value is a literal of the given datatype.
sh:nodeKind sh:IRI / sh:Literal / sh:BlankNode / sh:IRIOrLiteral / sh:BlankNodeOrIRI / sh:BlankNodeOrLiteralValue is of the given RDF node kind.
sh:class <C>Value is an instance of class C.

Value-set constraints

ComponentAsserts
sh:in (a b c)Value is one of the enumerated values.

String constraints

ComponentAsserts
sh:minLength n / sh:maxLength nLength bounds on the literal's lexical form.
sh:pattern "regex"Regex match against the literal's lexical form. Optional sh:flags.

Numeric range

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

Composition

ComponentAsserts
sh:property [ … ]Apply the property-shape body to a property path.
sh:path <p>The path the property shape targets.
sh:and, sh:or, sh:not, sh:xoneBoolean composition of nested shape references.

Severity

ComponentEffect
sh:severity sh:Info / sh:Warning / sh:Violation (default)Choose the result severity reported in resultSeverity.

What's not yet supported

ComponentStatus
SHACL-SPARQL constraint components (sh:sparql, sh:select, sh:ask)🚀 v0.5 — see Forward edge.
Property paths with full expressivity (alternation, sequence, inverse beyond simple)v0.5 alongside the SPARQL property-path work.

Tests

The real engine is exercised end-to-end by tests/regression/sql/71-shacl-real.sql. The W3C SHACL manifest runner (ramping up to full conformance coverage) is tracked under tests/w3c-shacl/ and lands in v0.5.

Apache-2.0 licensed. Documentation for pgRDF — built with VitePress, served via GitHub Pages.