Reputation: 127
I have the following query
MATCH (wallstreet { title:'Wall Street' })<-[r:ACTED_IN|DIRECTED]-(person)
RETURN person
I need to
apply a filter on ACTED_IN
and DIRECTED
separately.
a path could contain ACTED_IN
twice. I may need to apply two conditions with OR
or AND
.
apply INCOMING and OUTGOING and BOTH separately for ACTED_IN and DIRECTED
Can any body provide the cypher query that satisfies the above three requirements?
MATCH (wallstreet { title:'Wall Street' })<-[r:ACTED_IN{Name:"Titanic"}|r1:DIRECTED{Name:"iceage1"}|r1:DIRECTED{Name:"Iceage2"}]-(person)
RETURN person
IF you observe the Psedo code , I have changed only relationship part .I added Three relationships in which TWO are of same type.I added filter properties for each relationships in relationship part.
Upvotes: 1
Views: 1929
Reputation: 67044
This might be close to what you are looking for. I assume that movie titles are stored in movie nodes, not in relationships:
MATCH ({title:'Wall Street'})<-[:ACTED_IN|DIRECTED]-(person)-[r:ACTED_IN|DIRECTED]->(other)
WHERE
(TYPE(r) = 'ACTED_IN' AND other.title = 'Titanic') OR
(TYPE(r) = 'DIRECTED' AND other.title IN ['Ice Age 1', 'Ice Age 2'])
RETURN person;
The query finds all people who acted in or directed "Wall Street" who also acted in "Titanic" or directed either of the first 2 "Ice Age" movies.
Upvotes: 2