As AQL doesn't support deleting edges and vertices directly. I'd like to know how I'm able to delete a set of nodes/edges obtained by Graph traversals.
My current code for obtaining the Edges and Nodes is quite easy and works:
LET edgeKeys = (FOR v, e, p IN 1..1000 INBOUND 'TestNode/Node_3'
GRAPH 'testGraph'
RETURN e._key)
LET nodeKeys = (FOR v, e, p IN 1..1000 INBOUND 'TestNode/Node_3'
GRAPH 'testGraph'
RETURN v._key)
In the Tutorial there are two different commands used for removing several Edges and one Node:
LET r = (FOR key IN edgeKeys REMOVE key IN knows)
REMOVE 'eve' IN persons
This command works, but I got several Edges and several Nodes. I tried to modify the command to (both of them are executed after the first two commands):
FOR nkey IN nodeKeys REMOVE nkey IN TestNode
FOR ekey IN edgeKeys REMOVE ekey IN TestEdge
But that won't work, swapping them is the same. Both of them executed independently are fine. In the same Statement I'm getting the following error:
Query: AQL: document not found (while executing)
I'm able to understand why this error appears, but what's the proper way to work around it? Seems, just abusing the REMOVE command isn't valid either:
REMOVE nodeKeys IN TestNode
Query: AQL: invalid document type (while executing)
As this is a little more complicated than the regular AQL I'm using in my Python-Code I wonder how I'd use it later in Python Code?
For now I'd use the FOR-command to obtain a list of keys and in the iteration just use collection.delete(key)
.
Yet using a longer AQL-Statement seems to be cleaner than doing a hybrid-command in AQL and Python.
What would be the recommended way to execute the working AQL-command in Python? (And how would it look?)