Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1891

Shacl MinLength and MaxLength constraints have opposite resultMessage values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • Jena 3.15.0
    • SHACL
    • None

    Description

      While using Jena SHACL validation, I see that the resultMessage produced for StrMinLengthConstraint and StrMaxLengthConstraint are reversed:

      @prefix fld:   <https://api.mysite.com/fields/> .
      @prefix sh:    <http://www.w3.org/ns/shacl#> .
      
      [ a                             sh:ValidationResult ;
        sh:focusNode                  <https://api.mysite.com/datasets/dataset/snapshots/126/records/271> ;
        sh:resultMessage              "MinLengthConstraint[5]: String too long: 0" ;
        sh:resultPath                 fld:myfield4 ;
        sh:resultSeverity             sh:Violation ;
        sh:sourceConstraintComponent  sh:MinLengthConstraintComponent ;
        sh:sourceShape                <https://api.mysite.com/schemas/myfield4PropertyShape> ;
        sh:value                      "0"^^xsd:token
      ] .
      
      
      [ a                             sh:ValidationResult ;
        sh:focusNode                  <https://api.mysite.com/datasets/dataset/snapshots/126/records/225> ;
        sh:resultMessage              "MaxLengthConstraint[12]: String too short: abcdefghijklm" ;
        sh:resultPath                 fld:myfield8 ;
        sh:resultSeverity             sh:Violation ;
        sh:sourceConstraintComponent  sh:MaxLengthConstraintComponent ;
        sh:sourceShape                <https://api.mysite.com/schemas/myfield8PropertyShape> ;
        sh:value                      "abcdefghijklm"^^xsd:token
      ] .
      

      Attachments

        Activity

          People

            andy Andy Seaborne
            lrncfly Laurence Foley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 10m
                1h 10m