I have the code below in a file named traversal.groovy
(which I call from the command line with gremlin -e traversal.groovy
):
// Beg
You likely just need to iterate your pipeline:
http://gremlindocs.com/#methods/pipe-next
println v.outE.inV.name.next()
Thanks to stephen mallette for pointing me in the right direction. To simply print out the "name" property of each vertex in my traversal above, we can use sideEffect and iterate. The resulting code would look as follows:
// Begin traversal.groovy //
g = TinkerGraphFactory.createTinkerGraph()
v = g.v(1)
v.outE.inV.sideEffect{println it.name}.iterate()
// End traversal.groovy //
and the output would be:
vadas
josh
lop