Skip to content

sh:xone and list length #429

Open
Open
@ajnelson-nist

Description

@ajnelson-nist

Originally raised in this comment, excerpted here:

Section 4.6.4 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 spans of data-syntax-rules 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreFor SHACL 1.2 Core spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions