Introduction
This topic contains a kind of portal to the contents of the W3C Recommendation "Shapes Constraint Language (SHACL)". This is still Work In Progress.
Disclaimer
In cases where the texts in this topic would contradict the contents of the W3C Recommendation "Shapes Constraint Language (SHACL)" the latter prevails.
Terms and Definitions
NOTE - Links in the text first go to the short descriptions below, and from there to the SHACL Recommendation.
SHACL Processor - A SHACL validation engine that takes as input a graph to be validated (called data graph) and a graph containing SHACL shapes declarations (called shapes graph), and produces a validation report, also expressed as a graph.The data graphs and shapes graphs may be merged in one file.

Data Graph - your RDF data-to-be-validated in Turtle, JSON-LD or RDF/XML
Nodes - The set of nodes of an RDF graph is the set of subjects and objects of triples in the graph.
Shapes Graph - a graph that contains two main types of shapes: node shapes and property shapes
Node Shape - declares constraints directly on a node. A node shape usually contains several property shapes which are declared through the sh:property predicate.
Property shape - declares a constraint on the value associated with a node through a path; a property shape has a property sh:path that declares the path that goes from the focus node to the value that they describe. The most frequent paths are predicate paths which are formed by a single IRI.
Property Paths
Property Path - A possible route through a graph between two graph nodes. A trivial case is a property path of length exactly 1, which is a triple pattern. The ends of the path may be RDF terms or variables. Variables can not be used as part of the path itself, only the ends.
sh:path - A property shape is the subject of a triple that has sh:path as its predicate. A shape has at most one value for sh:path. Each value of sh:path in a shape must be a well-formed SHACL property path.
elt - A path element ('elt' = element), which may itself be composed of path constructs.
sh:PredicatePath - A subject-to-object path with a length of one and an IRI as object
sh:InversePath - An object-to-subject path
sh:SequencePath - A path that is a sequence of elt1 followed by elt2 ; a SHACL list with at least two members and each member is a well-formed SHACL property path.
sh:AlternativePath - A path that entails an alternative of elt1 or elt2 (all possibilities are tried)
sh:ZeroOrMorePath - A path that connects the subject and object of the path by zero or more matches of elt
sh:OneOrMorePath - A path that connects the subject and object of the path by one or more matches of elt
sh:ZeroOrOnePath - A path that connects the subject and object of the path by zero or one matches of elt
RDF term - IRI, literal, or blank node
Value Node - defined as follows:
- For node shapes the value nodes are the individual focus nodes, forming a set with exactly one member.
- For property shapes with a value for
sh:path
p
the value nodes are the set of nodes in the data graph that can be reached from the focus node with the path mapping ofp
.Unless stated otherwise, the value of sh:resultPath of each validation result is a SHACL property path that represents an equivalent path to the one provided in the shape.
Target Declarations
Focus Node - Any targeted rdfs:subject or rdfs:object in the Data Graph
Targets - define which nodes in the data graph must conform to the shape;
sh:targetClass - targets all resources that are instances of a given class;
sh:targetNode - targets a specific resource, e.g., a given instance;
sh:targetSubjectsOf - targets all the subjects of a given predicate;
sh:targetObjectsOf - targets all the objects of a given predicate
SHACL Constraint Components
Constraint - defines how to validate a node;
Type | Constraints | Definition |
Cardinality | sh:minCount | Cardinality that restricts the minimun amount of occurences of a given property. Default value: 0 |
sh:maxCount | Cardinality that restricts the maximum amount of occurences of a given property. Default value: 0 | |
Types of values | sh:class | Constraint that restricts to nodes that are instances of a given class |
sh:datatype | Constraint that restricts the xsd: datatype of all value nodes to a given value | |
sh:nodeKind | Constraint that restricts the kind of value of a property to one of the following: BlankNode, IRI, Literal, BlankNodeOrIRI, BlankdNodeOrLiteral, or IRIOrLiteral | |
Other constraints | sh:in | Enumerates the value options that a property may have |
sh:hasValue | Verifies whether the focus node has a given value | |
Range of values | sh:minInclusive | The minimum inclusive value of a value range |
sh:maxInclusive | The maximum inclusive value of a value range | |
sh:minExclusive | The minimum exclusive value of a value range | |
sh:maxExclusive | The maximum exclusive value of a value range | |
String based | sh:minLength | Restricts the minimum string length on value nodes |
sh:maxLength | Restricts the maximum string length on value nodes | |
sh:pattern | Checks if the string value matches a regular expression | |
sh:languageIn | Checks that the property values are expressed in the given list of languages | |
sh:uniqueLang | Checks that no pair of nodes use the same language tag | |
Logical constraints | sh:not | Negation of a shape |
sh:and | Conjunction of a list of shapes | |
sh:or | Each node conforms to at least one of the provided shapes or both | |
sh:xone | Specifies a condition that each value node conforms to exactly one of the provided shapes (not both) - (a.k.a. XOR - eXclusive OR) | |
Closed shapes | sh:closed | If set to true, properties that are not explicitly described in the shape are not allowed |
sh:ignoredProperties | Optional list of properties that are also permitted in addition to those explicitly enumerated in the shape | |
Property pair constraints | sh:equals | The sets of values of both properties at a given focus node must be equal |
sh:disjoint | The sets of values of both properties at a given focus node must be different | |
sh:lessThan | The values must be smaller than the values of another property | |
sh:lessThanOrEquals | The values must be smaller or equal than the values of another property | |
Qualified shapes | sh:node | All values of a given property must comply with a given shape |
sh:property | Can be used to specify that each value node has a given property shape | |
sh:qualifiedValueShape | The shape that the specified number of nodes needs to conform to | |
sh:qualifiedValueShapesDisjoint | If set to true, for the counting, the nodes must not conform to any of the sibling shapes | |
sh:qualifiedMinCount | Minimum number of nodes that conform to the shape | |
sh:qualifiedMaxCount | Maximum number of nodes that conform to the shape |
Shape Characteristics
Prefix Declarations for SPARQL Queries
SPARQL-based Constraint Components
Term | Desription |
sh:sparql | A SPARQL-based constraint declaring the SPARQL query to evaluate |
sh:parameter | The values of sh:parameter are called parameter declarations. Each parameter declaration has exactly one value for the property sh:path. At parameter declarations, the value of sh:path is an IRI. |
sh:labelTemplate | Can be used at any constraint component to suggest how constraints could be rendered to humans. |
sh:nodeValidator | A sh:SPARQLSelectValidator for node shapes |
sh:propertyValidator | A sh:SPARQLSelectValidator for property shapes |
sh:validator | A sh:SPARQLAskValidator |
Validation results vocabulary
Term | Desription |
sh:ValidationReport | Result of the validation process that reports the conformance and the set of all validation results |
sh:conforms | True if a focus node conforms with a given shape and false otherwise |
sh:result | Contains the result graph for each validation result |
sh:shapesGraphWellFormed | Informs the consumer of the validation report about the fact that the validated shapes graph is well-formed. |
sh:ValidationResult | Used to report individual SHACL validation results |
sh:focusNode | The node which was tested and caused the validation result |
sh:resultPath | Points to a well-formed SHACL property path |
sh:value | Points to the value of the property that caused the result |
sh:sourceShape | Points to the shape that the given focus node was validated against |
sh:sourceConstraintComponent | Refers to which constraint component has been violated |
sh:detail | May point to further details about the cause of the violation |
sh:resultMessage | Textual details about the error. The message can be affected by the sh:message property in the shapes graph |
sh:resultSeverity | A value which is equal to the sh:severity value of the shape that caused the violation error. The default value is sh:Violation |