Yasir,

What is "work" here?

I get 2 violations with Jena 4.3.2 - the same as (current latest) TQ shacl. (1 violation on a quite old, pre 4.x.x version of Jena - which version are you running?)

Which SHACL playground did you use (there are two).

The old (TopQuadrant) SHACL playground returns 2 violations.
The Zazuko one returns 2 violations.

@prefix ex:   <http://www.example.org/#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh:   <http://www.w3.org/ns/shacl#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix yas:  <http://www.semanticweb.org/yas#> .

[ rdf:type     sh:ValidationReport ;
  sh:conforms  false ;
  sh:result    [
      rdf:type                      sh:ValidationResult ;
      sh:focusNode                  yas:Wheel_1 ;
      sh:resultMessage
 "Data value \"600\"^^xsd:float is not less than or equal to 200" ;
      sh:resultPath                 ( yas:hasDiameter yas:hasValue ) ;
      sh:resultSeverity             sh:Violation ;
      sh:sourceConstraintComponent  sh:MaxInclusiveConstraintComponent ;
      sh:sourceShape                []  ;
      sh:value                      "600"^^xsd:float
  ] ;
  sh:result    [
      rdf:type                      sh:ValidationResult ;
      sh:focusNode                  yas:Car_1 ;
      sh:resultMessage
"QualifiedValueShape[1,_,false]: Min = 1 but got 0 validations" ;
      sh:resultPath                 yas:hasComponent ;
      sh:resultSeverity             sh:Violation ;
      sh:sourceConstraintComponent
         sh:QualifiedMinCountConstraintComponent ;
      sh:sourceShape                []
  ]
] .

    Andy

On 26/01/2022 16:38, Alani, Yasir wrote:


From: Alani, Yasir
Sent: 26 January 2022 14:07
To: Andy Seaborne <a...@apache.org>
Subject: Validation issue

Hi, I have a shape that doesn’t seem to work with Jena (always conforms) but 
works when I try it on SHACL Playground.

The shape:
@prefix rdf:   
http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>
 .
@prefix sh:    http://www.w3.org/ns/shacl#<http://www.w3.org/ns/shacl> .
@prefix xsd:   
http://www.w3.org/2001/XMLSchema#<http://www.w3.org/2001/XMLSchema> .
@prefix rdfs:  
http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema> .
@prefix ex:    http://www.example.org/#<http://www.example.org/> .
@prefix owl:   http://www.w3.org/2002/07/owl#<http://www.w3.org/2002/07/owl> .
@prefix yas:   http://www.semanticweb.org/yas#<http://www.semanticweb.org/yas> .

yas:CarShape a sh:NodeShape ;
                sh:targetClass yas:Car ;
sh:property [ sh:path yas:hasComponent ; sh:qualifiedValueShape [ 
sh:targetClass yas:Wheel ; sh:property [ sh:path (yas:hasDiameter yas:hasValue) 
; sh:minInclusive 0 ; sh:maxInclusive 200 ; sh:datatype xsd:float ; ] ; ] ; 
sh:qualifiedMinCount 1 ] .

The data:
@prefix rdf:   
http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>
 .
@prefix sh:    http://www.w3.org/ns/shacl#<http://www.w3.org/ns/shacl> .
@prefix xsd:   
http://www.w3.org/2001/XMLSchema#<http://www.w3.org/2001/XMLSchema> .
@prefix rdfs:  
http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema> .
@prefix ex:    http://www.example.org/#<http://www.example.org/> .
@prefix owl:   http://www.w3.org/2002/07/owl#<http://www.w3.org/2002/07/owl> .
@prefix yas:   http://www.semanticweb.org/yas#<http://www.semanticweb.org/yas> .

yas:Car_1 rdf:type owl:NamedIndividual ,
                            yas:Car ;
                   yas:hasComponent yas:Wheel_1 .

yas:Wheel_1 rdf:type owl:NamedIndividual ,
                             yas:Wheel ;
                    yas:hasDiameter yas:Diameter2 .

yas:Diameter2 rdf:type owl:NamedIndividual ,
                      yas:Diameter ;
             yas:hasValue "600"^^xsd:float .


I am using ShaclValidator method ==> 
validate<https://jena.apache.org/documentation/javadoc/shacl/org.apache.jena.shacl/org/apache/jena/shacl/ShaclValidator.html#validate(org.apache.jena.shacl.Shapes,org.apache.jena.graph.Graph,org.apache.jena.graph.Node)>​(Shapes<https://jena.apache.org/documentation/javadoc/shacl/org.apache.jena.shacl/org/apache/jena/shacl/Shapes.html>
 shapes, 
Graph<https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/graph/Graph.html?is-external=true>
 data, 
Node<https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/graph/Node.html?is-external=true>
 node).

Please advise if you can.
Regards
Yasir


Reply via email to