Gremlingo: Traverser does not map to value when adding edge between two vertices

Issue

I am using tinkerpop gremling-go to access gremlin-server/JanusGraph. When trying to create an edge between two vertices, I get the following error

The provided traverser does not map to a value: ...

Vertices are added via

t.AddV("somenode").Property("some_id", someID).Iterate()

and

t.AddV("someothernode").Property("some_id", someID).Iterate()

where t is *gremlingo.GraphTraversal. Vertices are added successfully.

Edge is added via

t.AddE("someedge").
        From(
            __.V().
                HasLabel("somenode").
                Has("some_id", someID),
        ).
        To(
            __.V().
                HasLabel("someothernode").
                Has("some_id", someID),
        ).
        Iterate()

where again t is *gremlingo.GraphTraversal and __ is alias for gremlingo.T__. Edge is not created with error output above.

Using gremlin-console adding edge via g.addE("someedge").from(__.V().hasLabel("somenode").has("some_id","some_id_1")).to(__.V().hasLabel("someothernode").has("some_id","some_id_1")) where g is the traversal works just fine.

Note that I left out go error handling.

Solution

Did you wait for async request completion?

channel := t.AddV("somenode").Property("some_id", someID).Iterate()

err := <-channel

Answered By – Valentyn Kahamlyk

Answer Checked By – Jay B. (GoLangFix Admin)

Leave a Reply

Your email address will not be published.