Reputation: 21
I try to delete a Vertex with all child nodes with the gremlin query:
g.V()
.hasId(someId)
.union(fold().unfold(), repeat(in()).emit())
.drop()
.iterate()
Unfortunately I get an Error:
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex with id "someId" was removed
But "someId" exists in the db!
Java + JanusGraph:
org.janusgraph:janusgraph-driver:0.5.3
org.apache.tinkerpop:gremlin-driver:3.5.0
Upvotes: 2
Views: 566
Reputation: 26
If anyone is interested, the solution provided above g.V('SomeDataId').emit().repeat(out()).fold().unfold().drop()
also works with ExRam.Gremlinq. Here's how it work for me:
await g.V<Root>("id")
.Cast<Child>()
.Loop(loop => loop
.Repeat(__ => __
.OutE<HasChild>()
.InV<Child>())
.Emit()
.Until(__ => __.Not(_ => _.OutE<HasChild>())))
.Fold()
.Unfold()
.Drop();
Upvotes: 0
Reputation: 11
Try this query, it works fine for me:
g.V('SomeDataId').emit().repeat(out()).fold().unfold().drop()
Upvotes: 1
Reputation: 46216
It may help to aggregate(local)
the things to drop first and then remove them - something like:
g.withSideEffect('x',[] as Set).
V().hasId(someId).aggregate(local,'x').
repeat(in()).emit()).aggregate(local,'x').
cap('x').
drop()
Upvotes: 2