OWL 2 SHACL semi-closed ruleset


Turns an OWL Ontology into a set of SHACL Shapes. Additionnal Shapes with sh:targetSubjectOf verify the domains of the ontology properties, ensuring each property is asserted on an instance of the correct class. Properties from other ontologies can still be asserted anywhere as the NodeShapes are not closed

Table of Content

owl2sh-semi-closed:ClassShape

Target


Rules


 owl2sh-semi-closed:CreateNodeShapesAndPropertyShapesFromEquivalentClassHasValue

rdfs:label owl:equivalentClass/owl:hasValue to sh:NodeShape with sh:hasValue
rdfs:comment Creates a sh:property shape for each property that is mentioned in an owl:Restriction.
sh:order 1

 owl2sh-semi-closed:CreateNodeShapesAndPropertyShapesFromMatchingDomains

rdfs:label rdfs:domain to sh:property
rdfs:comment Creates a NodeShape and a sh:property shape for each property with matching rdfs:domain.
sh:order 2

 owl2sh-semi-closed:CreateNodeShapesAndPropertyShapesFromRestrictions

rdfs:label owl:onProperty to sh:property
rdfs:comment Creates a NodeShape and a sh:property shape for each property that is mentioned in an owl:Restriction.
sh:order 1

 owl2sh-semi-closed:Preprocessing-CopyEquivalentIntersection

rdfs:label Copy owl:intersectionOfs from owl:equivalentClass
rdfs:comment Copies any intersections within owl:equivalentClass into the host class itself so that subsequent rules convert them further.
sh:order -1

 owl2sh-semi-closed:Preprocessing-FlattenIntersectionOf

rdfs:label Flatten owl:intersectionOf
rdfs:comment Copies the members of an owl:intersectionOf list as superclasses into the host class itself. Subsequent rules then apply.
sh:order 0

 owl2sh-semi-closed:owlAllValuesFrom2shClassOrDatatype

rdfs:label owl:allValuesFrom with IRI to sh:class or sh:datatype
rdfs:comment For each owl:allValuesFrom restriction, create a corresponding sh:class or sh:datatype constraint.
sh:order 4

 owl2sh-semi-closed:owlFunctionalProperty2shMaxCount1

rdfs:label owl:FunctionalProperty to sh:maxCount 1
rdfs:comment For each relevant property that is owl:FunctionalProperty, create sh:maxCount of 1 (unless there is an OWL cardinality restriction).
sh:order 3

 owl2sh-semi-closed:owlHasValue2shHasValue

rdfs:label owl:hasValue to sh:hasValue
rdfs:comment For each owl:hasValue restriction, create a corresponding sh:hasValue constraint.
sh:order 8

 owl2sh-semi-closed:owlMaxCardinality2shMaxCount

rdfs:label owl:maxCardinality to sh:maxCount
rdfs:comment For each owl:maxCardinality restriction, create a corresponding sh:maxCount constraint.
sh:order 6

 owl2sh-semi-closed:owlMaxQualifiedCardinalityOnClass2shMaxCount

rdfs:label owl:maxQualifiedCardinality with owl:onClass to sh:maxCount
rdfs:comment For each owl:maxQualifiedCardinality restriction on an IRI class, create a corresponding sh:maxCount constraint, if the owl:onClass is identical to the rdfs:range of the property.
sh:order 6

 owl2sh-semi-closed:owlMaxQualifiedCardinalityOnClass2shQualifiedMaxCount

rdfs:label owl:maxQualifiedCardinality with owl:onClass to sh:qualifiedMaxCount
rdfs:comment For each owl:maxQualifiedCardinality restriction on an IRI class, create a corresponding (new) sh:qualifiedMaxCount constraint, unless the owl:onClass is identical to the rdfs:range of the property.
sh:order 6

 owl2sh-semi-closed:owlMaxQualifiedCardinalityOnDataRange2shQualifiedMaxCount

rdfs:label owl:maxQualifiedCardinality with owl:onDataRange to sh:qualifiedMaxCount
rdfs:comment For each owl:maxQualifiedCardinality restriction on an IRI datatype, create a corresponding (new) sh:qualifiedMaxCount constraint.
sh:order 6

 owl2sh-semi-closed:owlMinCardinality2shMinCount

rdfs:label owl:minCardinality to sh:minCount
rdfs:comment For each owl:minCardinality restriction, create a corresponding sh:minCount constraint.
sh:order 6

 owl2sh-semi-closed:owlMinQualifiedCardinalityOnClass2shMinCount

rdfs:label owl:minQualifiedCardinality with owl:onClass to sh:minCount
rdfs:comment For each owl:minQualifiedCardinality restriction on an IRI class, create a corresponding sh:minCount constraint, if the owl:onClass is identical to the rdfs:range of the property.
sh:order 6

 owl2sh-semi-closed:owlMinQualifiedCardinalityOnClass2shQualifiedMinCount

rdfs:label owl:minQualifiedCardinality with owl:onClass to sh:qualifiedMinCount
rdfs:comment For each owl:minQualifiedCardinality restriction on an IRI class, create a corresponding (new) sh:qualifiedMinCount constraint, unless the owl:onClass is identical to the rdfs:range of the property.
sh:order 6

 owl2sh-semi-closed:owlMinQualifiedCardinalityOnDataRange2shQualifiedMinCount

rdfs:label owl:minQualifiedCardinality with owl:onDataRange to sh:qualifiedMinCount
rdfs:comment For each owl:minQualifiedCardinality restriction on an IRI datatype, create a corresponding (new) sh:qualifiedMinCount constraint.
sh:order 6

 owl2sh-semi-closed:owlQualifiedCardinalityOnClass2shMinMaxCount

rdfs:label owl:qualifiedCardinality with owl:onClass to sh:max/minCount
rdfs:comment For each owl:qualifiedCardinality restriction on an IRI class, create corresponding sh:max/minCount constraints, if the owl:onClass is identical to the rdfs:range of the property.
sh:order 6

 owl2sh-semi-closed:owlQualifiedCardinalityOnClass2shQualifiedMinMaxCount

rdfs:label owl:qualifiedCardinality with owl:onClass to sh:qualifiedMax/MinCount
rdfs:comment For each owl:qualifiedCardinality restriction on an IRI class, create a corresponding (new) sh:qualifiedMax/MinCount constraint, unless the owl:onClass is identical to the rdfs:range of the property.
sh:order 6

 owl2sh-semi-closed:owlQualifiedCardinalityOnDataRange2shQualifiedMinMaxCount

rdfs:label owl:qualifiedCardinality with owl:onDataRange to sh:qualifiedMax/MinCount
rdfs:comment For each owl:qualifiedCardinality restriction on an IRI datatype, create a corresponding (new) sh:qualifiedMax/MinCount constraint.
sh:order 6

 owl2sh-semi-closed:owlSomeValuesFrom2shMinCount1

rdfs:label owl:someValuesFrom to sh:minCount 1
rdfs:comment For each owl:someValuesFrom restriction, create a corresponding sh:minCount 1 constraint.
sh:order 4

 owl2sh-semi-closed:owlSomeValuesFromAllValuesFrom2dashHasValueWithClass

rdfs:label owl:someValuesFrom with IRI to dash:hasValueWithClass
rdfs:comment For each owl:someValuesFrom restriction combined with an owl:allValuesFrom on an IRI, create a corresponding dash:hasValueWithClass constraint using a path expression. For example: ex:ConstitutionalOwner a owl:Class ; rdfs:subClassOf [ a owl:Restriction ; owl:onProperty ex:isPlayedBy ; owl:someValuesFrom [ a owl:Restriction ; owl:allValuesFrom ex:StockholdersEquity ; owl:onProperty ex:holdsEquityIn ; ] ; ] . becomes ex:ConstitutionalOwner a sh:NodeShape ; sh:property [ sh:path ( ex:isPlayedBy ex:holdsEquityIn ) ; dash:hasValueWithClass ex:StockholdersEquity ; ] .
sh:order 7

 owl2sh-semi-closed:owlSomeValuesFromIRI2dashHasValueWithClass

rdfs:label owl:someValuesFrom with IRI to dash:hasValueWithClass
rdfs:comment For each owl:someValuesFrom restriction with an IRI, create a corresponding dash:hasValueWithClass constraint.
sh:order 4

 owl2sh-semi-closed:owlUnionOfIRIs2rdfsSubClassOf

rdfs:label owl:unionOf IRIs to rdfs:subClassOf
rdfs:comment For each owl:unionOf that only consists of named classes, move these classes into "normal" rdfs:subClassOf triples.
sh:order 4

 owl2sh-semi-closed:rdfsDomain2shNodeShapeWithTargetSubjectOf

rdfs:label rdfs:domain with IRI to sh:NodeShape with sh:class
rdfs:comment For each rdfs:domain that is an IRI, create a NodeShape with a sh:targetSubjectsOf to this domain and a sh:class constraint.
sh:order 5

 owl2sh-semi-closed:rdfsRange2shClassOrDatatype

rdfs:label rdfs:range with IRI to sh:class or sh:datatype
rdfs:comment For each relevant property that has an rdfs:range, create sh:class or sh:datatype constraint unless it already exists (from a restriction).
sh:order 5

 owl2sh-semi-closed:rdfsRange2shNode

rdfs:label rdfs:range with IRI to sh:class or sh:datatype
rdfs:comment For each relevant property that has an rdfs:range, creates an sh:node if the range yielded a NodeShape that has an sh:hasValue constraint, instead of an sh:class
sh:order 4

 owl2sh-semi-closed:rdfsRangeLiteral2shNodeKind

rdfs:label rdfs:range rdfs:Literal to sh:nodeKind sh:Literal
rdfs:comment For each relevant property that has an rdfs:range with value rdfs:Literal, create sh:nodeKind constraint.
sh:order 5

 owl2sh-semi-closed:shPropertyShapeCleanUp

rdfs:label sh:property shape clean up
rdfs:comment For each value of sh:property, add a rdf:type sh:PropertyShape triple.
sh:order 100