Skip to content

Commit

Permalink
Merge pull request #572 from ucoProject/BugFix-Issue-571
Browse files Browse the repository at this point in the history
Issue 571: Reduce UCO OWL RDF List review scope to OWL Sequences
  • Loading branch information
plbt5 authored Jan 19, 2024
2 parents 429cfa7 + 37d41e2 commit 3427df0
Show file tree
Hide file tree
Showing 4 changed files with 442 additions and 75 deletions.
200 changes: 181 additions & 19 deletions ontology/owl/owl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,14 @@ uco-owl:Disjointedness-DP-OP-shape
.

uco-owl:List-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:maxCount "1"^^xsd:integer ;
sh:path rdf:first ;
] ;
sh:sparql [
a sh:SPARQLConstraint ;
rdfs:comment "This requirement is determined from review of the canonical parsing process in Section 3 of the OWL 2 mapping to RDF. Table 5 removes any triple matching the pattern 'x a rdf:List`. All other references throughout Section 3 to rdf:first are identified as blank nodes. Therefore, any non-blank node that is an rdf:List will not be mapped and consumed by the mapping process, making the graph non-conformant with OWL 2 DL."@en ;
rdfs:seeAlso <https://www.w3.org/TR/2012/REC-owl2-mapping-to-rdf-20121211/#Mapping_from_RDF_Graphs_to_the_Structural_Specification> ;
sh:message "The subject of a triple with rdf:first as predicate must be a blank node."@en ;
sh:select """
SELECT $this
WHERE {
FILTER isIRI($this)
}
""" ;
] ;
sh:targetSubjectsOf rdf:first ;
a sh:Shape ;
rdfs:comment "This shape's functionality has been exported"@en ;
rdfs:seeAlso
uco-owl:Sequence-shape ,
uco-owl:rdf-first-subjects-shape ,
uco-owl:rdf-rest-subjects-shape
;
sh:deactivated "true"^^xsd:boolean ;
.

uco-owl:ObjectProperty-shacl-constraints-shape
Expand Down Expand Up @@ -250,6 +239,75 @@ uco-owl:ObjectProperty-shacl-constraints-shape
sh:targetClass owl:ObjectProperty ;
.

uco-owl:Sequence-shape
a sh:NodeShape ;
rdfs:comment "This shape intentionally has no target declaration. It is instead intended to be incorporated using 'sh:node'."@en ;
rdfs:seeAlso <https://www.w3.org/TR/2012/REC-owl2-mapping-to-rdf-20121211/#Mapping_from_RDF_Graphs_to_the_Structural_Specification> ;
sh:description "This shape is determined from review of the canonical parsing process in Section 3 of the OWL 2 mapping to RDF, particularly Tables 3 and 5. Table 5 removes any triple matching the pattern 'x a rdf:List`. All other references throughout Section 3 to rdf:first are in the context of mapping a Sequence in OWL structure translation, and are denoted as blank nodes, starting with Table 3. A non-blank node that is an rdf:List and used with a sequence-valued property IRI in the OWL namespace will not be mapped and consumed by the mapping process, making the graph non-conformant with OWL 2 DL. But a non-blank node that is an rdf:List can be used if not directly attached to a sequence-valued property IRI in the OWL namespace."@en ;
sh:xone (
[
a sh:NodeShape ;
sh:hasValue rdf:nil ;
]
[
a sh:NodeShape ;
sh:nodeKind sh:BlankNode ;
sh:property [
a sh:PropertyShape ;
sh:path [
sh:oneOrMorePath rdf:rest ;
] ;
sh:xone (
[
a sh:NodeShape ;
sh:hasValue rdf:nil ;
]
[
a sh:NodeShape ;
sh:nodeKind sh:BlankNode ;
sh:property [
a sh:PropertyShape ;
sh:maxCount "1"^^xsd:integer ;
sh:minCount "1"^^xsd:integer ;
sh:path rdf:first ;
] ;
]
) ;
] ;
]
) ;
.

uco-owl:disjointUnionOf-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:disjointUnionOf ;
] ;
sh:targetSubjectsOf owl:disjointUnionOf ;
.

uco-owl:distinctMembers-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:distinctMembers ;
] ;
sh:targetSubjectsOf owl:distinctMembers ;
.

uco-owl:hasKey-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:hasKey ;
] ;
sh:targetSubjectsOf owl:hasKey ;
.

uco-owl:incompatibleWith-direct-import-shape
a sh:PropertyShape ;
rdfs:seeAlso <https://www.w3.org/TR/owl2-syntax/#Imports> ;
Expand Down Expand Up @@ -285,6 +343,46 @@ uco-owl:incompatibleWith-imported-version-iri-shape
sh:targetObjectsOf owl:incompatibleWith ;
.

uco-owl:intersectionOf-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:intersectionOf ;
] ;
sh:targetSubjectsOf owl:intersectionOf ;
.

uco-owl:members-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:members ;
] ;
sh:targetSubjectsOf owl:members ;
.

uco-owl:onProperties-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:onProperties ;
] ;
sh:targetSubjectsOf owl:onProperties ;
.

uco-owl:oneOf-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:oneOf ;
] ;
sh:targetSubjectsOf owl:oneOf ;
.

uco-owl:ontologyIRI-versionIRI-prerequisite-shape
a sh:NodeShape ;
rdfs:seeAlso <https://www.w3.org/TR/owl2-syntax/#Ontology_IRI_and_Version_IRI> ;
Expand All @@ -293,6 +391,60 @@ uco-owl:ontologyIRI-versionIRI-prerequisite-shape
sh:targetSubjectsOf owl:versionIRI ;
.

uco-owl:propertyChainAxiom-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:propertyChainAxiom ;
] ;
sh:targetSubjectsOf owl:propertyChainAxiom ;
.

uco-owl:rdf-first-subjects-shape
a sh:NodeShape ;
sh:property
[
a sh:PropertyShape ;
sh:maxCount "1"^^xsd:integer ;
sh:path rdf:first ;
] ,
[
a sh:PropertyShape ;
sh:minCount "1"^^xsd:integer ;
sh:path rdf:rest ;
]
;
sh:targetSubjectsOf rdf:first ;
.

uco-owl:rdf-rest-subjects-shape
a sh:NodeShape ;
sh:property
[
a sh:PropertyShape ;
sh:maxCount "1"^^xsd:integer ;
sh:path rdf:rest ;
] ,
[
a sh:PropertyShape ;
sh:minCount "1"^^xsd:integer ;
sh:path rdf:first ;
]
;
sh:targetSubjectsOf rdf:rest ;
.

uco-owl:unionOf-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:unionOf ;
] ;
sh:targetSubjectsOf owl:unionOf ;
.

uco-owl:versionIRI-multiversion-shape
a sh:PropertyShape ;
rdfs:seeAlso <https://www.w3.org/TR/owl2-syntax/#Imports> ;
Expand All @@ -310,3 +462,13 @@ uco-owl:versionIRI-nodeKind-shape
sh:targetSubjectsOf owl:versionIRI ;
.

uco-owl:withRestrictions-subjects-shape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:node uco-owl:Sequence-shape ;
sh:path owl:withRestrictions ;
] ;
sh:targetSubjectsOf owl:withRestrictions ;
.

138 changes: 137 additions & 1 deletion tests/examples/rdf_list_PASS.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"@context": {
"dash": "http://datashapes.org/dash#",
"ex": "http://example.org/ontology/",
"kb": "http://example.org/kb/",
"owl": "http://www.w3.org/2002/07/owl#",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"skos": "http://www.w3.org/2004/02/skos/core#"
"sh": "http://www.w3.org/ns/shacl#",
"skos": "http://www.w3.org/2004/02/skos/core#",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@graph": [
{
Expand All @@ -15,6 +19,14 @@
"@id": "kb:concept-2",
"@type": "skos:Concept"
},
{
"@id": "kb:concept-3",
"@type": "skos:Concept"
},
{
"@id": "kb:concept-4",
"@type": "skos:Concept"
},
{
"@id": "kb:ordered-collection-1",
"@type": "skos:OrderedCollection",
Expand Down Expand Up @@ -50,6 +62,130 @@
}
}
}
},
{
"@id": "kb:ordered-collection-3",
"@type": "skos:OrderedCollection",
"skos:memberList": {
"@id": "kb:list-1",
"@type": "rdf:List",
"rdf:first": {
"@id": "kb:concept-3"
},
"rdf:rest": {
"@type": "rdf:List",
"rdf:first": {
"@id": "kb:concept-4"
},
"rdf:rest": {
"@id": "rdf:nil"
}
}
}
},
{
"@id": "kb:ordered-collection-4",
"@type": "skos:OrderedCollection",
"skos:memberList": {
"rdf:first": {
"@id": "kb:concept-3"
},
"rdf:rest": {
"@id": "kb:list-2",
"rdf:first": {
"@id": "kb:concept-4"
},
"rdf:rest": {
"@id": "rdf:nil"
}
}
}
},
{
"@type": "owl:AllDifferent",
"owl:distinctMembers": {
"@type": "rdf:List",
"rdf:first": {
"@id": "kb:ordered-collection-1"
},
"rdf:rest": {
"@type": "rdf:List",
"rdf:first": {
"@id": "kb:ordered-collection-2"
},
"rdf:rest": {
"@id": "rdf:nil"
}
}
}
},
{
"@id": "ex:hasGrandparent",
"@type": "owl:ObjectProperty",
"rdfs:isDefinedBy": {
"@id": "https://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Property_Chains"
},
"owl:propertyChainAxiom": {
"rdf:first": {
"@id": "ex:hasParent"
},
"rdf:rest": {
"rdf:first": {
"@id": "ex:hasParent"
},
"rdf:rest": {
"@id": "rdf:nil"
}
}
}
},
{
"@id": "ex:hasParent",
"@type": "owl:ObjectProperty"
},
{
"@id": "ex:Person",
"@type": "owl:Class",
"rdfs:comment": "NOTE: This example is excerpted from the OWL 2 Primer only for syntactic reference.",
"rdfs:isDefinedBy": {
"@id": "https://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Keys"
},
"owl:hasKey": {
"rdf:first": {
"@id": "ex:hasSSN"
},
"rdf:rest": {
"@id": "rdf:nil"
}
}
},
{
"@id": "ex:hasSSN",
"@type": "owl:DatatypeProperty",
"rdfs:comment": "NOTE: This example is excerpted from the OWL 2 Primer only for syntactic reference.",
"rdfs:isDefinedBy": {
"@id": "https://www.w3.org/TR/2012/REC-owl2-primer-20121211/#Keys"
}
},
{
"@id": "dash:DateOrDateTime",
"@type": "rdf:List",
"rdf:first": {
"sh:datatype": "xsd:date"
},
"rdf:rest": {
"rdf:first": {
"sh:datatype": "xsd:dateTime"
},
"rdf:rest": {
"@id": "rdf:nil"
}
},
"rdfs:comment": "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:date or xsd:dateTime.",
"rdfs:isDefinedBy": {
"@id": "http://datashapes.org/dash"
},
"rdfs:label": "Date or date time"
}
]
}
Loading

0 comments on commit 3427df0

Please sign in to comment.