我想获得以这种方式解析的结果:
{ 'nodes' : [ key : { 'property' : ... }, ... # data about nodes ]
, 'paths' : [ { .. }, {...} # here go the data about relationships ] }
也就是说,我想:
如果可能,还要将结果格式化为:
我试过了:
MATCH (d:Label_1)-[r:Rel_type]-(t:Label_2)
where d.uid = '""" + uid + """'
with d, r, t
# how to evaluate d.uid as variable?
# Return d.uid
#
# collating nodes and paths ?
# Return [d, t] as nodes, [d, r, t] as paths
# Return collect([d, t]) as nodes, [d, r, t] as paths
但它做得不对。 我发现了两个问题:
答案 0 :(得分:0)
查看apoc procedure library,它允许您以编程方式构建地图。使用普通密码,您只能使用固定键作为地图键。
这样的事情应该有效。
MATCH (n:Label)
WITH collect([n.key, properties(n)]) as data
RETURN {'nodes' : apoc.map.fromPairs(data) }