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