OWL 2 SHACL open ruleset


Turns an OWL Ontology into a set of SHACL Shapes. The generated Shapes remain open and will not detect a property asserted on an instance of a wrong class. Properties from other ontologies can still be asserted anywhere as the NodeShapes are not closed.

Table of Content

owl2sh-open:ClassShape

Target


Rules


 owl2sh-open: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-open:CreateNodeShapesAndPropertyShapesFromMatchingDomains

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

 owl2sh-open:CreateNodeShapesAndPropertyShapesFromRestrictions

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

 owl2sh-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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-open: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