START n = node(38292)
MATCH n - [rel_0?:CAN_READ] -> node_0,
n - [rel_1?:CAN_READ] -> node_1,
n - [rel_2?:CAN_READ] -> node_2,
n - [rel_3?:CAN_WRITE] -> node_3,
n - [rel_4?:CAN_WRITE] -> node_4,
n - [rel_5?:CAN_WRITE] -> node_5,
n - [rel_6?:MODULE_TAG] -> node_6,
n - [rel_7?:DUMMY_EDGE] -> node_7,
n - [rel_8?:ANOTHER_DUMMY_EDGE] -> node_8,
n - [rel_9?:IN_QUEUE] -> node_9,
n <- [rel_10?:MODULE_PARENT] - node_10,
n <- [rel_11?:TO_MODULE] - node_11,
n <- [rel_12?:BUILT] - node_12,
n <- [rel_13?:ACCESS_TO] - node_13,
n <- [rel_14?:ACCESS_TO] - node_14
SET n.relationships = '[[CAN_READ, '+COALESCE(ID(node_0), '-1')+', {}] [CAN_READ, '+COALESCE(ID(node_1), '-1')+', {}] [CAN_READ, '+COALESCE(ID(node_2), '-1')+', {}] [CAN_WRITE, '+COALESCE(ID(node_3), '-1')+', {}] [CAN_WRITE, '+COALESCE(ID(node_4), '-1')+', {}] [CAN_WRITE, '+COALESCE(ID(node_5), '-1')+', {}] [MODULE_TAG, '+COALESCE(ID(node_6), '-1')+', {title:'+COALESCE(STR(rel_6.title), "''") +' }] [DUMMY_EDGE, '+COALESCE(ID(node_7), '-1')+', {p1:'+COALESCE(STR(rel_7.p1), "''") +' p2:'+COALESCE(STR(rel_7.p2), "''") +' }] [ANOTHER_DUMMY_EDGE, '+COALESCE(ID(node_8), '-1')+', {p3:'+COALESCE(STR(rel_8.p3), "''") +' p4:'+COALESCE(STR(rel_8.p4), "''") +' }] [IN_QUEUE, '+COALESCE(ID(node_9), '-1')+', {id:'+COALESCE(STR(rel_9.id), "''") +' date_added:'+COALESCE(STR(rel_9.date_added), "''") +' date_viewed:'+COALESCE(STR(rel_9.date_viewed), "''") +' display_order:'+COALESCE(STR(rel_9.display_order), "''") +' }] [MODULE_PARENT, '+COALESCE(ID(node_10), '-1')+', {display_order:'+COALESCE(STR(rel_10.display_order), "''") +' }] [TO_MODULE, '+COALESCE(ID(node_11), '-1')+', {}] [BUILT, '+COALESCE(ID(node_12), '-1')+', {}] [ACCESS_TO, '+COALESCE(ID(node_13), '-1')+', {}] [ACCESS_TO, '+COALESCE(ID(node_14), '-1')+', {}]]'
说明:
此查询从单个节点开始,遍历其关系并将另一端的id存储为此节点的属性。
例如,如果具有ID 1
,2
,3
,4
,
1-[:A]->2
1-[:B]->3
1-[:C]->4
然后1.relationships
将设置为[[A, 2], [B, 3], [C, 4]]
它在结构上是一个非常简单的查询,但是第一次,它需要大约8秒,随后,它的快速(~100ms)