Warning:
This wiki has been archived and is now read-only.
Refactor metamodel
From RDF Data Shapes Working Group
# SHACL metamodel @prefix xs: <http://www.w3.org/2001/XMLSchema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix shmm: <http://www.w3.org/ns/shaclmm#> . ## CORE LANGUAGE plus SPARQL bodies sh:Shape a rdfs:Class . # RDFS domains and ranges for the properties sh:scopeClass a rdf:Property; rdfs:domain sh:Shape; rdfs:range rdfs:Class . sh:scopeNode a rdf:Property; rdfs:domain sh:Shape . sh:scopePropertyObject a rdf:Property; rdfs:domain sh:Shape; rdfs:range rdf:Property. sh:scopePropertySubject a rdf:Property; rdfs:domain sh:Shape; rdfs:range rdf:Property. sh:scopeAllObjects a rdf:Property; rdfs:domain sh:Shape; rdfs:range xs:boolean . sh:scopeAllSubjects a rdf:Property; rdfs:domain sh:Shape; rdfs:range xs:boolean . sh:scopeSPARQL a rdf:Property; rdfs:domain sh:Shape; rdfs:range xs:string . sh:filter a rdf:Property; rdfs:domain sh:Shape; rdfs:range sh:Shape . sh:hasValue a rdf:Property ; rdfs:domain sh:Shape . sh:in a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:class a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Class . sh:classIn a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:datatype a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Datatype . sh:datatypeIn a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:directType a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Class . sh:minLength a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:integer . sh:maxLength a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:integer . sh:minExclusive a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal . sh:minInclusive a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal . sh:maxExclusive a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal . sh:maxInclusive a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Literal . sh:nodeKind a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdfs:Resource . sh:pattern a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:equals a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:notEquals a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:lessThan a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:lessThanOrEquals a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:fillers a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:list a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range sh:Shape . sh:shape a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range sh:Shape . sh:and a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:or a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:not a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range sh:Shape . sh:minCount a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:integer . sh:maxCount a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:integer . sh:uniqueLang a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:boolean . sh:partition a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:closed a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range rdf:List . sh:sparql a rdf:Property ; rdfs:range xs:sring . sh:severity a rdf:Property . sh:inverse a rdf:Property ; rdfs:range rdf:Property . # Shapes that reiterate RDFS ranges (if this is felt desirable ) # Don't do this for ranges that are classes, datatypes, or properties # or lists of same. Instead only require being IRIs shmm:scopeAllObjectsRange a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:sscopeAllObjects [ sh:datatype xs:boolean ] ) . # and so on for many of the SHACL constructs # Shapes different from the RDFS range shmm:scopeClassIRI a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:scopeClass [ sh:nodeKind sh:IRI ] ) . shmm:scopePropertyObjectIRI a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:scopePropertyObject [ sh:nodeKind sh:IRI ] ) . shmm:scopePropertySubjectIRI a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:scopePropertySubject [ sh:nodeKind sh:IRI ] ) . shmm:scopeAllObjectsUnique a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:scopeAllObjects [ sh:maxCount 1 ] ) . sh:scopeAllSubjectsUnique a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:scopeAllSubjects [ sh:maxCount 1 ] ) . shmm:classInSyntax a sh:Shape ; sh:scopeClass sh:Shape ; # NO, not required sh:fillers ( sh:classIn [ sh:list [ sh:class rdfs:Class ] ] ) ; sh:fillers ( sh:classIn [ sh:list [ sh:nodeKind sh:IRI ] ] ) . shmm:datatypeInSyntax a sh:Shape ; sh:scopeClass sh:Shape ; # NO, not required sh:fillers ( sh:datatypeIn [ sh:list rdfs:Datatype ] ) . sh:fillers ( sh:datatypeIn [ sh:list [ sh:nodeKind sh:IRI ] ] ) . shmm:minLengthSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:minLength [ sh:minInclusive 0 ] ) . shmm:maxLengthSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:minLength [ sh:minInclusive 0 ] ) . shmm:nodeKindSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:nodeKind [ sh:in ( sh:BlankNode sh:IRI sh:Literal ) ] ) . shmm:patternSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:pattern [ sh:or ( [ sh:datatype xs:string ] # no flags, just a pattern [ sh:list [ sh:datatype xs:string ] ; # pattern and flags are both strings sh:fillers ( ( rdf:rest rdf:rest ) [ sh:in ( rdf:nil ) ] ) ] ) ] ) . shmm:equalsSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:equals [ sh:list shmm:pathShape ] ) . shmm:notEqualsSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:notEquals [ sh:list shmm:pathShape ] ) . shmm:lessThanSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:lessThan [ sh:list shmm:pathShape ] ) . shmm:lessThanOrEqualsSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:lessThanOrEquals [ sh:list shmm:pathShape ] ) . shmm:fillersSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:fillers [ sh:list [ sh:and ( ) ] ; # no common shape for the list elements sh:fillers ( rdf:first shmm:pathShape ) ; sh:fillers ( ( rdf:rest rdf:first ) [ sh:class sh:Shape ] ) ; sh:fillers ( ( rdf:rest rdf:rest ) [ sh:in ( rdf:nil ) ] ) ] ) . shmm:andSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:and [ sh:list [ sh:class sh:Shape ] ] ) . shmm:orSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:or [ sh:list [ sh:class sh:Shape ] ] ) . shmm:minCountSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:minCount [ sh:minInclusive 0 ] ) . shmm:maxCountSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:maxCount [ sh:minInclusive 0 ] ) . shmm:uniqueLangUnique a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:uniqueLang [ sh:maxCount 1 ] ) . shmm:partitionSyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:partition [ sh:list [ sh:class sh:Shape ] ] ) . shmm:closedIRI a sh:Shape ; sh:scopeClass sh:Shape ; # NO, not required sh:fillers ( sh:closed [ sh:list [ sh:class rdf:Property ] ] ) ; sh:fillers ( sh:classIn [ sh:list [ sh:nodeKind sh:IRI ] ] ) . sh:severitySyntax a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:severity [ sh:in ( sh:Info sh:Warning sh:Violation ) ] ) . # Shapes for paths; note that the empty path is allowed # Has some quirky dependencies (properties can't be list nodes, ... shmm:pathShape a sh:Shape ; sh:or ( shmm:pathPartShape [ sh:not shmm:pathPartShape ; sh:list shmm:pathPartShape ] ) . shmm:pathPartShape a sh:Shape ; sh:or ( [ sh:datatype xs:string ] # SPARQL code - TOO CLUNKY shmm:inverseShape # inverse of a property [ sh:not shmm:inverseShape ; sh:nodeKind sh:IRI ] ) . # property shmm:inverseShape a sh:Shape ; sh:fillers ( sh:inverse [ sh:minCount 1 ; sh:maxCount 1 ; sh:nodeKind sh:IRI ] ) . # Non-validating constructs sh:name a rdf:Property ; rdfs:range rdf:langString . sh:description a rdf:Property ; rdfs:range rdf:langString . sh:message a rdf:Property ; rdfs:range rdf:LangString. sh:order a rdf:Property ; rdfs:domain sh:Shape ; rdfs:range xs:decimal . sh:defaultValue a rdf:Property ; rdfs:domain sh:Shape . sh:orderUnique a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:order [ sh:maxCount 1 ] ) . sh:defaultValueUnique a sh:Shape ; sh:scopeClass sh:Shape ; sh:fillers ( sh:defaultValue [ sh:maxCount 1 ] ) . # Validation results sh:ValidationResult a rdfs:Class . sh:focusNode a rdf:Property ; rdfs:domain sh:ValidationResult . sh:subject a rdf:Property ; rdfs:domain sh:ValidationResult . sh:object a rdf:Property ; rdfs:domain sh:ValidationResult . sh:sourceComponent a rdf:Property ; rdfs:domain sh:ValidationResult . sh:sourceShape a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range sh:Shape . sh:sourceTemplate a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range sh:ComponentTemplate . sh:detail a rdf:Property ; rdfs:domain sh:ValidationResult . sh:message a rdf:Property ; rdfs:domain sh:ValidationResult ; rdfs:range rdf:LangString . sh:ValidationResultSyntax a sh:Shape ; sh:scopeClass sh:ValidationResult ; sh:fillers ( sh:focusNode [ sh:maxCount 1 ] ) ; sh:fillers ( sh:subject [ sh:maxCount 1 ] ) ; sh:fillers ( sh:predicate [ sh:maxCount 1 ] ) ; sh:fillers ( sh:object [ sh:maxCount 1 ] ) ; sh:fillers ( sh:sourceConstraint [ sh:maxCount 1 ] ) ; sh:fillers ( sh:sourceShape [ sh:maxCount 1 ] ) ; sh:fillers ( sh:sourceTemplate [ sh:maxCount 1 ] ) ; sh:fillers ( sh:message [ sh:datatype rdf:LangString ] ) ; sh:fillers ( sh:severity [ sh:in ( sh:Info sh:Warning sh:Violation ) ] ) . ## EXTENSION LANGUAGE - not needed if sticking to core # ComponentTemplates sh:ComponentTemplate a rdfs:Class ; rdfs:subClassOf rdf:Property ; rdfs:subClassOf sh:Shape . sh:labelTemplate a rdf:Property ; rdfs:range rdf:LangString. sh:sparqlTemplate a rdf:Property ; rdfs:range xs:string. shmm:sparqlComponentTemplateUnique a sh:Shape ; sh:scopeClass sh:ComponentTemplate ; sh:fillers ( sh:sparqlTemplate [ sh:minCount 1 ; sh:maxCount 1 ] ) . # The core component properties can be defined by templates if desired # Scope Templates sh:ScopeTemplate a rdfs:Class; rdfs:subClassOf rdf:Property; rdfs:subClassOf sh:Shape. shmm:sparqlScopeTemplateUnique a sh:Shape ; sh:scopeClass sh:ScopeTemplate ; sh:fillers ( sh:sparqlTemplate [ sh:minCount 1 ; sh:maxCount 1 ] ) . # Functions sh:Function a rdfs:Class ; rdfs:subClassOf sh:Shape . sh:returnType a rdf:Property ; rdfs:domain sh:Function ; rdfs:range rdfs:Datatpye . sh:sparqlFunction a rdf:Property ; rdfs:domain sh:Function ; rdfs:range xs:string. shmm:returnTypeUnique a sh:Shape ; sh:scopeClass sh:Function ; sh:fillers ( sh:returnType [ sh:minCount 1 ; sh:maxCount 1 ] ) . shmm:sparqlFunctionUnique a sh:Shape ; sh:scopeClass sh:Function ; sh:fillers ( sh:sparqlFunction [ sh:minCount 1 ; sh:maxCount 1 ] ) .