HOW TO fetch nodes with multiple edge type as starting point

36 views Asked by At

Below is my dataset:

MERGE (pNode:product_sku {model_id: 1})
MERGE (f1:formula {model_id: 1})
MERGE (f2:formula {model_id: 2})
MERGE (f3:formula {model_id: 3})
MERGE (f4:formula {model_id: 4})
MERGE (f5:formula {model_id: 5})

MERGE (pNode)-[:has]->(f1)
MERGE (pNode)-[:influences]->(f2)
MERGE (pNode)-[:influences {simulation_id: 1}]->(f3)
MERGE (f1)-[:influences]->(f4)
MERGE (f4)-[:influences]->(f5)

I want to be able to fetch f4, f5, and f2 from f1 node.

this is my query so far:

MATCH (node1:formula {model_id: 1})-[edge1:influences* (r, n | r.simulation_id IS NULL)]->(n:formula) RETURN DISTINCT n

with my query above i am able to fetch f4 and f5 but i want to fetch f2 also from pNode

0

There are 0 answers