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

fix #125 #126

Merged
merged 3 commits into from
Apr 11, 2024
Merged

fix #125 #126

merged 3 commits into from
Apr 11, 2024

Conversation

giacomociti
Copy link
Contributor

still a draft, looking for early feedback and advice on additional testing

Copy link

changeset-bot bot commented Apr 3, 2024

🦋 Changeset detected

Latest commit: 3f77cc9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
rdf-validate-shacl Patch

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

Copy link
Collaborator

@tpluscode tpluscode left a 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()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why clone?

Copy link
Contributor Author

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.

Copy link
Collaborator

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...

Copy link
Contributor Author

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.

@giacomociti
Copy link
Contributor Author

For testing, check the directory test/data/data-shapes/custom. I would place additional test cases there.

I'm afraid we cannot rely on the machinery for official tests: the spec is agnostic wrt sh:detail. According to the test suite documentation:

Before comparing the results graph with the expected results, the actual validation report must not include any "nested" results, via sh:details.

and in fact details are removed before comparing the actual with the expected results

@giacomociti giacomociti marked this pull request as ready for review April 11, 2024 07:38
@giacomociti giacomociti merged commit 3a88720 into master Apr 11, 2024
3 checks passed
@giacomociti giacomociti deleted the fix125 branch April 11, 2024 09:37
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

Successfully merging this pull request may close these issues.

None yet

2 participants