-
Notifications
You must be signed in to change notification settings - Fork 63
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
The SPARQL Remote DataGraph Feature #233
Conversation
README.md
Outdated
@@ -185,6 +185,33 @@ You can get an equivalent of the Command Line Tool using the Python3 executable | |||
$ python3 -m pyshacl | |||
``` | |||
|
|||
## Errors | |||
Under certain circumstances pySHACL can produce a `Validation Failure`. This is a formal error defined by the SHACL specification and is required to be produced as a result of specific conditions within the SHACL graph. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be an appropriate link for "Validation failures"?
https://www.w3.org/TR/shacl/#failures
I mostly remembered the difference between "Validation failure" and sh:ValidationResult
, but still felt a need to check. It might be worth linking the failures section in case someone didn't know about this term nuance yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is the correct link. I agree I should probably put in a link to the relevant section in the spec.
Note, these descriptions are not new, they were/are already in the README file, this diff is simply moving the errors section to make a place for the Content for the SPARQL Remote Store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did catch that this diff was moved text. Eventually. Unfortunately, my curiosity was quicker than my scrolling.
README.md
Outdated
- `ShapeLoadError`: This error is thrown when a SHACL Shape in the SHACL graph is in an invalid state and cannot be loaded into the validation engine. | ||
- `ConstraintLoadError`: This error is thrown when a SHACL Constraint Component is in an invalid state and cannot be loaded into the validation engine. | ||
- `ReportableRuntimeError`: An error occurred for a different reason, and the reason should be communicated back to the user of the validator. | ||
- `RuntimeError`: The validator encountered a situation that caused it to throw an error, but the reason does concern the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-checking this remark: "...but the reason does concern the user." Should this be "and the reason does concern the user," "but the reason does not concern the user," or as-is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It should be "does not".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive code this Ashley! Just that simple comment about errors and all good
This is something I've been thinking about for a long time, and is finally available for PySHACL.
Enabling
sparql_mode
allows you to validate against a datagraph on a remote SPARQL endpoint.To use it on the CLI:
-q
(or--sparql-mode
) switchTo use it in the library:
sparql_mode=True
argument onvalidate()
data_graph
argument.In this mode, PySHAL operates strictly in read-only mode, and does not modify the remote data graph.
Some features are disabled when using the SPARQL Remote Graph Mode:
This is implemented with the built-in RDFLib sparql-store plugin, but may require the use of the SPARQLWrapper library in the future if we need more features.
There are further options that can be tweaked with Environment Variables:
PYSHACL_SPARQL_USERNAME
- HTTP BASIC Username for query endpointPYSHACL_SPARQL_PASSWORD
- HTTP BASIC Password for query endpointPYSHACL_SPARQL_METHOD
(default is GET)The major things this mode does differently:
This results in fewer HTTP calls to the SPARQL endpoint and in some cases offloads some workload to the datagraph host.
Note, quantity of SPARQL queries are reduced as much as possible in this first pass, but there are still a lot emitted during a full Validation, I'm still looking to see if there are other ways of further combining SPARQL queries to continue to reduce the number of lookups.
Fixes #174 #226