如何在Neo4j-Cypher中更改/更新标签? [英] How to change/update a label in Neo4j - Cypher?

查看:832
本文介绍了如何在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆