Using mergeE to create an edge with an id that depends on a lookup
I want to use mergeE to produce an edge whose id is the concatenation of the ids of its inV and outV vertices. But the inV vertex has to be looked up, the exact id is not known without a lookup.
Suppose that partialMacbookId === "macbookAir" and the result of the lookup is the vertex with id "macbookAir2024"
And suppose that ownerId === "1111"
I want to create a hasOwner edge with id "macbookAir20241111"
Is this possible?
Solution:Jump to solution
i dont think there's any way to do that directly in Gremlin without (1) the new string steps in 3.7.x or (2) a lambda. That tends to leave folks with perhaps the third option, doing the operation with multiple queries in a transaction, where you do the concatenation client-side. I can't really be too specific but we hope to see Neptune working with 3.7.x soon.
3 Replies
Here is the script that I'm testing in gremlin console:
I'm using Tinkerpop 3.6.2, where .concat() and .format() weren't yet added, and I'm using Neptune where lambdas aren't supported
Solution
i dont think there's any way to do that directly in Gremlin without (1) the new string steps in 3.7.x or (2) a lambda. That tends to leave folks with perhaps the third option, doing the operation with multiple queries in a transaction, where you do the concatenation client-side. I can't really be too specific but we hope to see Neptune working with 3.7.x soon.
Thank you @spmallette !