Skip to content
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

maxErrors = 1 breaks sh:or constraint #88

Open
tpluscode opened this issue Jan 27, 2022 · 0 comments
Open

maxErrors = 1 breaks sh:or constraint #88

tpluscode opened this issue Jan 27, 2022 · 0 comments

Comments

@tpluscode
Copy link
Collaborator

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.

tpluscode added a commit to zazuko/cube-creator that referenced this issue Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant