SHACL Vocabulary
type: Graph
comment: The vocabulary defining the Shapes Constraint Language (SHACL).

Resource
type: Class

Shape
type: Shape class
subclass of: Resource
comment: The class of shapes.
property: constraint
  predicate: constraint
  value class: Constraint
  comment: Defines arbitrary constraints on the matching resources. Use sh:property for structural property declarations.
property: property
  predicate: property
  value class: Property constraint
  comment: Declares that a given property is relevant for matching resources.
property: inverse property
  predicate: inverse property
  value class: Inverse property constraint
  comment: Declares that a given incoming reference property is relevant for matching resources.
property: filter shape
  predicate: filter shape
  value class: Shape
  comment: Links a Shape to other Shapes that the tested nodes need to fulfill before the constraints of the shape are evaluated.
property: scope
  predicate: scope
  value class: Scope
  comment: Links a Shape to Scopes that produce the focus nodes that the shape applies to.
property: scope class
  predicate: scope class
  value class: Class
  comment: Links a Shape to a class, establishing that all instances of that class are expected to have this shape.

Shape class
type: Class
subclass of: Class
subclass of: Shape
comment: The metaclass for classes that are also shapes.

Class
type: Shape class
subclass of: Resource
comment: The class of classes.
property: abstract
  predicate: abstract
  datatype: boolean
  max count: 1
  comment: True to indicate that this class is not expected to have direct instances.
property: private
  predicate: private
  datatype: boolean
  max count: 1
  comment: True to indicate that this class is only meant to be used inside of the graph that it has been defined in. This is often used to discourage instantiation outside of controlled scenarios. User interfaces may hide private classes from selection widgets.

Datatype
type: Class
subclass of: Class
comment: The class of RDF datatypes.

Literal
type: Class
subclass of: Resource
comment: The class of literal values, eg. textual strings and integers.

List
type: Class
subclass of: Resource
comment: The class of RDF Lists.

Property
type: Class
subclass of: Resource
comment: The class of RDF properties.

text
type: Datatype
subclass of: Literal
comment: The union of xsd:string and rdf:langString, to be used in cases where a property can either be a string or a string with a language tag. This type should never be used directly as the type of literals.

boolean
type: Datatype
subclass of: Literal

date
type: Datatype
subclass of: Literal

dateTime
type: Datatype
subclass of: Literal

decimal
type: Datatype
subclass of: Literal

float
type: Datatype
subclass of: Literal

integer
type: Datatype
subclass of: Literal

string
type: Datatype
subclass of: Literal

time
type: Datatype
subclass of: Literal

Graph
type: Shape class
subclass of: Resource
comment: A collection of RDF triples identified by a URI. In a Linked Data scenario, a graph should be accessible from its URI via content negotiation in formats such as Turtle and JSON-LD.
property: entailment
  predicate: entailment
  value class: Resource
  node kind: IRI
  comment: Links a graph with an entailment regime that its shape definitions shall be evaluated with.
property: include
  predicate: include
  value class: Graph
  comment: Links a graph with other graphs that shall be included into the query graph over which constraints are validated. This is a transitive property, i.e. includes of includes are also added.
property: shapes graph
  predicate: shapes graph
  value class: Resource
  comment: Links a graph with other graphs that shall be included into the shapes graph that includes shape and template definitions as well as the SHACL metamodel.

Node kind
type: Class
subclass of: Resource
comment: The class of RDF node kinds: literals, blank nodes and IRIs.

Blank node
type: Node kind
comment: The node kind of all blank nodes.

IRI
type: Node kind
comment: The node kind of all IRIs.

Literal
type: Node kind
comment: The node kind of all literals.

Macro
type: Shape class
subclass of: Shape class
comment: Abstract superclass of macro components of a SHACL library, especially Functions and Templates. Macros can take arguments, which are constraints that are different from PropertyConstraints in that they can only have at most one value.
abstract: true
property: argument
  predicate: argument
  value class: Argument
  comment: Declares the argument(s) of this macro.
constraint:
  comment: The same predicate can only be used once at all Arguments.
  message: Duplicate Argument for the same predicate {?argPredicate}
  predicate: argument
  SPARQL: SELECT ?this (?this AS ?subject) (?predicate AS ?argPredicate) (?argument1 AS ?object) WHERE { ?this rdfs:subClassOf* ?class1 . ?class1 sh:argument ?argument1 . ?argument1 sh:predicate ?predicate . ?this rdfs:subClassOf* ?class2 . ?class2 sh:argument ?argument2 . FILTER (?argument1 != ?argument2) . ?argument2 sh:predicate ?predicate . }

Function
type: Shape class
subclass of: SPARQLExecutable
subclass of: Macro
comment: A macro implementing a SPARQL function, backed by a SPARQL ASK or SELECT query.
property: cachable
  predicate: cachable
  datatype: boolean
  max count: 1
  comment: True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls.

Validation functions
type: Function
subclass of: Resource
abstract: true
comment: The recommended abstract superclass for all validation functions that take a value as an argument and return a boolean result (true if the value is OK).
argument:
  index: 0
  predicate: value
  comment: The value to validate.

Template
type: Shape class
subclass of: Macro
subclass of: SPARQLExecutable
comment: A macro that acts as an abstraction of a (reusable) SPARQL query. The query can be parameterized by the supplied arguments.
abstract: true
property: label template
  predicate: label template
  datatype: text
  comment: Outlines how human-readable labels of instances of this template class shall be produced. The values must be strings that can contain {?argName} as placeholders for the actual values of the given argument. There may be multiple values, for different languages.

Profile
type: Shape class
subclass of: Resource
comment: A profile is a collection of constraint templates and scope templates. Profiles can be used to group together templates with similar complexity. Tools can indicate that they support specific profiles only.
property: constraint template
  predicate: constraint template
  value class: Constraint template
  comment: A constraint template supported by the profile.
property: scope template
  predicate: scope template
  value class: Scope template
  comment: A scope template supported by the profile.
property: extends
  predicate: extends
  value class: Profile
  comment: Points at another profile that forms a sub-set of this profile.

Result class
type: Class
subclass of: Shape class
comment: The meta-class of result types that can be instantiated to represent validation results.

Result
type: Shape class
subclass of: Resource
comment: Instances of subclasses of this class can be constructed during constraint validation, to represent a single validation result.
abstract: true
property: detail
  predicate: detail
  value class: Result
  comment: Can link a result with other results that provide more details. This is especially useful to describe violations against nested patterns or shapes.
property: message
  predicate: message
  datatype: text
  comment: A human-readable message explaining the cause of the result. Multiple values are possible assuming they have different languages.
property: subject
  predicate: subject
  value class: Resource
  max count: 1
  comment: The subject of triples involved in this result.
property: predicate
  predicate: predicate
  value class: Property
  max count: 1
  comment: The predicate of triples involved in this result.
property: object
  predicate: object
  max count: 1
  comment: The object of triples involved in this result.
property: focus node
  predicate: focus node
  value class: Resource
  max count: 1
  comment: The focus node evaluated when the result was produced.
property: source constraint
  predicate: source constraint
  value class: Constraint
  max count: 1
  comment: The Constraint that caused this result.
property: source shape
  predicate: source shape
  value class: Shape
  max count: 1
  comment: The Shape that caused this result.

Constraint Violation
type: Shape class
subclass of: Result
comment: A validation result representing a constraint violation.
abstract: true

Info
type: Result class
subclass of: Result
comment: An INFO-level validation result.

Warning
type: Result class
subclass of: Constraint Violation
comment: A non-critical constraint violation indicating a warning.

Error
type: Result class
subclass of: Constraint Violation
comment: A constraint violation indicating an error.

Fatal Error
type: Result class
subclass of: Error
comment: An error that cannot be recovered and further evaluation may terminate immediately. Engines may decide to perform the validation of potentially fatal constraints first.

Result annotation
type: Shape class
subclass of: Resource
comment: Defines the rules to derive the values of a given annotation property as extra values for a constraint violation.
property: annotation property
  predicate: annotation property
  comment: The annotation property that shall be set.
  min count: 1
  max count: 1
  value class: Property
property: annotation value
  predicate: annotation value
  comment: The values of the annotation property.
  max count: 1
property: annotation variable name
  predicate: annotation var name
  comment: The name of the SPARQL variable from the SELECT clause that shall be used for the values.
  max count: 1
  datatype: string

SPARQLExecutable
type: Shape class
subclass of: Class
property: SPARQL
  predicate: SPARQL
  datatype: string
  max count: 1
  comment: The SPARQL query to execute.

Scope
type: Class
subclass of: Resource
comment: An abstract superclass of scopes. Scopes are either template calls or native scopes with an executable body.
abstract: true

Native scope
type: Shape class
subclass of: Scope
subclass of: SPARQLExecutable
comment: A scope that has a native executable body attached to it.

Scope template
type: Shape class
subclass of: Template
comment: A template that is used to compute a scope.

Scope constraint
type: Scope template
subclass of: Scope
comment: A scope that is instantiating a template.
abstract: true

All objects scope
type: Scope template
subclass of: Scope constraint
comment: A scope that includes all objects in the graph, except literals.
SPARQL: SELECT DISTINCT ?this WHERE { ?anySubject ?anyPredicate ?this . FILTER (!isLiteral(?this)) . }

All subjects scope
type: Scope template
subclass of: Scope constraint
comment: A scope that includes all subjects in the graph.
SPARQL: SELECT DISTINCT ?this WHERE { ?this ?anyPredicate ?anyObject . }

Inverse property scope
type: Scope template
subclass of: Scope constraint
comment: A scope that includes all objects that have at least one value for a given predicate.
argument: predicate
  predicate: predicate
  value class: Property
  comment: The property to look for.
SPARQL: SELECT DISTINCT ?this WHERE { ?any ?predicate ?this . }

Property scope
type: Scope template
subclass of: Scope constraint
comment: A scope that includes all subjects that have at least one value for a given predicate.
argument: predicate
  predicate: predicate
  value class: Property
  comment: The Property to look for.
SPARQL: SELECT DISTINCT ?this WHERE { ?this ?predicate ?any . }

Constraint
type: Shape class
subclass of: Resource
comment: An abstract superclass of constraints. Constraints are either template calls or "native" constraints with an executable body.
abstract: true
property: filter shape
  predicate: filter shape
  value class: Shape
  comment: Links a constraint to Shapes that the tested nodes need to fulfill before the constraint is evaluated.
property: severity
  predicate: severity
  max count: 1
  value class: Result class
  comment: Specifies the severity to use for any constraint violation produced by this constraint. Defaults to sh:Error for native constraints. For template constraints it uses the severity of the template by default.

Native constraint
type: Shape class
subclass of: Constraint
subclass of: SPARQLExecutable
comment: A constraint that has a native executable body attached with it.
property: message
  predicate: message
  datatype: text
  comment: Specifies the default sh:message(s) to produce for any constraint violation. May have multiple values for different languages.
property: predicate
  predicate: predicate
  max count: 1
  value class: Property
  comment: Specifies the default sh:predicate to produce for any constraint violation.
property: comment
  predicate: comment
  datatype: text
  comment: A human-readable explanation of this constraint. May have multiple values for different languages.
property: result annotation
  predicate: result annotation
  value class: Result annotation
  comment: Result annotations provide information about additional properties that the constructed constraint violations shall have.

Constraint template
type: Shape class
subclass of: Template
comment: A template that is used for constraint validation.
property: severity
  predicate: severity
  max count: 1
  value class: Result class
  comment: Specifies the default rdf:type to produce for any constraint violation.
property: message
  predicate: message
  datatype: text
  comment: Specifies the default sh:message(s) to produce for any constraint violation. May have multiple values for different languages.
property: predicate
  predicate: predicate
  max count: 1
  value class: Property
  comment: Specifies the default sh:predicate to produce for any constraint violation.
property: result annotation
  predicate: result annotation
  value class: Result annotation
  comment: Result annotations provide information about additional properties that the constructed constraint violations shall have.

Abstract value constraint template
type: Shape class
subclass of: Constraint template
comment: A constraint template that points to a function that validates one given value at a time.
property: validation function
  predicate: validation function
  max count: 1
  min count: 1
  value class: Function
  comment: A boolean function that takes a given value as its first argument. Additional arguments are passed into the function if their predicate matches the template's arguments. If the function returns true then the value is valid.
abstract: true

Property value constraint template
type: Shape class
subclass of: Abstract value constraint template
comment: A value constraint template that validates all objects of triples that have the given focus node as subject and the given predicate.

Inverse property value constraint template
type: Shape class
subclass of: Abstract value constraint template
comment: A value constraint template that validates all subjects of triples that have the given focus node as object and the given predicate.

Template constraint
type: Constraint template
subclass of: Constraint
comment: A constraint that is instantiating a template.
abstract: true

Abstract property constraint
type: Constraint template
subclass of: Template constraint
comment: Shared superclass for templates that take a predicate as one of their arguments.
abstract: true
argument: predicate
  predicate: predicate
  value class: Property
  comment: The Property being constrained.
property: label
  predicate: label
  datatype: text
  comment: A display label for input forms etc. By default, the global rdfs:label of the predicate should be used. Multiple values (for different languages) are supported.
property: comment
  predicate: comment
  datatype: text
  comment: A description of the role of the predicate to users. Multiple values (for different languages) are supported.

Abstract argument datatype constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that the value of an argument must be a literal of a certain datatype. sh:text is recommended if the values shall be either strings or string with language tags.
abstract: true
argument: datatype
  predicate: datatype
  optional when inherited: true
  node kind: IRI
  value class: Datatype
  comment: The datatype that all values of the property must have.
message: Values must have datatype {?datatype}
validation function: has datatype

Abstract argument max count constraint
type: Constraint template
subclass of: Abstract property constraint
abstract: true
message: Arguments cannot have more than one value.
SPARQL: SELECT ?this (?this AS ?subject) ?predicate WHERE { FILTER EXISTS { ?this ?predicate ?value1 . ?this ?predicate ?value2 . FILTER (?value1 != ?value2) . } }

Abstract argument value class constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that the value of an argument must be of a certain type. This will accept instances of subclasses.
abstract: true
argument: value class
  predicate: value class
  optional when inherited: true
  node kind: IRI
  value class: Class
  comment: The type that all values of the property must have, based on the semantics defined by the function sh:hasValueClass.
message: Values must be instances of {?valueClass}
validation function: has value class

Abstract optional argument constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that a non-optional argument must have a value, similar to minCount = 1, unless it has been declared optional, or a sh:defaultValue exists.
abstract: true
argument: default value
  predicate: default value
  optional: true
  comment: The default value of this argument, to be used if no other value has been specified.
argument: optional
  predicate: optional
  default value: false
  datatype: boolean
  comment: True to indicate that the property does not require a value. By default, the value is required.
argument: optional when inherited
  predicate: optional when inherited
  default value: false
  datatype: boolean
  comment: True to indicate that the property does not require a value when used by a subclass template. If set to true, then instances of subclasses do not need to fill in all required arguments - incomplete templates will simply not be executed. By default, the value is required.
message: Missing value for required argument
SPARQL: SELECT ?this (?this AS ?subject) ?predicate WHERE { FILTER (!bound(?defaultValue) && !?optional && !?optionalWhenInherited && NOT EXISTS { ?this ?predicate ?any }) . }

Argument
type: Constraint template
subclass of: Abstract optional argument constraint
subclass of: Abstract argument datatype constraint
subclass of: Abstract argument max count constraint
subclass of: Abstract argument value class constraint
comment: Declares an argument that gets mapped to a variable in the parameterized SPARQL query.
label template: Argument {?predicate} : {?datatype}{?valueClass}
property: index
  predicate: index
  comment: The index of this argument, especially to determine the order of arguments in a function call. Values should be 0, 1, 2 etc. The default index for sh:arg1 is 0 etc.
  datatype: integer
  min inclusive: 0
  max count: 1
constraint:
  message: Arguments cannot have both ?datatype and ?valueClass.
  predicate: datatype
  SPARQL: SELECT * WHERE { FILTER EXISTS { ?this sh:datatype ?value1 . ?this sh:valueClass ?value2 . } }

Abstract allowed values property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies the allowed values for a property by pointing to a List of nodes.
abstract: true
argument: allowed values
  predicate: allowed values
  optional when inherited: true
  value class: List
  comment: The rdf:List containing the allowed values of the property.
message: Value is not one of the allowed values
validation function: isAllowedValue

Abstract count property constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint on the cardinality of the property using minCount and maxCount. By default, a property may have 0 to unlimited number of values.
abstract: true
argument: min count
  predicate: min count
  default value: 0
  optional: true
  datatype: integer
  comment: The minimum number of values that the property must have. Defaults to 0.
argument: max count
  predicate: max count
  optional: true
  datatype: integer
  comment: The maximum number of values that the property must have. Defaults to unlimited.
message: Required value count [{?minCount}..{?maxCount}] but found {?count}
SPARQL: SELECT ?this (?this AS ?subject) ?predicate ?count WHERE { BIND (sh:valueCount(?this, ?predicate) AS ?count) . FILTER ((?count < ?minCount) || (bound(?maxCount) && (?count > ?maxCount))) . }

Abstract datatype property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that all values of the property must be literals of a certain datatype. This will accept strings with language tags instead of xsd:string.
abstract: true
argument: datatype
  predicate: datatype
  optional when inherited: true
  node kind: IRI
  value class: Datatype
  comment: The datatype that all values of the property must have. sh:text is recommended if the values shall be either strings or string with language tags.
message: Values must have datatype {?datatype}
validation function: has datatype

Abstract direct value type property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that all values of the property must be of a certain (direct) type. In contrast to sh:valueClass this does not include instances of subclasses.
abstract: true
argument: direct value type
  predicate: direct value type
  optional when inherited: true
  node kind: IRI
  value class: Class
  comment: The type that all values of the property must have, excluding subclasses.
message: Values must be direct instances of {?directValueType}
validation function: has direct value type

Abstract has value property constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Specifies that the given property must have the specified value (it may also have others).
abstract: true
argument: has value
  predicate: has value
  optional when inherited: true
  comment: The required value of the property.
message: Missing expected value {?hasValue}
SPARQL: SELECT ?this (?this AS ?subject) ?predicate ?hasValue WHERE { FILTER NOT EXISTS { ?this ?predicate ?hasValue } }

Abstract node kind property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies the valid node kind of a property.
abstract: true
argument: node kind
  predicate: node kind
  optional when inherited: true
  value class: Node kind
  comment: The node kind that all values of the property must be of.
message: Values must be of kind {?nodeKind}
validation function: has node kind

Abstract qualified value shape property constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that a certain number of values of the property must have a certain shape.
abstract: true
argument: qualified value shape
  predicate: qualified value shape
  optional when inherited: true
  value class: Shape
  comment: The shape that the values must have.
argument: qualified min count
  predicate: qualified min count
  optional when inherited: true
  datatype: integer
  default value: 0
  comment: The minimum number of values that must have the shape.
argument: qualified max count
  predicate: qualified max count
  optional when inherited: true
  datatype: integer
  comment: The maximum number of values that must have the shape.
message: Violation of qualified value shape constraint {?qualifiedValueShape}: expected [{?qualifiedMinCount}..{?qualifiedMaxCount}], found {?count}
SPARQL: SELECT ?this (?this AS ?subject) ?predicate ?qualifiedValueShape ?qualifiedMinCount ?qualifiedMaxCount ?count ?error WHERE { BIND (sh:valuesWithShapeCount(?this, ?predicate, ?qualifiedValueShape, ?shapesGraph) AS ?count) . BIND (!bound(?count) AS ?error) . FILTER IF(?error, true, ((?count < ?qualifiedMinCount) || (bound(?qualifiedMaxCount) && (?count > ?qualifiedMaxCount)))) . }

Abstract value class property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that all values of the property must be of a certain type. For resources this will accept instances of subclasses. Untyped blank nodes are allowed if a defaultValueType has been specified.
abstract: true
argument: value class
  predicate: value class
  optional when inherited: true
  node kind: IRI
  value class: Class
  comment: The type that all values of the property must have, based on the semantics defined by the function sh:hasValueClass.
message: Values must be instances of {?valueClass}
validation function: has value class

Abstract value shape property constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that all values of the property must have a certain shape.
abstract: true
argument: value shape
  predicate: value shape
  optional when inherited: true
  value class: Shape
  comment: The shape that the values must have.
message: Value does not fulfill the constraints of shape {?valueShape}
SPARQL: SELECT ?this (?this AS ?subject) ?predicate ?object ?valueShape ?error WHERE { ?this ?predicate ?object . BIND (sh:hasShape(?object, ?valueShape, ?shapesGraph) AS ?hasShape) . BIND (!bound(?hasShape) AS ?error) . FILTER (?error || !?hasShape) . }

Abstract length property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies the minimum and maximum string length of values.
abstract: true
argument: min length
  predicate: min length
  optional: true
  optional when inherited: true
  datatype: integer
  comment: The minimum string length permitted for values of this property.
argument: max length
  predicate: max length
  optional: true
  optional when inherited: true
  datatype: integer
  comment: The maximum string length permitted for values of this property.
message: Invalid string length.
validation function: has length

Abstract max exclusive property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies an (exclusive) maximum value for literal values.
abstract: true
argument: max exclusive
  predicate: max exclusive
  optional when inherited: true
  node kind: Literal
  comment: The exclusive maximum value permitted for this property: ?value < ?maxExclusive
message: Values must be less than {?maxExclusive}
validation function: has max exclusive

Abstract max inclusive property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies an (inclusive) maximum value for literal values.
abstract: true
argument: max inclusive
  predicate: max inclusive
  optional when inherited: true
  node kind: Literal
  comment: The inclusive maximum value permitted for this property: ?value <= ?maxInclusive
message: Values must be less than or equal to {?maxInclusive}
validation function: has max inclusive

Abstract min exclusive property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies an (exclusive) minimum value for literal values.
abstract: true
argument: min exclusive
  predicate: min exclusive
  optional when inherited: true
  node kind: Literal
  comment: The exclusive minimum value permitted for this property: ?value > ?minExclusive
message: Values must be greater than {?minExclusive}
validation function: has min exclusive

Abstract min inclusive property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies an (inclusive) minimum value for literal values.
abstract: true
argument: min inclusive
  predicate: min inclusive
  optional when inherited: true
  node kind: Literal
  comment: The inclusive minimum value permitted for this property: ?value >= ?minInclusive
message: Values must be greater than or equal to {?minInclusive}
validation function: has min inclusive

Abstract pattern property constraint
type: Property value constraint template
subclass of: Abstract property constraint
comment: Specifies a regular expression that all values of the property need to match.
abstract: true
argument: pattern
  predicate: pattern
  optional when inherited: true
  datatype: string
  comment: The (regular expression) pattern for values of this property.
message: Values must match the pattern {?pattern}
validation function: has pattern

Property constraint
type: Constraint template
subclass of: Abstract allowed values property constraint
subclass of: Abstract count property constraint
subclass of: Abstract datatype property constraint
subclass of: Abstract direct value type property constraint
subclass of: Abstract has value property constraint
subclass of: Abstract length property constraint
subclass of: Abstract max exclusive property constraint
subclass of: Abstract max inclusive property constraint
subclass of: Abstract min exclusive property constraint
subclass of: Abstract min inclusive property constraint
subclass of: Abstract node kind property constraint
subclass of: Abstract pattern property constraint
subclass of: Abstract qualified value shape property constraint
subclass of: Abstract value class property constraint
subclass of: Abstract value shape property constraint
comment: Declares the structural constraints for a property at the associated class. The supported arguments are inherited from the superclasses.
label template: Property {?predicate} : {?datatype}{?valueClass} [{?minCount}..{?maxCount}]
property: default value
  predicate: default value
  max count: 1
  comment: A default value that could be used to pre-populate input forms etc. This has no formal meaning otherwise.
constraint:
  message: Property constraints cannot have both datatype and valueClass or directValueType.
  predicate: datatype
  SPARQL: SELECT ?this WHERE { FILTER EXISTS { ?this sh:datatype ?datatype . ?this sh:valueClass|sh:directValueType ?any . } }

Abstract allowed values inverse property constraint
type: Inverse property value constraint template
subclass of: Abstract property constraint
comment: Specifies the allowed values for an inverse property by pointing to a List of nodes.
abstract: true
argument: allowed values
  predicate: allowed values
  optional when inherited: true
  value class: List
  comment: The rdf:List containing the allowed values of the inverse property.
message: Value is not one of the allowed values
validation function: isAllowedValue

Abstract count inverse property constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint on the cardinality of an incoming property using minCount and maxCount. By default, an inverse property may have 0 to unlimited number of values.
abstract: true
argument: min count
  predicate: min count
  default value: 0
  optional: true
  datatype: integer
  comment: The minimum number of values that the inverse property must have. Defaults to 0.
argument: max count
  predicate: max count
  optional: true
  datatype: integer
  comment: The maximum number of values that the inverse property must have. Defaults to unlimited.
message: Inverse property must have [{?minCount}..{?maxCount}] values, but found {?count}
SPARQL: SELECT ?this (?this AS ?object) ?predicate ?minCount ?maxCount ?count WHERE { BIND (sh:inverseValueCount(?this, ?predicate) AS ?count) . FILTER ((?count < ?minCount) || (bound(?maxCount) && (?count > ?maxCount))) . }

Abstract value class inverse property constraint
type: Inverse property value constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that all incoming values of the property must be of a certain type. This will accept instances of subclasses..
abstract: true
argument: value class
  predicate: value class
  optional when inherited: true
  value class: Class
  comment: The type that all values of the inverse property must have, based on the semantics defined by the function sh:hasValueClass.
constraint:
  message: The values of sh:valueClass cannot be blank nodes.
  predicate: value class
  SPARQL: SELECT ?this (?this AS ?subject) (?valueClass AS ?object) WHERE { ?this sh:valueClass ?valueClass . FILTER isBlank(?valueClass) . }
message: Inverse values must be instances of {?valueClass}
validation function: has value class

Abstract value shape inverse property constraint
type: Constraint template
subclass of: Abstract property constraint
comment: Enforces a constraint that all inverse values of the property must have a certain shape.
abstract: true
argument: value shape
  predicate: value shape
  optional when inherited: true
  value class: Shape
  comment: The shape that the inverse values must have.
message: Inverse value does not fulfill the constraints of shape {?valueShape}
SPARQL: SELECT ?this (?this AS ?object) ?predicate ?subject ?valueShape ?error WHERE { ?subject ?predicate ?this . BIND (sh:hasShape(?subject, ?valueShape, ?shapesGraph) AS ?hasShape) . BIND (!bound(?hasShape) AS ?error) . FILTER (?error || !?hasShape) . }

Inverse property constraint
type: Constraint template
subclass of: Abstract allowed values inverse property constraint
subclass of: Abstract count inverse property constraint
subclass of: Abstract value class inverse property constraint
subclass of: Abstract value shape inverse property constraint
comment: Declares the structural constraints for an incoming property at the associated class. The supported arguments are inherited from the superclasses.
label template: Inverse property {?predicate} : {?valueClass} [{?minCount}..{?maxCount}]

Closed shape constraint
type: Constraint template
subclass of: Template constraint
comment: Triggers an error for each triple of the focus node that has a predicate that is not explicitly enumerated using sh:property in the surrounding shape.
label template: Closed shape
message: Invalid triple for closed shape
argument: ignored properties
  predicate: ignored properties
  value class: List
  optional: true
  comment: A List of predicates that are permitted regardless of whether they have been declared as sh:property. Could be used to allow sh:nodeShape or rdf:type.
SPARQL: SELECT ?this (?this AS ?subject) ?predicate ?object WHERE { ?this ?predicate ?object . FILTER (NOT EXISTS { GRAPH ?shapesGraph { ?currentShape sh:property/sh:predicate ?predicate . } } && (!bound(?ignoredProperties) || NOT EXISTS { GRAPH ?shapesGraph { ?ignoredProperties rdf:rest*/rdf:first ?predicate . } })) }

Closed shape
type: Closed shape constraint
comment: A singleton instance of sh:ClosedShapeConstraint that can be shared between multiple shape definitions.

Not constraint
type: Constraint template
subclass of: Template constraint
comment: Enforces a constraint that the focus node must not have a given shape, essentially negating the conditions represented by the shape.
argument: shape
  predicate: shape
  value class: Shape
  comment: The shape to negate.
label template: Not constraint: {?shapes}
message: Violation of NOT constraint
SPARQL: SELECT ?this ?error WHERE { BIND (sh:hasShape(?this, ?shape, ?shapesGraph, true) AS ?hasShape) . BIND (!bound(?hasShape) AS ?error) . FILTER (?error || ?hasShape) . }

And constraint
type: Constraint template
subclass of: Template constraint
comment: Enforces a constraint that all of the provided shapes must be valid for the focus resource.
argument: shapes
  predicate: shapes
  value class: List
  comment: A list of shapes that will be validated.
label template: And constraint: {?shapes}
message: Violation of AND constraint
SPARQL: SELECT ?this ?error WHERE { BIND (sh:walkShapesList(?shapes, false, ?this, ?shapesGraph) AS ?result) . BIND (!bound(?result) AS ?error) . FILTER COALESCE(?result, true) . }

Or constraint
type: Constraint template
subclass of: Template constraint
comment: Enforces a constraint that at least one of several provided shapes must be valid for the focus resource.
argument: shapes
  predicate: shapes
  value class: List
  comment: A list of shapes that will be validated.
label template: Or constraint: {?shapes}
message: Violation of OR constraint
SPARQL: SELECT ?this ?error WHERE { BIND (sh:walkShapesList(?shapes, true, ?this, ?shapesGraph) AS ?result) . BIND (!bound(?result) AS ?error) . FILTER COALESCE(!?result, true) . }

Xor constraint
type: Constraint template
subclass of: Template constraint
comment: Enforces a constraint that exactly one of multiple provided shapes must be valid for the focus resource.
argument: shapes
  predicate: shapes
  value class: List
  comment: A list of shapes that will be validated.
label template: Xor constraint: {?shapes}
message: Violation of XOR constraint
SPARQL: SELECT ?this ?error WHERE { BIND (sh:validShapeCount(?this, ?shapes, ?shapesGraph) AS ?count) BIND (!bound(?count) AS ?error) . FILTER IF(?error, true, ?count != 1) . }

has datatype
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) is a literal with a given datatype (?datatype). If the datatype is sh:text, then the function will either accept xsd:string or rdf:langString.
argument:
  predicate: datatype
  value class: Datatype
  comment: The datatype that the node must have.
return type: boolean
SPARQL: ASK { { FILTER isLiteral(?value) . } . BIND (datatype(?value) AS ?realDatatype) . FILTER ((?realDatatype = ?datatype) || (?datatype = sh:text && ?realDatatype IN (rdf:langString, xsd:string))) . }

has direct value type
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) has a given class (?directValueType) as its rdf:type.
argument: direct value type
  predicate: direct value type
  optional when inherited: true
  node kind: IRI
  value class: Class
  comment: The type that all value must have, excluding subclasses.
return type: boolean
SPARQL: ASK { ?value a ?directValueType . }

has length
type: Function
subclass of: Validation functions
comment: Checks whether a given string (?value) has a length within a given minimum and maximum string length.
argument: min length
  predicate: min length
  index: 1
  optional: true
  datatype: integer
  comment: The minimum string length (defaults to 0 if unspecified).
argument: max length
  predicate: max length
  index: 2
  optional: true
  datatype: integer
  comment: The maximum string length (defaults to unlimited).
return type: boolean
SPARQL: ASK { BIND (STRLEN(str(?value)) AS ?valueLength) . FILTER (bound(?valueLength) && (?valueLength >= COALESCE(?minLength, 0)) && (!bound(?maxLength) || ?valueLength <= ?maxLength)) . }

has max exclusive
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) has value less than (<) the provided ?maxExclusive. Returns false if this cannot be determined, e.g. because values do not have comparable types.
argument: max exclusive
  predicate: max exclusive
  node kind: Literal
  comment: The permitted exclusive maximum value
return type: boolean
SPARQL: ASK { FILTER (?value < ?maxExclusive) }

has max inclusive
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) has value less than or equal to (<=) the provided ?maxInclusive. Returns false if this cannot be determined, e.g. because values do not have comparable types.
argument: max inclusive
  predicate: max inclusive
  node kind: Literal
  comment: The permitted inclusive maximum value
return type: boolean
SPARQL: ASK { FILTER (?value <= ?maxInclusive) }

has min exclusive
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) has value greater than (>) the provided ?minExclusive. Returns false if this cannot be determined, e.g. because values do not have comparable types.
argument: min exclusive
  predicate: min exclusive
  node kind: Literal
  comment: The permitted exclusive minimum value
return type: boolean
SPARQL: ASK { FILTER (?value > ?minExclusive) }

has min inclusive
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) has value greater than or equal to (>=) the provided ?minInclusive. Returns false if this cannot be determined, e.g. because values do not have comparable types.
argument: min inclusive
  predicate: min inclusive
  node kind: Literal
  comment: The permitted inclusive minimum value
return type: boolean
SPARQL: ASK { FILTER (?value >= ?minInclusive) }

has node kind
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) has a given sh:NodeKind (?nodeKind). For example, sh:hasNodeKind(42, sh:Literal) = true.
argument:
  index: 1
  predicate: node kind
  value class: Node kind
  comment: The node kind that the node must have.
return type: boolean
SPARQL: ASK { FILTER ((isIRI(?value) && ?nodeKind = sh:IRI) || (isLiteral(?value) && ?nodeKind = sh:Literal) || (isBlank(?value) && ?nodeKind = sh:BlankNode)) . }

has pattern
type: Function
subclass of: Validation functions
comment: Checks whether the string representation of a given node (?value) matches a given regular expression (?pattern). Returns false if the value is a blank node.
argument:
  index: 1
  predicate: pattern
  datatype: string
  comment: The regular expression to match.
return type: boolean
SPARQL: ASK { FILTER (!isBlank(?value) && regex(str(?value), ?pattern)) }

has shape
type: Function
comment: Validates whether a given resource (?arg1) fulfills all error-level constraints defined for a given shape (?arg2). This creates a (possibly recursive) constraint validator equivalent to the validateNodeAgainstShape operation. The function returns an error, i.e. no result, if the validation could not be completed, e.g. due to an unsupported recursion or an unsupported extension language. Therefore the function should not be called inside of FILTER statements directly, but rather with BIND.
argument:
  predicate: arg1
  value class: Resource
  comment: The resource to validate.
argument:
  predicate: arg2
  value class: Shape
  comment: The shape containing the constraints that need to be validated.
argument:
  predicate: arg3
  value class: Graph
  comment: The graph containing the shape definitions.
argument:
  predicate: arg4
  datatype: boolean
  optional: true
  comment: If set to true then any recursive occurrence of the same resource against the same shape will fail (result=undefined).
return type: boolean

has value class
type: Function
subclass of: Validation functions
comment: Checks whether a given node (?value) is an instance of a given class (?valueClass) or its subclasses. If ?valueClass is rdf:Property then the function returns true if ?value is an untyped IRI.
argument:
  index: 1
  predicate: value class
  value class: Class
  comment: The type that the node must have.
return type: boolean
SPARQL: ASK { { { FILTER (isIRI(?value) || isBlank(?value)) . } . ?class (rdfs:subClassOf)* ?valueClass . ?value a ?class . } UNION { # Allow untyped resources for rdfs:Resource and rdf:Property FILTER ((isIRI(?value) || isBlank(?value)) && (?valueClass = rdfs:Resource || ?valueClass = rdf:Property) && NOT EXISTS { ?value a ?any }) . } UNION { # Allow untyped blank nodes with rdf:first if expected type is rdf:List FILTER (?valueClass = rdf:List && isBlank(?value) && EXISTS { ?value rdf:first ?any }) . } }

inverse value count
type: Function
comment: Gets the number of values of a given property (?arg2) at a given object (?arg1). The result is the number of matches of (?subject, ?arg2, ?arg1).
argument:
  predicate: arg1
  value class: Resource
  comment: The object resource.
argument:
  predicate: arg2
  value class: Property
  comment: The property to get the value count of.
return type: integer
SPARQL: SELECT ((COUNT(?subject)) AS ?result) WHERE { ?subject ?arg2 ?arg1 . }

isAllowedValue
type: Function
subclass of: Validation functions
argument: allowed values
  index: 1
  predicate: allowed values
  value class: List
  comment: The rdf:List containing the allowed values.
argument: shapes graph
  index: 2
  predicate: shapes graph
  value class: Graph
  comment: The graph containing the rdf:List.
return type: boolean
SPARQL: ASK { FILTER EXISTS { GRAPH ?shapesGraph { ?allowedValues (rdf:rest*)/rdf:first ?value . } } }

property value
type: Function
comment: Gets the 'first' value of a given property (?arg2) at a given subject (?arg1). The behavior is arbitrary if multiple values are present.
argument:
  predicate: arg1
  value class: Resource
  comment: The subject resource.
argument:
  predicate: arg2
  value class: Property
  comment: The property to get the value of.
SPARQL: SELECT ?object WHERE { ?arg1 ?arg2 ?object . }

valid shape count
type: Function
comment: Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where a given focus node (?arg1) returns no error-level constraint violations. The function produces an error if one of the shapes validated to a fatal error.
argument:
  predicate: arg1
  value class: Resource
  comment: The focus node.
argument:
  predicate: arg2
  value class: List
  comment: The list of shapes to walk through.
argument:
  predicate: arg3
  value class: Resource
  comment: The shapes graph.
return type: integer
SPARQL: # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from sh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH ?arg3 { ?arg2 rdf:rest*/rdf:first ?shape . } BIND (sh:hasShape(?arg1, ?shape, ?arg3, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape, 1, 0), 'error') AS ?s) . }

value count
type: Function
comment: Gets the number of values of a given property (?arg2) at a given subject (?arg1). The result is the number of matches of (?arg1, ?arg2, ?object).
argument:
  predicate: arg1
  value class: Resource
  comment: The subject resource.
argument:
  predicate: arg2
  value class: Property
  comment: The property to get the value count of.
return type: integer
SPARQL: SELECT ((COUNT(?object)) AS ?result) WHERE { ?arg1 ?arg2 ?object . }

values with shape count
type: Function
comment: Counts the number of values from a given subject (?arg1) / predicate (?arg2) combination that do not produce any error-level constraint violations for a given shape (?arg3) in a given shapes graph (?arg4). The function produces an error if one of the shapes validated to a fatal error.
argument:
  predicate: arg1
  value class: Resource
  comment: The subject to count the values of.
argument:
  predicate: arg2
  value class: Property
  comment: The property to count the values of.
argument:
  predicate: arg3
  value class: Shape
  comment: The shape to validate.
argument:
  predicate: arg4
  value class: Resource
  comment: The shapes graph.
return type: integer
SPARQL: # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from sh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { ?arg1 ?arg2 ?value . BIND (sh:hasShape(?value, ?arg3, ?arg4, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape, 1, 0), 'error') AS ?s) . }

walk shapes list
type: Function
comment: Walks a given rdf:List of shapes (?arg1) recursively until it encounters a shape where sh:hasShape returns a provide boolean value (?arg2) for a given focus node (?arg3) using the given shapes graph (?arg4). Returns true if the list has reached such a node, false if it has reached the end of the list. Returns an error if one of the calls to sh:hasShape has produced a fatal error.
argument:
  predicate: arg1
  value class: List
  comment: The current rdf:List node in the recursion.
argument:
  predicate: arg2
  datatype: boolean
  comment: The value to match sh:hasShape against.
argument:
  predicate: arg3
  value class: Resource
  comment: The focus node to validate.
argument:
  predicate: arg4
  value class: Resource
  comment: The shapes graph.
return type: boolean
SPARQL: SELECT ?result WHERE { GRAPH ?arg4 { OPTIONAL { ?arg1 rdf:first ?shape . ?arg1 rdf:rest ?rest . } } BIND (IF(bound(?shape), sh:hasShape(?arg3, ?shape, ?arg4, true), !?arg2) AS ?hasShape) . BIND (IF(?hasShape = ?arg2, true, IF(bound(?rest), sh:walkShapesList(?rest, ?arg2, ?arg3, ?arg4), false)) AS ?result) . }

argument
default value type: Argument
type: Property

constraint
default value type: Native constraint
type: Property

filter shape
default value type: Shape
type: Property

inverse property
default value type: Inverse property constraint
type: Property

property
default value type: Property constraint
type: Property

qualified value shape
default value type: Shape
type: Property

scope
default value type: Native scope
type: Property

shape
default value type: Shape
type: Property

value shape
default value type: Shape
type: Property

default value type inference rule
type: Template
comment: A template encapsulating a query that can be used to construct rdf:type triples for certain untyped blank nodes that are an object in a triple where the predicate has a sh:defaultValueType. This can be used as a pre-processor for shape graphs before they are validated.
SPARQL: CONSTRUCT { ?node a ?defaultValueType . } WHERE { ?predicate sh:defaultValueType ?defaultValueType . ?anySubject ?predicate ?node . FILTER (NOT EXISTS { ?node a ?anyType }) . }

node shape
type: Property
comment: Links a resource with the shapes that it is supposed to have. All values of this property must be IRI nodes.
range: Shape

type
type: Property

comment
type: Property

label
type: Property

subClassOf
type: Property

abstract
type: Property

allowed values
type: Property

annotation property
type: Property

annotation var name
type: Property

annotation value
type: Property

arg1
type: Property

arg2
type: Property

arg3
type: Property

arg4
type: Property

arg5
type: Property

arg6
type: Property

arg7
type: Property

arg8
type: Property

arg9
type: Property

cachable
type: Property

constraint template
type: Property

datatype
type: Property

default value
type: Property

default value type
type: Property

direct value type
type: Property

detail
type: Property

entailment
type: Property

extends
type: Property

focus node
type: Property

has value
type: Property

ignored properties
type: Property

include
type: Property

index
type: Property

label template
type: Property

max count
type: Property

max exclusive
type: Property

max length
type: Property

max inclusive
type: Property

member
type: Property

message
type: Property

min count
type: Property

min length
type: Property

min exclusive
type: Property

min inclusive
type: Property

node kind
type: Property

object
type: Property

optional
type: Property

optional when inherited
type: Property

pattern
type: Property

predicate
type: Property

private
type: Property

qualified max count
type: Property

qualified min count
type: Property

result annotation
type: Property

return type
type: Property

scope class
type: Property

scope template
type: Property

severity
type: Property

shapes
type: Property

shapes graph
type: Property

source constraint
type: Property

source shape
type: Property

SPARQL
type: Property

subject
type: Property

value class
type: Property

value
type: Property

validation function
type: Property