-
Notifications
You must be signed in to change notification settings - Fork 67
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
Multiple sh:xones on one sh:NodeShape grouping member shapes causing unexpected validation results #220
Comments
Hi @ajnelson-nist Next, I see thing-PASS-2 is being validated according to the sh-OneXorThing-shape because of a targeting error in your SHACL file. After fixing that targeting error, I'm now seeing the expected results in the PySHACL output:
|
Ah, dear. Good eye, I did indeed have a copy-paste error, and your fix addresses that part of this Issue. I tried out the PR, and the reformatting clarifies the pairs. Thank you! |
@ajnelson-nist |
Thank you! |
I came across this when trying to write shapes for an OWL ontology that defines some classes as disjoint unions (covering sets) of multiple sets of classes. For example, here is an analagous, distilled set of classes:
ex:OneXorThing
is a covering set of two subclasses. A member ofex:OneXorThing
must be a member of exactly one ofex:ThingA
orex:ThingB
.ex:TwoXorThing
functions similarly, but requires each of its members to members of two of two pairs of subclasses.An aside: I found in a deeper dive through the OWL documentation that disjoint unions entail every assertion in that example OWL graph on the
ThingA
...ThingF
classes, aside fromex:ThingX a owl:Class.
. The definition here describes the disjoint union class's member-classes as subclasses of the disjoint union class, albeit in English rather than demonstrated syntax: "Thus, each instance of C is an instance of exactly one CEi, and each instance of CEi is an instance of C." This section is linked as the "Normative syntax" from the OWL 2 New Features, Section 2.1.1 F1. I came across this when trying to determine if having more than oneowl:disjointWith
assertion on a class was disallowed somehow, and I believe I've exhausted the documentation and found nothing to disallow it.Back to the distilled example: It seems to me that
sh:xone
lines up well as a reviewing mechanism forowl:disjointUnion
, so I defined the following shapes graph, referenced further on assh-REPRODUCTION-2.ttl
:I then used it to review the following data graph, referenced further on as
kb-REPRODUCTION-2.ttl
:I get the following shell transcript using pySHACL 0.25.0:
The two "XFAIL" individuals show in the validation results, which is what I want; but, one of the PASS individuals also shows up. Further, it shows up in response to the wrong shape. And the XFAIL error that I was trying to trigger with
kb:thing-XFAIL-2
reports an exactly-one-of list that looks flat, rather than like two pairs.(Once I wrote that last sentence, I realized a problem with the data I'm reviewing is that my example individual is only a member of one of my disjoint unions, not both. I got distracted looking at the apparent list-flattening. But it is still an issue that
kb:thing-PASS-2
is triggering a test failure.)If I reduce the shapes graph to only
sh-ex:TwoXorThing-shape
, and the data graph to onlykb:thing-PASS-2
, validation works. But other combinations of removing shapes or individuals cause unexpected validation errors. I've left a Makefile and the reductions I tried in this Gist - it should run as documented in a freshgit clone
in macOS or Linux.The text was updated successfully, but these errors were encountered: