I would like to drop specific vertices from my Neptune graph. I get a list of id's from outside Neptune and wish to drop all of them. Problem is, some of them may not exist.
I tried this, but it seems I can't hand over an array:
g.V(['1', '12', '14']).drop().iterate()
I also tried stringing single drop operations together with store, aggregate or sideEffect, but as soon as one of the vertices doesn't exists, the call doesn't delete anything...
g.addV('test').property(id, '1')
.addV('test').property(id, '12')
g.V('1').aggregate('x')
.V('12').aggregate('x')
.V('13').aggregate('x')
.select('x').unfold().drop()
(I can iterate over the list and string a query together, but of course this never works with
V('1').drop().V('12).drop()
)
I'm using typescript around the gremlin code.
Neptune runs with gremlin: {'version': 'tinkerpop-3.4.11'}
CodePudding user response:
Your first approach is the correct way to write your traversal - passing a List
of id
should work:
g.V(['1', '12', '14']).drop().iterate()
you could alternatively do any of the following (and other variations):
g.V('1', '12', '14').drop().iterate()
g.V().hasId('1', '12', '14').drop().iterate()
g.V().hasId(within['1', '12', '14']).drop().iterate()
They should all equate to the first one though.