Skip to content
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

sh:entailment and pyshacl --advanced #221

Open
ajnelson-nist opened this issue Feb 15, 2024 · 1 comment
Open

sh:entailment and pyshacl --advanced #221

ajnelson-nist opened this issue Feb 15, 2024 · 1 comment

Comments

@ajnelson-nist
Copy link
Contributor

I see from today's features status that sh:entailment is not currently implemented in pySHACL.

I've also seen the --advanced flag and some discussion on other issues (e.g. #60 ) around SHACL-AF.

From Section 8.3 of the SHACL-AF document, there is language around what looks like "halting fast" if the triple $ontology sh:entailment sh:Rules . appears in the input shapes and the engine ~"doesn't support the sh:Rules entailment regime."

What should happen if I have this graph, sh-example.ttl ...

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

<http://example.org/shapes>
a owl:Ontology ;
sh:entailment sh:Rules .

... and I use it in these two commands?

pyshacl --advanced --shacl sh-example.ttl sh-example.ttl
pyshacl            --shacl sh-example.ttl sh-example.ttl

Put another way - should the second command fail because only --advanced would "enable" sh:Rules?

Relatedly, because I'm curious about what else implementing sh:entailment might mean: is there a relationship between sh:entailment IRIs and some of pyshacl's inference modes? It looks like there are IRIs from SPARQL that predate SHACL, but SHACL doesn't make impositions within the SHACL specification on what IRIs must be supported. (SPARQL entailment regimes are referenced, but don't seem to be required.) So, if pySHACL said it supported RDFS inferencing, and treated a shapes graph containing $ontology sh:entailment <http://www.w3.org/ns/entailment/RDFS> . with the same runtime effect as pyshacl --inference rdfs, would that be a pySHACL extension behavior over the SHACL specification?

@ashleysommer
Copy link
Collaborator

This behaviour in PySHACL is left over from before SHACL-AF spec was published. The first few versions of PySHACL (with built-in inferencing options) were released more than a year before SHACL-AF was released, so sh:entailment and sh:Rules didn't exist.

The current situation is a result of a mismatch between the PySHACL's built-in system for inferencing, and SHACL-AF's specified method for entailment.

The ideal solution would be to implement support for sh:entailment, use that as the default method for enabling RDFS/OWL inferencing, and remove the cli option. That however would be a breaking change.
I do plan a similar breaking change in the near future that switches --advanced on by default, so I suppose it makes sense to make this sh:entailment change at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants