I'm new to NEO4J and I need help on a specific problem. Or an answer if it's even possible.
SETUP: We have 2 distinct type of nodes: users (A,B,C,D) and Products (1,2,3,4,5,6,7,8) Next we have 2 distinct type of relationships between users and products where a users WANTS a Product and where a product is OWNED BY a user.
- 1,2 is owned by A
- 3,4 is owned by B
- 5,6 is owned by C
- 7,8 is owned by D
Now
- B wants 1
- C wants 3
- D wants 5
So for now, I have no problems and I created the graph data with no difficulty. My questions starts here. We have a circle, when A wants product 8.
A-[:WANTS]->8-[:OWNEDBY]->D-[:WANTS]->5-[:OWNEDBY]->C-[:WANTS]->3-[:OWNEDBY]->B-[:WANTS]->1-[:OWNEDBY]->A
So we have a distinct pattern, U-[:WANTS]->P-[:OWNEDBY]->U
Now what I want to do is to find the paths toward the start node (initiating user that wants a product) following that pattern. How do I define this using Cypher? Or do I need another way?
Thanks upfront.
from-[:LINE|ARROW*]-to
. It's in the docs: docs.neo4j.org/chunked/milestone/… – ean5533