Batching operations in gremlin on Neptune

Viewed 77

In AWS Neptune documentation (best-practices-gremlin-java-batch-add) they recommend batching operations together.
How can I batch a few operations together in case one of them may end the stream.
For example if I want to batch together the following:

g.V(2).drop().addV('test').property(id,1)

The problem is that the addV won't be called.
Is there a way to batch the drop and the addV together and making sure the addV will be called?
I tried to put fold() in between but because it isn't supported natively in Neptune and will probably create performance issues.
The sideEffect isn't a good option for performance reasons with Neptune as well (see drop documentation in gremlin-step-support).

1 Answers

You can accomplish this by using the sideEffect() step to perform the drop() as shown in this recipe. In your case this might look something like:

g.addV('test').property(id,1).sideEffect(V(2).drop())
Related