Laurence Foley created JENA-1891:
------------------------------------

             Summary: Shacl MinLength and MaxLength constraints have opposite 
resultMessage values
                 Key: JENA-1891
                 URL: https://issues.apache.org/jira/browse/JENA-1891
             Project: Apache Jena
          Issue Type: Bug
          Components: SHACL
            Reporter: Laurence Foley


While using {{Jena}} {{SHACL}} validation, I see that the {{resultMessage}} 
produced for 
[{{StrMinLengthConstraint}}|https://github.com/apache/jena/blob/master/jena-shacl/src/main/java/org/apache/jena/shacl/engine/constraint/StrMinLengthConstraint.java#L48]
 and 
[{{StrMaxLengthConstraint}}|https://github.com/apache/jena/blob/master/jena-shacl/src/main/java/org/apache/jena/shacl/engine/constraint/StrMaxLengthConstraint.java#L48]
 are reversed:
{noformat}
@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
] .
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to