Closed mgberg closed 1 year ago
@mgberg Thank you for this amazing contribution. This is a very well written pull request, shows good understanding of the PySHACL codebase, and the W3C SHACL spec. I'm more than happy to merge this, and put out a new release in the next couple of days with this feature.
Quick note, I noticed you use graph.cbd()
in your addition to clean_validation_reports()
. This is fine, and is probably the correct tool for the job. cbd()
is a (relatively) new feature in RDFLib, and was only released in v6.1.0. I have thus far avoided using it in PySHACL for compatibility reasons. However, PySHACL does now have a requirement on RDFLib v6.2.0+, so that shouldn't be an issue.
@mgberg This is released now in PySHACL v0.23.0
Overview
The SHACL spec states that
sh:detail
may be used to provide further details about a validation result. Previously, pySHACL would ignore (the word used in the comments) the failures generated forsh:node
and create a new validation error such that the details never made it into the final validation report. This attaches those validation results to the newly generated error viash:detail
so they are available for use in the final validation report if it is desired to take advantage of them.Specifically, this PR contains the following modifications:
sh:node
viash:detail
in the result graphsh:node
indented under the violation of the NodeConstraintComponentclean_validation_reports
function to filter outsh:detail
such that the DASH and SHT test suites continue to passExample
Below are examples of how the validation reports are changed by this PR as a diff compared to the report before these modifications are applied. The graph used to generate these reports is the one used in the added test.
Graph-Based Report
Note that some triples in the serialization have been reordered from rdflib's default serialization behavior to make it more readable for the sake of this example.
Text-Based Report