Search code examples
gremlinjanusgraph

Adding Edge to Janusgraph via Gremlin interface


Can anyone explain why this doesn't seem to do anything

ve = g.addV("test").as("m").iterate()
g.addV("test2").as("q").V(ve).addE("contains").from("q").iterate()
g.V().hasLabel("test2").outE().otherV().path()

The operation executes without error but then doesn't return anything when asking for the edges.

I know I could join the traversals together, but I'm specifically looking at a usecase where I'd create the first vertex in a slightly different block of code.


Solution

  • Got it:

    ve = g.addV("test").as("m").iterate()
    

    should be

    ve = g.addV("test").as("m").next()