Previous Up Next
Validating RDF data

Appendix D  SHACL in SHACL

In this Appendix we include the definition of SHACL to validate SHACL Core Shapes graphs. The version we include here has been edited from the original one1 in an attempt to improve readability (we changed the shsh prefix by the empty one and omitted rdfs:seeAlso declarations and some comments). It is described in Section 6.6.

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix : <http://www.w3.org/ns/shacl-shacl#> . : rdfs:label "SHACL for SHACL"@en ; sh:declare [ sh:prefix "" ; sh:namespace "http://www.w3.org/ns/shacl-shacl#" ; ] . :ShapeShape a sh:NodeShape ; sh:targetClass sh:NodeShape ; sh:targetClass sh:PropertyShape ; sh:targetSubjectsOf sh:targetClass, sh:targetNode, sh:targetObjectsOf, sh:targetSubjectsOf, sh:and, sh:class, sh:closed, sh:datatype, sh:disjoint, sh:equals, sh:flags, sh:hasValue, sh:ignoredProperties, sh:in, sh:languageIn, sh:lessThan, sh:lessThanOrEquals, sh:maxCount, sh:maxExclusive, sh:maxInclusive, sh:maxLength, sh:minCount, sh:minExclusive, sh:minInclusive, sh:minLength, sh:node, sh:nodeKind, sh:not, sh:or, sh:pattern, sh:property, sh:qualifiedMaxCount, sh:qualifiedMinCount, sh:qualifiedValueShape, sh:qualifiedValueShapesDisjoint, sh:sparql, sh:uniqueLang, sh:xone ; sh:targetObjectsOf sh:node, sh:not, sh:property, sh:qualifiedValueShape ; sh:xone ( :NodeShapeShape :PropertyShapeShape ) ; sh:property [ sh:path sh:targetNode ; sh:nodeKind sh:IRIOrLiteral ; ] ; sh:property [ sh:path sh:targetClass ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:targetSubjectsOf ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:targetObjectsOf ; sh:nodeKind sh:IRI ; ] ; sh:or ( [ sh:not [ sh:class rdfs:Class ; sh:or ( [ sh:class sh:NodeShape ] [ sh:class sh:PropertyShape ] ) ] ] [ sh:nodeKind sh:IRI ] ); sh:property [ sh:path sh:severity ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:message ; sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ] ; sh:property [ sh:path sh:deactivated ; sh:maxCount 1 ; sh:in ( true false ) ; ] ; sh:property [ sh:path sh:and ; sh:node :ListShape ; ] ; sh:property [ sh:path sh:class ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:closed ; sh:datatype xsd:boolean ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:ignoredProperties ; sh:node :ListShape ; sh:maxCount 1 ; ] ; sh:property [ sh:path ( sh:ignoredProperties [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:datatype ; sh:nodeKind sh:IRI ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:disjoint ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:equals ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:in ; sh:maxCount 1 ; sh:node :ListShape ; ] ; sh:property [ sh:path sh:languageIn ; sh:maxCount 1 ; sh:node :ListShape ; ] ; sh:property [ sh:path ( sh:languageIn [ sh:zeroOrMorePath rdf:rest ] rdf:first) ; sh:datatype xsd:string ; ] ; sh:property [ sh:path sh:lessThan ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:lessThanOrEquals ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path sh:maxCount ; sh:datatype xsd:integer ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:maxExclusive ; sh:maxCount 1 ; sh:nodeKind sh:Literal ; ] ; sh:property [ sh:path sh:maxInclusive ; sh:maxCount 1 ; sh:nodeKind sh:Literal ; ] ; sh:property [ sh:path sh:maxLength ; sh:datatype xsd:integer ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:minCount ; sh:datatype xsd:integer ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:minExclusive ; sh:maxCount 1 ; sh:nodeKind sh:Literal ; ] ; sh:property [ sh:path sh:minInclusive ; sh:maxCount 1 ; sh:nodeKind sh:Literal ; ] ; sh:property [ sh:path sh:minLength ; sh:datatype xsd:integer ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:nodeKind ; sh:in ( sh:BlankNode sh:IRI sh:Literal sh:BlankNodeOrIRI sh:BlankNodeOrLiteral sh:IRIOrLiteral ) ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:or ; sh:node :ListShape ; ] ; sh:property [ sh:path sh:pattern ; sh:datatype xsd:string ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:flags ; sh:datatype xsd:string ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:qualifiedValueShape ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:uniqueLang ; sh:datatype xsd:boolean ; sh:maxCount 1 ; ] ; sh:property [ sh:path sh:xone ; sh:node :ListShape ; ] .


1
See Appendix C in https://www.w3.org/TR/shacl/

Previous Up Next