Reputation: 141
I try to validate the following triple
@prefix atold: <http://publications.europa.eu/resource/authority/> .
.....
:property dct:language <http://publications.europa.eu/resource/authority/language/DEU>
with the following rule:
sh:LanguageProp
a sh:PropertyShape ;
sh:path dct:language ;
sh:property [
sh:hasValue <http://publications.europa.eu/resource/authority/language> ;
sh:nodeKind sh:IRI ;
sh:path skos:inScheme
] ;
sh:nodeKind sh:IRI ;
sh:minCount 1 .
All needed ontologies have been loaded but I get the following result in pyShacl:
Constraint Violation in HasValueConstraintComponent (http://www.w3.org/ns/shacl#HasValueConstraintComponent): Severity: sh:Violation Source Shape: [ sh:hasValue atold:language ; sh:nodeKind sh:IRI ; sh:path skos:inScheme ] Focus Node: http://publications.europa.eu/resource/authority/language/DEU Result Path: skos:inScheme Message: Node http://publications.europa.eu/resource/authority/language/DEU->skos:inScheme does not contain a value in the set: ['http://publications.europa.eu/resource/authority/language']
in http://publications.europa.eu/resource/authority/language/DEU there is
<skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/language"/>
The same input does validate with Apache Jena, so i'm wondering what is going on...
Upvotes: 0
Views: 47
Reputation: 36
I am guessing the problem is with the sh:property
constraint with sh:hasValue
might be causing issues due to how pySHACL interprets the path. Specifically, the error message indicates that the expected value in the set does not match what pySHACL finds.
Maybe rearranging and revising might be the solution :
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dct: <http://purl.org/dc/terms/> .
sh:LanguageProp
a sh:PropertyShape ;
sh:path dct:language ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:property [
sh:path skos:inScheme ;
sh:hasValue <http://publications.europa.eu/resource/authority/language> ;
sh:nodeKind sh:IRI ;
] .
Please try it out and let me know.
PS: The issue you are facing with pySHACL could maybe also related to how pySHACL interprets the RDF graph, including how it handles blank nodes and the isomorphic checks. pySHACL uses isomorphic graph matching to compare the validation results against expected results, which can sometimes lead to discrepancies if the graph structure or namespaces are not handled as expected.
Upvotes: 0