[data-shapes] `sh:xone` and list length (#429)

ajnelson-nist has just created a new issue for https://github.com/w3c/data-shapes:

== `sh:xone` and list length ==
_Originally raised in [this comment](https://github.com/w3c/data-shapes/pull/417#discussion_r2205907515)_, excerpted here:

> [Section 4.6.4](https://www.w3.org/TR/shacl/#XoneConstraintComponent) of the 1.0 spec., consistent with today's draft state, reads:
> 
> > `sh:xone` specifies the condition that each value node conforms to _exactly one_ of the provided shapes.
> 
> However, the remainder of that section doesn't talk about whether `sh:xone` can or can't be empty.  This shape in SHACL-SHACL is consistent with that lack of detail, but the validation for a user with any targeted nodes would always fail, because there isn't exactly one match.
> 
> Thinking about it a bit, this seems like it would be a backwards-incompatible change to add a `sh:minListLength 1` here that fails a SHACL-SHACL run, because the `sh:xone` subject could be defined with no targets and sneak in as valid against SHACL-SHACL of SHACL 1.0.

Should SHACL 1.2 do anything about empty `sh:xone` lists?  We have a few options:

* Update the spec to say `sh:xone` _must_ have a member, and add a `sh:minListLength 1` constraint to SHACL-SHACL with `sh:Violation` severity.
* Update the spec to say `sh:xone` _should_ have a member, and add a `sh:minListLength 1` constraint to SHACL-SHACL with a lesser severity.
* Update the spec to say `sh:xone` _should_ have a member, and do not update SHACL-SHACL.

If updating the spec, this is my first sketch of wording for the `sh:xone` spec. section, added to the `span`s of `data-syntax-rule`s a new rule `xone-members-minCount`:

> There must be at least one member of such list.

If updating SHACL-SHACL to report less-than-`sh:Violation` severity, then we could use `sh:Warning` for the shape authors that they're about to cause trouble for their shape users.  #192 goes into other severities if we end up thinking a non-violation level would be better.

A PR for this Issue should be built on:

- [ ] #417
- [ ] #409 (if group decides on non-violation severity)

Please view or discuss this issue at https://github.com/w3c/data-shapes/issues/429 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 15 July 2025 13:33:31 UTC