gpt4 book ai didi

neo4j - 删除neo4j中的无标签节点

转载 作者:行者123 更新时间:2023-12-02 23:03:55 29 4
gpt4 key购买 nike

使用查询我有一个节点列表。

match (n) where n.afield is null return count(n),labels(n) ;

这给出了

+---------------------------+
| count(n) | labels(n) |
+---------------------------+
| 7 | ["foo"] |
| 21 | [] |
(...)

如果我想删除所有 foo 标记的节点,我会使用

match(n:foo) detach delete(n) ;

现在,如何删除所有无标签节点? (上面示例中的 21 个)

match (n) where magic(n) detach delete ;

有人知道某种magic(n)吗?

最佳答案

您可以尝试此查询来删除没有标签的节点:

MATCH (n) where size(labels(n)) = 0
DETACH DELETE n

关于neo4j - 删除neo4j中的无标签节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45183065/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com