Why do you need to fold/unfold using coalesce for a conditional insert?
I'm trying to understand how this pattern for a conditional insert works: g.V() .hasLabel('person').has('name', 'John') .fold() .coalesce( __.unfold(), g.addV('person').property('name', 'John') ).next(); What is the purpose of the fold/unfold? Why are these necessary, and why does this not work: g.V() .coalesce( __.hasLabel('person').has('name', 'John'), g.addV('person').property('name', 'John') ).next(); The fold-then-unfold pattern seems redundant to me and yet the above does not yield the same result. Consider what happens when you just do the following: gremlin> g = TinkerFactory