gpt4 book ai didi

Gremlin 递归删除顶点

转载 作者:行者123 更新时间:2023-12-04 07:21:23 27 4
gpt4 key购买 nike

我尝试使用 gremlin 查询删除包含所有子节点的 Vertex:

g.V()
.hasId(someId)
.union(fold().unfold(), repeat(in()).emit())
.drop()
.iterate()
不幸的是,我收到一个错误:
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: 删除了 ID 为“someId”的顶点
但是“someId”存在于数据库中!
Java + JanusGraph:
org.janusgraph:janusgraph-driver:0.5.3
org.apache.tinkerpop:gremlin-driver:3.5.0

最佳答案

可能有帮助 aggregate(local)先放下然后删除的东西 - 比如:

g.withSideEffect('x',[] as Set).
V().hasId(someId).aggregate(local,'x').
repeat(in()).emit()).aggregate(local,'x').
cap('x').
drop()

关于Gremlin 递归删除顶点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68479695/

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