Neo4j Cypher迭代收集,提取和升级文本

时间:2017-12-19 17:16:16

标签: neo4j cypher

Heallo 我有关于存储已实现的逻辑信息流的关系(技术信息流)的集合属性:

SrcApp1 - EntityA - TrgtApp2, 
SrcApp2 - EntityA - TrgtApp3,
SrcApp3 - EntityB - TrgtApp4 

我想更新集合以仅存储实体:

EntityA,
EntityB

Psydo cypher查询:

MATCH (a)-[r]->(b)
For each oldDesc in r.DescriptionSet
newDesc = Split(oldDesc," - ")[1] //get the middle value out of SrcApp1 - EntityA - TrgtApp2
r.DescriptionSetNew.Add(newDesc) 
Next oldDesc

谢谢和最好的问候

1 个答案:

答案 0 :(得分:0)

这应该有效:

MATCH (a)-[r]->(b)
SET r.fooNew = [d IN r.foo | SPLIT(d, " - ")[1]]
DELETE r.foo;