neo4j - How do I return the count of multiple relationship types with one query? -
i need stats node based on relationships. example, if had node "celebrity" 3 types of relationships: fan_of, friend_of, , relative_of how can number of fans, friends, , relatives 1 query? know how each relationship type individually, need return them in 1 query.
if understand question is, should close:
start n=node(*) match n-[r]->m return n, type(r), count(m)
you restrict matching relationships types (though none of these exist in sample):
start n=node(*) match n-[r:fan_of|friend_of|relative_of]->m return n, type(r), count(m)
check out , play around here: http://console.neo4j.org/?id=nbba2s
Comments
Post a Comment