-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix #125 #126
fix #125 #126
Conversation
🦋 Changeset detectedLatest commit: 3f77cc9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
For testing, check the directory test/data/data-shapes/custom
. I would place additional test cases there.
@@ -67,16 +67,20 @@ class SHACLValidator { | |||
} | |||
|
|||
// Exposed to be available from validation functions as `SHACL.nodeConformsToShape` | |||
nodeConformsToShape(focusNode, shapeNode) { | |||
nodeConformsToShape(focusNode, shapeNode, engine = this.validationEngine.clone()) { |
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.
Why clone?
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.
using a fresh instance of validation engine we avoid side effects (collection of result details) on the current instance.
Only when calling from a sh:node
constraint we do want to affect the current instance, in the other cases (sh:and
, sh:or
, sh:not
...) we are only interested in the boolean result and we don't care about the details.
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.
Hm, I wonder if that is entirely true. I was always thinking that to improve the error messages in complex scenarios would require a smarter analysis of the nested results. But maybe it's better to reorganise the shapes and write good, targeted messages...
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.
admittedly, this PR is a bit of hacking trying to fix the anomaly. Redesigning all the result details to provide more insights for violations of logical constraints is intriguing but beyond the scope of this PR.
I'm afraid we cannot rely on the machinery for official tests: the spec is agnostic wrt
and in fact details are removed before comparing the actual with the expected results |
still a draft, looking for early feedback and advice on additional testing