neosemantics icon indicating copy to clipboard operation
neosemantics copied to clipboard

SHACL - validate nodes have 1 class A and 1 class B via same predicate

Open JasonPad19 opened this issue 2 years ago • 0 comments

Hi

I am trying to write a SHACL script to make sure all nodes have 1 class A and 1 class B via predicate isClassifiedBy.

Data Example:

Product -> isClassifiedBy -> ClassA

Product -> isClassifiedBy -> ClassB

But looks like Neosemantics doesn't support sh:qualifiedValueShape. (see w3c example) ex:HandShape a sh:NodeShape ; sh:targetClass ex:Hand ; sh:property [ sh:path ex:digit ; sh:maxCount 5 ; ] ; sh:property [ sh:path ex:digit ; sh:qualifiedValueShape [ sh:class ex:Thumb ] ; sh:qualifiedValueShapesDisjoint true ; sh:qualifiedMinCount 1 ; sh:qualifiedMaxCount 1 ; ] ; sh:property [ sh:path ex:digit ; sh:qualifiedValueShape [ sh:class ex:Finger ] ; sh:qualifiedValueShapesDisjoint true ; sh:qualifiedMinCount 4 ; sh:qualifiedMaxCount 4 ; ] .

In order to achieve the similar purpose, would you please help to suggest any workaround please?

The current script is below:

call n10s.validation.shacl.import.inline('

@prefix neo4j: neo4j://graph.schema# . @prefix sh: http://www.w3.org/ns/shacl# .

neo4j:ProductShape a sh:NodeShape ; sh:targetClass neo4j:Product; sh:property [ sh:path neo4j:isClassifiedBy ; sh:class neo4j:ClassA ; ]; sh:property [ sh:path neo4j:isClassifiedBy ; sh:class neo4j:ClassB ; ] . ','Turtle')

Thanks for your help.

JasonPad19 avatar Aug 30 '22 10:08 JasonPad19