【问题标题】:Add label to existing node with Cypher使用 Cypher 向现有节点添加标签
【发布时间】:2014-03-04 16:58:41
【问题描述】:

如何使用 Cypher 查询向现有节点添加标签?

【问题讨论】:

    标签: neo4j cypher


    【解决方案1】:

    在参考文档中,请参阅http://docs.neo4j.org/chunked/stable/query-set.html#set-set-a-label-on-a-node,您需要使用set 为现有节点添加标签:

    match (n {id:desired-id})
    set n :newLabel
    return n
    

    【讨论】:

    • 如果你想给所有节点加上另一个标签,只需match (n:ExistingLabel) set n :NewLabel。现有标签不会被删除。
    • 可以使用以下方法删除旧标签:match (n:OldLabel) remove n:OldLabel
    猜你喜欢
    • 2017-12-02
    • 2013-10-08
    • 2022-07-04
    • 2010-10-03
    • 2020-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-14
    相关资源
    最近更新 更多