zazuko / rdf-validate-shacl

Validate RDF data purely in JavaScript. An implementation of the W3C SHACL specification on top of the RDFJS stack.
MIT License
98 stars 13 forks source link

Improve validation message of `sh:xone` #63

Open tpluscode opened 3 years ago

tpluscode commented 3 years ago

I would propose tweaking the detail validation result message when an XONE constraint is violated

Currently it produces no message at all. Without even knowing which sub shapes are conflicted, it's quite difficult to get a grip on what is wrong.

I have a few ideas

First, could be to enumerate all of the sh:xone and produce a message like

Resource must be exactly one of A, B, C

Where A, B and C would be the rdfs:label or node value if label is not given. This would also apply to a focus node where none of the child shapes are matched

Alternatively, if we can get the info, could be to give the opposite and only mention the shapes which were matched and thus are in conflict

Resource cannot be A and C at the same time

Here B is hypothetically excluded

martinmaillard commented 3 years ago

I like the idea. We should probably do the same for sh:and and sh:or.