I’m trying to accomplish vertex-wise subgraph matching using the following construct:
a = g.v(1)
p = g.v(5)
a.filter{it.map() == p.map()}.out.sideEffect{p = p.out}.loop(3){it.object != null}
I should say that the map comparison surprisingly works well enough, but the side effect part does not seem to modify the p-vertex in a proper way. When I print p after performing these Gremlin steps – it looks like a pipeline. But more explicit p = g.v(p.out.id), p = g.v(p.outE.inV.id) and even numeric i++ side effects do not seem to modify the value at all.
I tried this both in Neo4j Gremlin shell, and through Groovy.
If you get a pipeline when you expect something else, try a next() to see if that gets you what you want. Note that when I next() in the sideEffect closure, x changes.