Can Neo4j return additional property maps -


i using cypher rest api manually this.

i return data in way easy parse.

here's example of data same sort of relationships i'm dealing with:

(me:person:normal), (dad:person:geezer), (brother:person:punk), (niece:person:tolerable), (daughter:person:awesome), (candy:rule), (tv:rule), (dad)-[:has_child {num:1}]->(brother), (dad)-[:has_child {num:2}]->(me), (me)-[:has_child {num:1}]->(daughter), (brother)-[:has_child {num:1}]->(niece), (me)-[:allows]->(candy), (me)-[:allows]->(tv) 

i want of has_child relationships , if of child nodes have :allows relationships want ids of too.

so if like...

start n=node({idofdad}) match n-[r?:has_child]->h-[?:allows]->allowed     n, r, h, collect(id(allowed)) allowedids     n, r,          case              when h not null [id(h), labels(h), r.num?, allowedids]              else null              end has return     labels(n) labels,     id(n) id,     n node,     collect(has) children; 

the :has_child may not exist, have wierd case thing.

the data comes 'ok' json mapper have (newtonsoft) doesn't make easy map array object (meaning know array index[0] id of (children) collections.

the results of above this: { "columns": ["labels", "id", "node", "children"], "data": [ ["person", "geezer"], 6, {}, [ [7, ["person", "normal"], 2, [2, 1]], [5, ["person", "punk"], 1, []] ] ] }

since more/less document , it'd easier map 'children' column i'd looks this:

{   "columns": ["labels", "id", "node", "children"],    "data": [     ["person", "geezer"],     6,     {},     [      [        "id": 7,         "labels": ["person", "normal"],         "childnumber": 2,         "allowedids": [2, 1]      },      {        "id": 5,         "labels": ["person", "punk"],         "childnumber": 1,         "allowedids": []      }     ]   ]  } 

i expect query like:

start n=node({idofdad}) match n-[r?:has_child]->h-[?:allows]->allowed     n, r, h, collect(id(allowed)) allowedids     n, r,          case              when h not null                 { id: id(h), labels: labels(h), childnumber: r.num?, allowedids: allowedids }             else null              end has return     labels(n) labels,     id(n) id,     n node,     collect(has) children; 

is remotely possible?


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -