Reputation: 21
What is the proper way of getting node labels with OR syntax? For example:
CREATE (n:BMW:Bike {model:"C 600 Sport"});
CREATE (n:BMW:Car {model:"X3"});
CREATE (n:Honda:Bike {model:"Crossrunner"});
CREATE (n:Honda:Car {model:"Accord"});
Now, if we want to get all BMW Bikes (BMW AND Bike), then the following works:
MATCH n:BMW:Bike RETURN n;
But, if we want to get all Bikes OR Cars, what would be the proper syntax? The following does not seem to work:
MATCH n[:Bike|:Car] RETURN n;
Thanks in advance for your answer.
Upvotes: 0
Views: 47
Reputation: 80176
You can filter on Labels. Below is what you need
START a=node(*)
WHERE a:Bike OR a:Car
RETURN a
Upvotes: 1