Hello,
I learned that you can't query all edges mid-query, that is, neither "GraphTraversal" nor "__" define an "E(...)" method while there is a V(...) method. Now the OPs workaround was to reuse "g" in the middle of the query, like in "g.V().coalesce(g.E(), __.addE(...))" (simplified!!). I argued that it's invalid gremlin, but it seems it's legal, plus it works. I understand that your're pretty much running two queries now, but the workaround still seems odd to me. Is it legal, and moreover....how would you even represent this in bytecode?
Regards,
Daniel