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.

How to search up a tree and stopping on first match

In the case where I have:
Organisation -> ORG_CHILD -> Organisation
Organisation -> ORGANISATION_ROLE-> User
ORGANISATION_ROLE -> ROLE_IN_ORG -> Role

I want to find users with a role from a set of roles for an organization and if not present then in the parent and up the tree.

How do I search for the roles in specific priority order?

Say I have ADMINISTRATOR and OWNER I would want to find ADMINISTRATOR over OWNER
If not found at the starting node I want to repeat on the parent.

I'm using Spring Data Neo4J 5.1.9 with OGM 3.1.11

1 REPLY 1

Are each of those labels for nodes, or are some of those relationships?

If some of these are relationships, can you use the Cypher syntax for this to avoid confusion? Such as:

(:Organization)-[:ORG_CHILD]->(:Organization)