Skip to content

maxErrors = 1 breaks sh:or constraint #88

@tpluscode

Description

@tpluscode

From what we have in Cube Creator

<ObservationConstraintProperty> a sh:NodeShape;
  sh:property [
    sh:message "needs a schema:name" ;
    sh:or (
      [
        sh:path schema:name ;
        sh:minCount 1 ;
        sh:datatype xsd:string ;
      ]
      [
        sh:path schema:name ;
        sh:minCount 1 ;
        sh:datatype rdf:langString ;
      ]
      [
        sh:path sh:path ;
        sh:in (rdf:type cube:observedBy) ;
      ]
    ) ;
  ]

A property should pass validation if it satisfy any single one of these constraints. Right now, if one sets maxErrors = 1 (or at least a number lower than the "OR'ed" shapes) the validator will fail.

This happens because there is a single counter for the count of error encountered thus far. Each part of the sh:or list increases that counter, so when maxErrors === 1, the first failure will immediately break the validation.

I'm guessing that a false-negative would also be reported if there were violations found before the sh:or constraint. Thus, any dismissible error from one of the constituents will reach the allowed max and prevent remaining alternatives from being checked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions