Neo4j Cypher迭代收集,提取和更新文本

问题描述 投票:-2回答:1

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

谢谢和最好的问候

neo4j cypher
1个回答
0
投票

这应该工作:

MATCH (a)-[r]->(b)
SET r.fooNew = [d IN r.foo | SPLIT(d, " - ")[1]]
DELETE r.foo;
© www.soinside.com 2019 - 2024. All rights reserved.