Search code examples
graphgremlintinkerpop

Why I could not do E step at the middle of a Gremlin query?


I notice that I could not have an E step at the middle of a Gremlin query. Is there a reason behind it, or just the feature is missing?

g.V().....E()...

Basically, I have an index on an edge property and can do like this to add an edge if it does not exist in one transaction:

g.E().has('edgeId', 1).fold().coalesce(__.unfold(), __.addE('link').from(__.V(id1)).to(__.V(id2))

But I could not chain the traversal to add multiple edges as a batch. Is there a way to do so?


Solution

  • That feature became available in 3.7.0 (javadoc). You can now use E() as a start step or use it mid-traversal.