-
Notifications
You must be signed in to change notification settings - Fork 30
A SHACL OWL "profile" to aid ontologies mixing SHACL and OWL #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think it would be useful. But if the group agrees to do that, why keeping these assertions in a separate graph ? why not including them in SHACL-SHACL directly ? |
@tfrancart : I don't want to suggest requiring OWL-&-SHACL users have to import SHACL or SHACL-SHACL. A SHACL user today does not have to import the SHACL graph - they instead just use the SHACL concepts. An OWL-&-SHACL user only needs to know what the structural types are for each of the SHACL concepts, and this is doable with a couple dozen triples. |
I think there is an overlap between data modeling and the bounds of subgraphs defined by shapes. For the later use case, constraints for filtering can be optional. The Shape Topologies algorithm, used by the TREE hypermedia specification, skips the filtering for the sake of simplicity. Maybe it makes sense to broaden the scope of the profile. |
@ajnelson-nist At the call today you described this issue in summary as: SHACL talks about RDFS.
But OWL uses different constructs. I think the cleanest way is to require OWL+SHACL ontologies to have dual RDFS+OWL types for their terms. owl:Class rdfs:subClassOf rdfs:Class .
owl:DatatypeProperty rdfs:subClassOf rdf:Property .
owl:ObjectProperty rdfs:subClassOf rdf:Property . |
true https://www.w3.org/TR/owl2-rdf-based-semantics/#A_Set_of_Axiomatic_Triples:
but not all implementations respect that though.. e.g., https://s.zazuko.com/3wib4Wp @prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix testo: <http://ontology.test/> .
@prefix testv: <http://vocabulary.test/> .
@prefix tests: <http://shape.test/> .
@prefix testd: <http://data.test/> .
testo:Party a owl:Class, rdfs:Class, sh:NodeShape ;
rdfs:label "Party"@en ;
sh:nodeKind sh:IRI ;
sh:property [
sh:path testo:hasContact ;
sh:nodeKind sh:IRI ;
sh:class testo:Contact ;
sh:minCount 1 ;
sh:maxCount 1 ;
] .
testo:hasContact a owl:ObjectProperty ;
rdfs:label "Has Contact"@en .
testo:Contact a owl:Class,sh:NodeShape ;
rdfs:label "Contact"@en ;
sh:nodeKind sh:IRI ;
sh:property [
sh:path testo:contact ;
sh:nodeKind sh:Literal ;
sh:datatype xsd:string ;
sh:minCount 1 ;
sh:maxCount 1 ;
] .
testo:contact a owl:DatatypeProperty ;
rdfs:label "Contact Code/String"@en . with @prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix testo: <http://ontology.test/> .
@prefix testv: <http://vocabulary.test/> .
@prefix tests: <http://shape.test/> .
@prefix testd: <http://data.test/> .
## Individuals
testd:e954e11c-8156-42d0-b44a-437598239946 rdf:type testo:Party;
testo:hasContact testd:c7d80653-05f3-4c96-862a-e2704c4f5d87, testd:39ccc4b1-4426-4bf9-bc54-b0546ab6d951 .
testd:c7d80653-05f3-4c96-862a-e2704c4f5d87 rdf:type testo:Contact.
testd:39ccc4b1-4426-4bf9-bc54-b0546ab6d951 rdf:type testo:Contact ;
testo:contact "[email protected]"^^xsd:string ,"[email protected]"^^xsd:string . doesn't report violations for |
SHACL doesn't require
|
Signed-off-by: Alex Nelson <[email protected]>
@VladimirAlexiev and @simonstey : I can't recall where in the OWL docs this is written, but inferencing based on these triples being included in the graph ... owl:Class rdf:type rdfs:Class .
owl:Class rdfs:subClassOf rdfs:Class . ... does not work within OWL 2 DL. There are expressions needed to define OWL within RDF that OWL disallows in other uses, due to rules OWL made around "reserved" IRIs like Hence, a consequence of this modeling restriction is that multi-typing (as @VladimirAlexiev noted a few times in this thread: Since @VladimirAlexiev noted ROBOT over on #212 , I'll note its output1 on an example ontology for the sake of reproducibility w.r.t. this thread and #212 . What I wrote above is my understanding of the meaning behind the below error messages. Data graph ( @prefix owl: <http://www.w3.org/2002/07/owl#> .
@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
owl:Class a rdfs:Class .
sh:ShapeClass a rdfs:Class ; rdfs:subClassOf owl:Class . Shell invocation, per documentation at this page: java -jar robot.jar validate-profile \
--input example.ttl \
--profile DL Output:
This working group is not scoped to discuss modeling matters of OWL, so, again, I am trying to be mindful of scope. PR #336 assists current use cases without expanding too much. This is why the file I've uploaded in the accompanying PR is kept separate in import-dependency from other SHACL resources. Footnotes
|
(Please pardon the closing-opening noise, finger slipped.) |
@bergos : I'm not familiar with the two docs you'd noted. I'm going to enter some possibly-wild speculation - apologies in advance if I'm really far off, and I welcome corrections. I think the resource in the accompanying PR is best kept at a small impact target: acknowledging as OWL the set of SHACL classes and properties. I mean to have OWL-specific concerns addressable by so-concerned users with a single triple:
If a project does wish to undergo this exercise, the friction point would be if some interpretation is found for SHACL's |
PR #336 is open, and its technical contents are being kept synchronized with a separate monitoring repository. I'm NOT planning on inlining the CI into this repository directly, though I don't mind explaining its workflow.1 I'd appreciate feedback on #336 to answer its checklist questions. The synchronizing mechanism revolves around a SHACL graph that takes The issue is, to run in CI on this repository, something would need to run this graph, and do a little pre-processing to concatenate files into a temporary data graph. I'm unaware if W3C lets that kind of CI mechanism be added to working-group documents. It's light enough work that it can run in a separate repository and avoid any technology policy issues. I just have it on The review graph is below. @prefix ex: <http://example.org/sh-shacl-owl-coverage/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/sh-shacl-owl-coverage>
a owl:Ontology ;
rdfs:comment "A shapes graph to confirm SHACL classes and properties are also cast with OWL types."@en ;
.
ex:OwlClassIsShaclClassShape
a sh:NodeShape ;
sh:class rdfs:Class ;
sh:targetClass owl:Class ;
.
ex:OwlPropertyIsShaclPropertyShape
a sh:NodeShape ;
sh:class rdf:Property ;
sh:targetClass owl:AnnotationProperty ;
.
ex:ShaclClassIsOwlClassShape
a sh:NodeShape ;
sh:class owl:Class ;
sh:targetClass rdfs:Class ;
.
ex:ShaclPropertyIsOwlPropertyShape
a sh:NodeShape ;
sh:class owl:AnnotationProperty ;
sh:targetClass rdf:Property ;
. Footnotes
|
Signed-off-by: Alex Nelson <[email protected]>
Signed-off-by: Alex Nelson <[email protected]>
I'm posting this mindful of the scope of the current SHACL working group not including other modeling languages. I am hopeful that this stays within bounds for a modeling language that has already had some concepts used by SHACL, OWL 2, specifically for
owl:Ontology
, and incidentallyowl:imports
.Summary: This is a request to add a graph as a resource in the SHACL suite for the benefit of ontologies that want to use SHACL, AND be conformant to OWL 2 DL (or other profile), and not fall into OWL 2 FULL.
There are ontologies that use a mixture of SHACL and OWL for the two languages' non-overlapping features. There is some roundabout compatibility support for OWL class modeling with SHACL, such as in SHACL 1.0's Section 2.1.3.3 definition of implicit class targets and SHACL Class's positional description that lets
owl:Class
substitute straightforwardly forrdfs:Class
.However, usage of SHACL in an OWL ontology currently does not satisfy OWL 2 DL rules, without a little extra work left to the implementing ontologists. Syntactically, there is a requirement that can be elided from "skipping ahead" in the OWL specs to OWL 2 Web Ontology Language Mapping to RDF Graphs (Second Edition), that:
o
is the object in a triples rdf:type o
,o
needs to be an instance ofowl:Class
(orowl:Restriction
and other reserved OWL IRIs, but they're beside the point for this issue).p
is the predicate in a triples p o
,p
must be exactly one ofowl:ObjectProperty
,owl:DatatypeProperty
, orowl:AnnotationProperty
.SHACL and SHACL-SHACL are currently defined primarily with RDFS concepts. Every class and property are
rdfs:Class
andrdf:Property
. The SHACL 1.0 implementation includes the triplesh: a owl:Ontology .
, so in a sense, a toe is already dipped into the OWL waters.The issue is, if an ontology is using SHACL and OWL, the ontology will not be conformant to OWL 2 DL unless it takes the extra step of assigning OWL modeling concepts to every concept in SHACL used in the ontology. E.g., if
sh:declares
is used, it needs to be defined as anowl:ObjectProperty
orowl:AnnotationProperty
. I think there is no reason to leave every SHACL-and-OWL adopter the task of adding these statements, especially if there is any pondering they might do on whether every property should be anowl:AnnotationProperty
or not.For the benefit of ontologies mixing OWL and SHACL, can a graph be provided that:
owl:Class
;owl:AnnotationProperty
.From my experience with OWL 2 DL conformance testing, I believe this would be sufficient to enable OWL 2 DL conformance testing with SHACL concepts not being an impediment.
If anyone wants to dig into the reasoning for global assignment of
owl:AnnotationProperty
- again, being mindful of scoping of working group activities - this is to:owl:Restriction
s (c/o the reminder thatowl:AnnotationProperty
s cannot be restricted - see all occurrences ofowl:onProperty
in the OWL-RDF mapping I cited above, and note "AP" for "Annotation Property" never occurs).I suggest this graph file be standalone, and not use
owl:imports
to bring in anything (including the core SHACL spec graph). The new graph should be able to beowl:imports
-able by itself.This graph can be typed up in about 10 minutes with a plain text editor, and I believe would be straightforward to maintain with the evolving SHACL 1.2 and beyond specifications with a mutual coverage checking script. The harder question for the group is the decision to provide this.
Somewhat related issues I can recall offhand:
owl:Ontology
shsh:
#196 - A note that RDFS entailment can assign the typeowl:Ontology
to SHACL-SHACL too; however, IIRC (corrections welcome), OWL entailment will terminate reporting inconsistency while properties are not additionally typed per OWL 2 DL specification.The text was updated successfully, but these errors were encountered: