Query for arranging the nodes by input Hierarchy nodes

browser
cypher
knowledge-base

(Sucheta) #1

Hi,

I want to create a hierarchial graph when i select one .i.e. single values from every relationship. (this is the way i created my UI , where i select one node from every relationship and frame a query ).

The query looks like -

Match (n) OPTIONAL MATCH (n)-[r:Department]-(m),(q)-[a:API]-(b:" +this.FirstValue+ ")
, (s)-[c:Method]-(d:" + this.secondValue + "), (t)-[e:Parameter]-(f:" + this.thirdValue+ ")"+
" RETURN n,r,m,q,a,b,s,c,d,t,e,f;

The final query looks like -

Match (n) OPTIONAL MATCH (n)-[r:Department]-(m), (q:claimintimation)-[a:API]->(b) , (s:post)-[c:Method]->(d), (t:emailAddress)-[e:Parameter]->(f) RETURN q,a,s,c,t,e,n,m,r ;

Unfortunately, the output is the entire graph.

I even tried -

Match (n) OPTIONAL MATCH (n)-[r:Department]-(m:claimintimation), (q:claimintimation)-[a:API]->(b:postClai) , (s:postClai)-[c:Method]->(d:emailAddress), (t:emailAddress)-[e:Parameter]->(f) RETURN q,a,s,c,t,e,n,m,r

But the output is again the entire graph.

How do i make a graph out of the only selective nodes and show its hierarchy


Know more on Intersection Cyphers