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

Output with anonymous focus nodes, could it print whole node? #32

Closed
jameshowison opened this issue Oct 20, 2019 · 4 comments
Closed

Output with anonymous focus nodes, could it print whole node? #32

jameshowison opened this issue Oct 20, 2019 · 4 comments

Comments

@jameshowison
Copy link
Contributor

I'm doing some validation in data with anonymous nodes. The output of validate (e.g., results_text) shows:

Focus Node: [ ]
Value Node: [ ]

That makes it pretty hard to know which node has the issue. Any thoughts on how to identify them. I'm wondering if there could be an option to print either the datafile:line_number (hard, I know) or perhaps the whole anonymous node (ours are small, I know they could be very big, but even a few lines would probably help locate them).

@ashleysommer
Copy link
Collaborator

Hi, there is actually a standard feature in pyshacl which should print the whole anonymous node text in the output. If it's not doing that, it's a bug.

Are you able to share some sample code which reproduces this output?

@ashleysommer
Copy link
Collaborator

Hi Again, I think I have reproduced the same (or similar) problem in a new test I'm writing. I think its yet another problem that was introduced when we switched from using Graphs by default to Datasets by default. Stringifying a blank node (anonymous node) that is in rdflib Dataset does not work in the same way as when using an rdflib Graph.

Working on a solution.

ashleysommer added a commit that referenced this issue Oct 21, 2019
Stringification of Focus Node, and Value Node in the results text string now works correctly
- This is an old bug, that has been around since the first versions of pySHACL
- Manifests when the DataGraph is a different graph than the ShapesGraph
- Recent change from using Graphs by default to using Datasets by default helped to expose this bug
- Thanks to @jameshowison for reporting the bug
Stringification of a blank node now operates on a rdflib.Graph only, rather than a Dataset.
- Added mechanism to extract the correct named graph from a dataset when stringifying a blank node.
Added a workaround for a json-ld loader bug where the namespace_manager for named graphs within a conjunctive graph is set to the parent conjunctive graph.
- This necessary workaround was exposed only after changing the blank node stringification above. (Fixing one bug exposed another bug!)
@ashleysommer
Copy link
Collaborator

Hi @jameshowison
I pushed a fix for this bug, and is released as pySHACL v0.11.3, it should be available to installed from PyPI now.
Can you please check to see if the problem you described above is fixed in this new version.

@jameshowison
Copy link
Contributor Author

Works perfectly now, shows whole anonymous node. Apologies that I didn't include a specific reprex, will do next time!

(ps. and just a docker build --no-cache updated everything pulling the new version from PyPI).

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