cypher - neo4j return root node once, and all relationships and end-nodes in json -
i'm trying make html view of known node.
so, if select node n
, return n
, i'd json object n: { stuff ... }
, , if return relationships , connected nodes return n,r,n2
, verbose json object:
[ { n: { originating node details }, r: { relationship details }, n2: { connected node details } }, { n: { originating node details }, r: { relationship details }, n2: { connected node details } }, { n: { originating node details }, r: { relationship details }, n2: { connected node details } } ]
where same exact data in n
bunch of times. so, in theory, that'd ok, , var seednodedata = results[0].n
, use way main node data, before separately iterating on objects list out connecting node data. but, seems waste of data transferred.
currently, limit data, return r,n2
since first 1 same, i"d need separate call n
's data.
is there way make 1 call info n
once, , [r]-(n2)
many times necessary , have wrapped 1 cypher query?
you aggregate relationships , relatives collection. work you?
match n-[r]->n2 n, [type(r), n2] relative return { root: n, relatives: collect(relative) }
Comments
Post a Comment