I am using neo4j, I have nodes with two properties: name and id. I have an index on id.
I have relationships “CALL” with a property: “by_test”. This property can take different value (id of any node).
Two nodes can have multiple CALL relationships with different by_test property value.
So let’s say I have 1..N nodes linked by the same CALL.by_test property value.
Node1 -> Node2 -> Node3 -> .. -> Node N
-
How can I get all these nodes?
-
Do I need to put an Index on the relationship?
-
Do I have to create dynamic relationship? Instead of CALL.by_test=value, use value has a relationship.
-
Thanks!
Using Cypher, you could query for that list like this:
In the
MATCHyou bind a termrto theCALLrelationships, which you then use in theWHEREclause to check theby_testproperty of each.As Michael Hunger noted, the
ris a collection of relationships, so theWHEREneeds to useALLto check each of the relationships.