如何在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屋!
查看全文