I have a Gremlin vertex with set-valued properties emails
and phones
. As part of my update logic, I am trying to drop and recreate these properties:
String key = ThreadLocalRandom.current().nextInt()
def dropped = vtx.as(key).properties('emails', 'phones').drop().<Vertex>select(key)
My expectation is that the vertex will get tagged by as
, then I traverse to the properties and drop them, then use select
to return to the vertex for further processing. However, executing this always results in an empty traversal.
I have been able to get the traversal to return a result by instead saying
def dropped = vtx.sideEffect(__.properties('emails', 'phones').drop())
but I want to ensure that the properties are dropped strictly before continuing, as I then proceed to re-insert them.
Why does the original traversal not behave as I expect it? With the sideEffect
version, do I need to add a barrier()
for correctness, and if so, is that sufficient?
String key = ... nextInt ()
? – daggett