My context:
- gremlin-python
- AWS Neptune
My question is:
1) Can I drop vertices and edges recursively in one transaction given that I have all the specific ids of the vertices and edges I want to drop? The aim is to write python function that evaluates each edge, and determine whether it needs to be dropped, and chain a gremlin query to drop it.
For instance:
vertex ids to delete:
'vertex1', 'vertex2', 'vertex3'
edge ids to delete:
'edge1', 'edge2', 'edge3'
An example of the python function to chain on to g would be like:
def chain_drop(g, vertex_id):
g = g.V(vertex_id).drop()
return g
The chained query i would like to execute as one transaction would ideally look something like:
g.E('edge1').drop()
.V('vertex1').drop()
.E('edge3').drop()
.V('vertex3').drop()
.iterate() # execute all these queries as one transaction
The above doesn't work... And it seems I cannot .E('someid') in the middle of my gremlin query.
Slightly off topic but my best try (non-recursive) would be something like below:
g.E('edge1', 'edge2', 'edge3').as_('edges')
.V('vertex1', 'vertex2', 'vertex3').as_('vertices')
.union(__.select('edges'),
__.select('vertices'))
.drop()
.iterate()
Any help much appreciated!