Reputation: 440
I am new to Neo4j and trying some queries on the movie database example. I want to find all actor and movie combinations where the role name contains the word "Joe". How do I do this ?
I am able to do a query when I know the complete role name e.g. Joe Banks. The query I used for that is -
MATCH (p:Person)-[r:ACTED_IN]-(movie:Movie)
WHERE 'Joe Banks' in (r.roles)
RETURN p,movie,r.roles;
Upvotes: 0
Views: 92
Reputation: 8546
Use the list predicate function any
:
MATCH (m:Movie)<-[r:ACTED_IN]-(a:Person)
WHERE any(role in r.roles WHERE role CONTAINS "Joe")
RETURN m,r,a
Edit
For case insensitive string comparison you can use the toLower
function:
MATCH (m:Movie)<-[r:ACTED_IN]-(a:Person)
WHERE any(role in r.roles WHERE toLower(role) CONTAINS toLower("joe"))
RETURN m,r,a
Upvotes: 2