配置apoc.refactor.MergeNodes()

时间:2018-04-02 19:30:46

标签: neo4j cypher neo4j-apoc

我在这个设置上测试了apoc程序:

CREATE (:testNode{id:"1"})-[:TAGS{id:"r1"}]->(:tag{id:"h"})
CREATE (:testNode{id:"2"})-[:TAGS{id:"r2"}]->(:tag{id:"H"})

然后运行这个:

MATCH (htag:tag), (gtag:tag)
WHERE htag.id=toLower(gtag.id) AND htag<>gtag
WITH htag, gtag LIMIT 1
CALL apoc.refactor.mergeNodes([htag, gtag], {id:'discard'}) YIELD node
RETURN node

根据我的理解, {id:&#39; discard&#39;} 应该表示如果 htag.id 存在,它将被保留, gtag.id 将被抛弃。相反,它似乎保持 gtag.id

我误解了什么?

1 个答案:

答案 0 :(得分:1)

您错误地填写了配置:

CALL apoc.refactor.mergeNodes([htag, gtag], {properties: {id:'discard'}}) YIELD node

[https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_merging_nodes]