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

Does pyShacl support entailment outputs using advanced features? #78

Closed
rob-metalinkage opened this issue Jun 1, 2021 · 5 comments
Closed

Comments

@rob-metalinkage
Copy link

Its not clear from the documentation whether, and how, pySHACL can be used to use SHACL-AF to perform entailment rules and return the resulting graph?

It does say on the tin that its just a validation tool.. but it seems a shame not to expose this capability given it seems to do all the work.

@ashleysommer
Copy link
Collaborator

Hi @rob-metalinkage

It is possible to do what you're asking. There are two ways to do it.

  1. Run PySHACL with the "inplace" kwarg. (this doesn't work via the CLI interface)
    This will cause PySHACL to perform any graph mutations (including inferencing and SHACL Rules) on the original data_graph, rather than an internal copy. So after PySHACL has run its validation, it your graph will be in a modified state, containing the expected additional triples.
  2. Run PySHACL using the Validator class, rather than the validate() helper.
    After the validation run, look at the validator.target_graph property, it will contain an in-memory graph that is an internal copy of the original data_graph, but containing the additional triples added by inferencing and SHACL Rules.

If you're asking about using PySHACL as a standalone entailment rule engine without running validation, then please weigh in on this discussion thread: #60

@rob-metalinkage
Copy link
Author

rob-metalinkage commented Jun 1, 2021

Thanks Ashley

I see this in the code, not the documentation :-)

@ashleysommer
Copy link
Collaborator

ashleysommer commented Jun 1, 2021

I see this in the code, not the documentation - and if I just put pyshacl in a requirements.txt it doesnt seem to like this option - so is there some specific version I can ask for that can be specified ..

I'd rather not have to be using a clone as its part of a github action and that just starts getting messy :-(

Are you referring to the inplace option, or option 2?

The inplace option has been in releases since v0.14.1 in December 2020 (and all subsequent releases including the latest v0.14.4).

The ability to get the target_graph from the Validator object has been in all versions since approx v0.11.1.

@ashleysommer
Copy link
Collaborator

ashleysommer commented Jun 1, 2021

PySHACL has no real documentation. This is a known issue, with no clear path to resolution.
The README file in the code repository acts as an introduction to how to use PySHACL on a basic level. Looks like the inplace option hasn't made its way into the README yet.
The README is obviously not a substitute for real documentation, it does not cover all use-cases and has no worked examples. There are two worked examples in the /examples/ directory in the code repository, but they are very basic, minimal examples.

@rob-metalinkage
Copy link
Author

Working fine for me so happy to close but hopefully this issue is referenced in a more general "build the docs" task issue.

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