I am trying to analyse and validate a set of RDF data with SHACL.
Now I have the following setup:
CALL n10s.graphconfig.init({handleVocabUris: "IGNORE"})
WITH '
<http://my.data.com/SUB123> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://my.ont.com/def/comp#Person> .
<http://my.data.com/SUB123> <http://my.ont.com/def/comp#firstName> "John"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://my.data.com/SUB123> <http://my.ont.com/def/comp#lastName> "Doe"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://my.data.com/SUB456> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://my.ont.com/def/comp#Teacher> .
<http://my.data.com/SUB456> <http://my.ont.com/def/comp#description> "Teacher"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://my.data.com/SUB123> <http://my.ont.com/def/comp#hasProfession> <http://my.data.com/SUB456> .
' as payload
CALL n10s.rdf.import.inline(payload,"N-Triples") YIELD terminationStatus, triplesLoaded
RETURN terminationStatus, triplesLoaded
CALL n10s.onto.import.inline("<http://my.ont.com/def/comp#Teacher> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://my.ont.com/def/comp#Profession> .","N-Triples");
CALL n10s.validation.shacl.import.inline('
@prefix neo4j: <neo4j://graph.schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
neo4j:PersonShape a sh:NodeShape ;
sh:targetClass neo4j:Person ;
sh:property [
sh:path neo4j:firstName ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path neo4j:hasProfession ;
sh:maxCount 1 ;
sh:class neo4j:Profession ;
sh:nodeKind sh:IRI ;
] ;
.
','Turtle')
CALL n10s.validation.shacl.validate() yield focusNode, nodeType,propertyShape,offendingValue,resultPath,severity
with *
return *
The Person node has a hasProfession-relation with the Teacher node.
Teacher is a subclass of Profession.
My SHACL defines that a Person may have max 1 hasProfession relation to a node with the Profession-class.
The validation now fails with a ClassConstraintComponent-Violation, because it does not see the subclass-information from the ontology.
Is there a way to get this working?