Getting count of branch node of multiple root nodes in Neo4J using Cypher Query -


enter image description here

as shown in image,
3 root node - a,b,c - likewise d,e,f etc
6 branch node - a1,a2,a3,b1,b2,c1
want count of branch nodes related root node.

so used

match (b:branch)-[:branch_of]-(r:root {root:'a'}) return count(b)  

it works single root, want multiple root- used

match (r:root),(b:branch),(b)-[:branch_of]-(r {root:'a'},{root:'b'},{root:'c'}) return count(b)  

but not working -how implement this?

i think closer want. every root (that has 'root' property value in 'roots' parameter array), count of number of branches.

by way, should indicate directionality of relationships in query. can make things faster.

match (b:branch)-[:branch_of]-(r:root) r.root in {roots} return r, count(b) 

so, if cared roots "a" , "b", you'd specify parameter this:

{   "roots": ['a', 'b'] } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -