Hi, I've got to ask what may be a simple question. When doing a Gremlin query, I want to check to see if the pipe is empty before returning a value. Is there a simple way to check for an empty pipe and return a pre-specified value if it's empty? I must be missing something
# can't do this if the pipe empties out before it hits the next()
output = v1.inE('LINKTYPE').outV().next().name
# return value or null if pipe empty (what a mess and it fails in some cases)
# this works, but even more ugly
nodes=[]; v1.inE('LINKTYPE').outV().fill(nodes)
output = (nodes.size > 0)?nodes[0].name:null
# something like this would be ideal
output = v1.inE('LINKTYPE').outV().nextValOrElse('name', 'MISSING')
thanks for reading this