-
Notifications
You must be signed in to change notification settings - Fork 64
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
ShapeRecursionWarning #154
Comments
Is there a reason the |
Thanks for your response, and apologies for the delay in mine. No, there is no reason that In any case, your suggestion addressed the errors and all seems to be working as expected. Thanks very much for your assistance. |
Hi @bguayante
The reason you are getting the two confused in this case, is because you are (I suspect unintentionally) using the Implicit Class Target feature of SHACL, where instead of defining as SHACL Shape and giving it a For further clarity, in this example Shape, you are targeting all data objects that have a class of "schema:Organization", and enforcing a property constraint, which is a propertyShape that enforces the constraint that Instead, when you use Note, while investigating this issue, I found a possible bug in the implementation above, that if fixed might allow simple examples like yours to work as expected without throwing this error. I'll update this thread if I make any progress on that. EDIT: See my next post.. |
Doing some more investigation, I've come to the conclusion that this particular example is not actually recursive in the sense that it would break not PySHACL. If the recursion check was not in place, this example would run and complete as expected, as it is not infinitely recursive. However the pattern of evaluation path that looks like:
That does trigger the recursion detection mechanism in PySHACL. That mechanism has no way of knowing if the recursion look is infinite or not, so it triggers after the first repeating cycle. This could be optimised more, to perhaps trigger on the second cycle, but this would still throw the warning when it gets to Organisation->subOrganisation->Organisation->subOrganisation->Organisation, so the question is how many cycles of this pattern should be allowed before it is deemed too deep? I will also note, something I should have mentioned in my previous comment: |
@bguayante Can you please try the new PySHACL v0.20.0 released today: https://pypi.org/project/pyshacl/0.20.0/ |
ReOpening, to keep the discussion open, because I don't think the discussion is finished yet. |
Happy to. Run against the example above, the only information returned is the validation result. No warning is presented. This is also the case when run against the more robust files with which I am actually working and the results seem to be accurate when errors are introduced. I'll also note that the Thank you for your extensive answer, I really appreciate it. I believe I have the concepts straight now and |
Yep, you're right, the metashacl issue is also fixed as part of that release. |
I am encountering some unexpected behavior when validating a JSON against a SHACL file using pyshacl v0.19.1. In all modes of operation, the following warning is returned when validation is run:
The validation results that are returned appear to be correct (i.e., errors are returned when intentionally introduced into the JSON) and so this is non-fatal, but I would like to verify whether this is a consequence of my implementation or a characteristic of pyshacl's support for recursive shapes. I suspect the former is true as the pattern TypeA:Property -> TypeA is not uncommon on Schema.org and so this does not seem to be a nonstandard use of SHACL.
A minimal example that reproduces the warning follows.
shacl.ttl
data.json
As an addendum, I'll also note that I am seeing the same non-halting error described in this issue under the same circumstances reported by the user.
The text was updated successfully, but these errors were encountered: