neosemantics icon indicating copy to clipboard operation
neosemantics copied to clipboard

SHACL incomming relation validation

Open PaulBazin opened this issue 2 years ago • 1 comments

Hello,

I try to use shacl validation with neosemantics. In particular I want to validate that a node have an incomming relationship with another node. So I try to use "inversePath" ( https://www.w3.org/TR/shacl/#property-path-inverse ) : neo4j:MyShape a sh:NodeShape ; sh:targetClass neo4j:MyNodeLabel sh:property [ sh:inversePath neo4j:instance ; sh:class neo4j:LinkedNodeLabel ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;

Using n10s.validation.shacl.import.inline, it end up creating no constraint.

Looking in the code I found two things :

  • For the capture : it seems that neosemantics looks for "invPath" and not "inversePath". https://github.com/neo4j-labs/neosemantics/blob/12dc7fe32cf4b118514c32db0b021cd0d74fd9ba/src/main/java/n10s/validation/SHACLValidator.java#L678
  • For the constraint creation there is a comment, is that the origine of the problem ? https://github.com/neo4j-labs/neosemantics/blob/12dc7fe32cf4b118514c32db0b021cd0d74fd9ba/src/main/java/n10s/validation/SHACLValidator.java#L427

Thank you in advance for your help.

PaulBazin avatar Jun 01 '22 14:06 PaulBazin

If I remember correctly support for inversePath was added after the latest release, so you can either build from source or wait for the next release (due very soon).

Note: The invPath refers to the variable binding in the SPARQL query not the actual shacl:inversePath (check line 57 in the same file)

jbarrasa avatar Jun 03 '22 14:06 jbarrasa