Reputation: 10531
Let's say I have three nodes: Product, Attributes, ExtraAttributes:
MATCH (p:Product {type:'TV'})-[r:HAS_ATTRIBUTES]->(a:Attributes {color:'red'})
I want to find TVs with color = red. However, the 'color' attribute may also be stored in the ExtraAttributes node depending on different types of products. So I need to also have a query below to search the possibilities of color in the ExtraAttributes node:
MATCH (p:Product {type:'TV'})-[r:HAS_EXTRA_ATTRIBUTES]->(a:ExtraAttributes {color:'red'})
How to express this logic on one query?
Upvotes: 1
Views: 54
Reputation: 66999
This should work:
MATCH (p:Product {type:'TV'})
WHERE (p)-[:HAS_ATTRIBUTES|HAS_EXTRA_ATTRIBUTES]->({color:'red'})
...
Upvotes: 2