Reputation: 183
I want to make a cypher query which includes two alternative types, but one of it is directed and one isn't. Is there a simple way to express this in cypher?
e.g. a -INHERITANCE-> b (directed)
x -EQUIVALENT- y (undirected)
Give me all nodes which n inherits or is equal to.
MATCH (n)-[INHERITANCE|EQUIVALENT *]-(n2) doesn't consider the directed characteristic of INHERITANCE
Upvotes: 2
Views: 444
Reputation: 39925
Basically I see two approaches to that:
UNION
statement and join the results of the two matches .
MATCH (a)-[r:INHERTIANCE|:EQUIVALENT]-(b)
WHERE type(r)="EQUIVALENT" OR endNode(r)=b
...
Just symbolic code above, have not tested it.
Upvotes: 3