Reputation: 81
I have a Neo4j graph that looks like this:
How do I write my Cypher query so that I return all persons who are only part of this combination of groups (Ethnicity & Age). The query should result in 4 Person nodes, Bob, John, Carl, and Dan. Brian is part of only one of these groups (age) so he needs to be excluded.
Thanks in advance.
Upvotes: 0
Views: 604
Reputation: 5385
This MATCH returns the person name and the names of their categories for those who have both.
MATCH (e:Group {name:'Ethnicity'})-->(ec:Category)-->(p:Person)<--(ac:Category)<--(a:Group {name:'Age'})
RETURN p.name,ac.name,ec.name
Upvotes: 2