Closed rapw3k closed 3 years ago
Actually I downloaded the SHACL API directly and use it, so its the same issue:
RAPMAC-3:SHACL rap$ /Users/rap/Downloads/shacl-1.3.2/bin/shaclvalidate.sh -datafile /Users/rap/Downloads/pilot5.2-afc-observation-point-simplified3.ttl -shapesfile demeterAgriProfile-SHACL-test.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ns0: <http://www.opengis.net/ont/geosparql#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns1: <http://qudt.org/schema/qudt/> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix dc: <http://purl.org/dc/terms/> .
[ a <http://www.w3.org/ns/shacl#ValidationReport> ;
<http://www.w3.org/ns/shacl#conforms>
false ;
<http://www.w3.org/ns/shacl#result>
[ a <http://www.w3.org/ns/shacl#ValidationResult> ;
<http://www.w3.org/ns/shacl#focusNode>
<http://www.w3id.org/afarcloud/poi?lat=45.75&long=4.85> ;
<http://www.w3.org/ns/shacl#resultMessage>
"Value must be an instance of geo:Geometry" ;
<http://www.w3.org/ns/shacl#resultPath>
ns0:hasGeometry ;
<http://www.w3.org/ns/shacl#resultSeverity>
<http://www.w3.org/ns/shacl#Violation> ;
<http://www.w3.org/ns/shacl#sourceConstraintComponent>
<http://www.w3.org/ns/shacl#ClassConstraintComponent> ;
<http://www.w3.org/ns/shacl#sourceShape>
<https://astrea.linkeddata.es/shapes#3f6891594ac2d163a004bec00f8db48a> ;
<http://www.w3.org/ns/shacl#value>
<http://www.w3id.org/afarcloud/pCoord?lat=45.75&long=4.85>
]
] .
There is nothing wrong in the implementation. sh:class has been used many times. It must be something about the way you declare (or not) the rdfs:subClassOf triples in the data graph. The command line tool doesn't follow owl:imports. If you send me the Turtle file including the subClassOf triple then I can have a look.
BTW I looked at the shapes graph and it in itself has many violations, e.g. using xsd:int instead of xsd:integer for sh:minCount.
Sure, the ttl is available via https://box.psnc.pl/f/93e08dcd44/?raw=1 (copied below too).
About violations in shape, like xsd:int, I would have to check with the generator tool authors.... thx
@prefix ns0: <http://www.opengis.net/ont/geosparql#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix ns1: <http://qudt.org/schema/qudt/> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@base <https://w3id.org/demeter/example> .
<https://w3id.org/demeter/example>
owl:imports <https://w3id.org/demeter/crossDomain> .
<http://www.w3id.org/afarcloud/pCoord?lat=45.75&long=4.85>
ns0:asWKT "POINT(45.75 4.85)"^^ns0:wktLiteral ;
a <http://www.opengis.net/ont/sf#Point> .
<http://www.w3id.org/afarcloud/poi?lat=45.75&long=4.85>
ns0:hasGeometry <http://www.w3id.org/afarcloud/pCoord?lat=45.75&long=4.85> ;
a ns0:Feature .
<urn:afc:AS09:cropsManagement:TEC:soil:sen0022> a <https://json-ld.org/playground/AfarcloudSensors>, <https://json-ld.org/playground/SoilSensor> .
<urn:afc:AS09:sen0022:obs-1514810172/q1>
dc:identifier "q1" ;
ns1:numericValue "0.27121272683143616" ;
ns1:unit <http://qudt.org/vocab/unit/DEG_C> ;
a ns1:QuantityValue .
<urn:afc:AS09:sen0022:obs-1514810172>
a sosa:Observation ;
sosa:hasFeatureOfInterest <http://www.w3id.org/afarcloud/poi?lat=45.75&long=4.85> ;
sosa:hasResult <urn:afc:AS09:sen0022:obs-1514810172/q1> ;
sosa:madeBySensor <urn:afc:AS09:cropsManagement:TEC:soil:sen0022> ;
sosa:observedProperty <http://www.w3id.org/afarcloud/soil_temperature> ;
sosa:resultTime "2018-01-01T12:36:12Z"^^xsd:dateTime .
When I tried this (from TBC to resolve imports) it could not find the owl:import. Instead I had to use owl:imports https://raw.githubusercontent.com/rapw3k/DEMETER/master/models/cross-domain.ttl which then correctly finds the subClassOf triple.
thanks @HolgerKnublauch yes, it works with the imports using the file directly (so no redirection is supported). Adding such imports in data graph is not really practical, though, specially as we work with jsonld, and we have a network of ontologies designed modularly (so multiple 2 or 3 levels of imports).
It would be much better if such imports could be added to the shape. I tried, though, and didnt work for me. Would this work for you?
No this is not how SHACL sh:class works. The subclass triples need to be in the data graph. If you want to avoid the owl:import you could programmatically create the union graph that includes the extra subgraph in Java code.
ok, clear how it work thanks!
Hi, Following on issue: https://github.com/TopQuadrant/shacl/issues/108 I forgot to mention that I am using also Astrea service https://astrea.linkeddata.es/swagger-ui.html#/validation-api/validationWithShapeURLUsingPOST You can try with { "coverage": true, "dataFormat": "JSON-LD", "dataURL": "https://box.psnc.pl/f/aa91b173b3/?raw=1", "shapeFormat": "Turtle", "shapeURL": "https://raw.githubusercontent.com/rapw3k/DEMETER/master/models/SHACL/demeterAgriProfile-SHACL.ttl" }
which according to authors (one of the Alba Fernandez Izquierdo), it uses TopBraid SHACL API for the validation. Is this something you consider to address here or not?