cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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

027Lanto
Node

Hi 

A bit confused, and need some help here.  Followed @jbarrasa  youtube video.

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 or, and, xone etc at the moment. 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')
 
 
 
#Neosemantics #SHACL
1 REPLY 1

I found this in w3c SHACL example. That is exactly what i am looking for.  

 

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 ;
	] .

 

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online