Hi, I would like to return nodes of 3 organizations where.
FirstOrg-[:OWNS]->SecondOrg-[:OWNS]->ThirdOrg.
So returning the name of 1st org, which owns 2nd org, which owns 3th org.
So it would look like that
I tired with this: MATCH(n:Organization)-[:OWNS]->(n1:Organization)-[:OWNS]->(n2:Organization) RETURN n,n1,n2
Although it returns all nodes which are related to FirstOrg, SecondOrg, ThirdOrg. Not only the 'threes' with the pattern i wanted.
The output of the command above, which shows that some grapsh do not match the pattern i wanted:
Hello @amf3tam1nkapvp
Can you try this?
MATCH p=(:Organization)-[:OWNS*3]->(:Organization)
RETURN p
Otherwise, in the Neo4j Desktop parameters, you can also uncheck the setting Connect result nodes
.
Additionally, the displayed result may be different from what is returned since graphical views display each node / relation once. You should check in table to see the "rigth" result.
Regards,
Cobra
1 Like