-
Notifications
You must be signed in to change notification settings - Fork 61
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
subclass inferencing #108
Comments
Dear Raul, great to see that we can get in touch here as well. In our projects, we appended parts of the ontology to the data graphs to inform the shacl validator about these additional properties. Example (before):
Example (after, adding the ontology content to the data graph):
Hope this helps! |
Thank you @JohannesLipp ! |
The validator (and the standard) does support subclass inferencing, based on rdfs:subClassOf triples found in the data graph. Without such triples there is no way for it to know that SubGeometry is a subclass of Geometry. Is your issue that you find adding those subClassOf triples impractical because they are only in the Ontology? What we do all the time is to use owl:imports, e.g. ex:DataGraph owl:imports ex:Ontology and then build a MultiUnion Graph in jena with all these graphs merged into a single virtual graph. This also means you can have ex:ShapesGraph owl:imports ex:Ontology which makes it easier to "attach" constraints to the classes. |
Thanks @HolgerKnublauch; however that does not look so straightforward to me as you say. Perhaps I am missing something though. In our case the data graph is encoded as a jsonld that points to the context derived from target ontology, see partial example below :
Our SHACL is: The error validating the input with the SHACL is:
I tried the following:
2.--- I tried adding directly the statement in SHACL. Result: no change
3.--- I tried adding import statement in data graph, although not sure this is correct as we use context already. Result: no change
4.--- I tried adding directly the statement in data graph. Result: it works. However as I said this is impractical.
Any idea, or something I am missing? |
How do you invoke this? Just adding owl:imports statements by itself doesn't do anything unless the calling code also follows those graphs and knows where to find them. I am not fluent in JSON-LD and it's too easy to get different triples than we believe. Could you cast this to Turtle so that we can be sure we are talking about the same data, namespaces etc? |
In order to do the validation, I am using https://jena.apache.org/documentation/shacl/ . I also tried using the shacl playground tool https://shacl.org/playground/ Sure, the data graph in ttl would be:
I tried adding the import like this:
|
Sorry but this repo here is about the TopBraid SHACL API, not the one from Jena. I suggest asking the jena-users mailing list. |
Hi,
I am not very familiar yet with SHACL, so, I am trying to figure out if is possible, and if so, how, to define a shape constraint saying that the range of a property should be of type X AND any of its subclasses (rdf:subclassof*). FOr example, in shape below, how to say that the range of geo:hasGeometry is geo:Geometry and its subclasses ?
thanks
https://astrea.linkeddata.es/shapes#3f6891594ac2d163a004bec00f8db48a
a sh:PropertyShape ;
sh:class geo:Geometry ;
sh:nodeKind sh:IRIOrLiteral ;
sh:path geo:hasGeometry .
The text was updated successfully, but these errors were encountered: