Reputation: 15090
If
match(d:person)-[r]-(e:person)
and r could be of many types such as KNOWS, FRIEND_OF, LIKES, DISLIKES
and I would like to filter only those relationships of KNOWS
and DISLIKES
, then how should I express this in cypher?
I know that for a single relationship type, it goes like this
match(d:person)-[r:KNOWS]-(e:person)
but I would like to do it for multiple relationship types
Upvotes: 0
Views: 842
Reputation: 5385
You also have
MATCH (d:person)-[r:KNOWS|DISLIKES|RELTYPE3|RELTYPE4]-(e:person)
Upvotes: 2
Reputation: 15090
One can do the following
match(d:person)-[r]-(e:person) where type(r) in ['KNOWS', 'DISLIKES']
Also, watch out for queries like this
match(d:person)-[r]-(e:person) where (d)-[:KNOWS]-(e) or (d)-[:DISLIKES]-(e)
In my experience, these will run for long and potentially blow your neo4j memory
Upvotes: 0