如何更改/更新 Neo4j - Cypher 中的标签? [英] How to change/update a label in Neo4j - Cypher?
本文介绍了如何更改/更新 Neo4j - Cypher 中的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 Cypher 更改节点上的标签?我有一个标签为 Book
的节点,如下所示.我想将 Book
标签更改为 DeletedBook
.
Is it possible to change a label on a node using Cypher?
I have a node with label Book
, as shown below. I want to change the Book
label to DeletedBook
.
(u:Person)-[r]-(b:Book{id:id1})
(u:Person)-[r]-(b:DeletedBook{id:id1})
推荐答案
您可以使用 Book
标签上的 REMOVE
和 SET
在新标签上:
You can do that using REMOVE
on the Book
label and SET
on the new label:
MATCH (p:Person)-[r]-(b:Book {id: id1})
REMOVE b:Book
SET b:DeletedBook
RETURN b
您应该查看 Neo4j Cypher Refcard 以获取对 Cypher 2.x 的完整参考.
You should check out the Neo4j Cypher Refcard for a complete reference to Cypher 2.x.
这篇关于如何更改/更新 Neo4j - Cypher 中的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文