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.

Cypher pattern start node is in list

Using the default movies graph I want to compute:

MATCH p=(n:Movie {title:  ["The Matrix Reloaded", "The Devil's Advocate"]})-[*]-() 
RETURN p 
LIMIT 25

However, I am not sure how to specify the title is in list operation.

Potentially: apoc.coll.contains(coll, value) is useful? Lists - Neo4j Cypher Manual also mentions a pattern comprehension, but so far it is unclear for me how to apply the is in list operation.

1 ACCEPTED SOLUTION

Hello @georg.kf.heiler

MATCH (n:Movie)
WHERE n.title IN ["The Matrix Reloaded", "The Devil's Advocate"]
WITH n
MATCH p=(n)-[*]-()
RETURN p
LIMIT 25

Regards,
Cobra

View solution in original post

2 REPLIES 2

MATCH p=(n:Movie)-[*]-() 
WHERE ANY(item IN ["The Matrix Reloaded", "The Devil's Advocate"] WHERE item = n.title)
RETURN p 
LIMIT 25

seems to be possible - but really slow.

Basically I want to have an all shortest paths - but the start point is a move from the list - however, the destination/end point must be a wildcard.

Hello @georg.kf.heiler

MATCH (n:Movie)
WHERE n.title IN ["The Matrix Reloaded", "The Devil's Advocate"]
WITH n
MATCH p=(n)-[*]-()
RETURN p
LIMIT 25

Regards,
Cobra