Skip to content

Chapter2 Gremlin v3.5.X error on adding edges #57

@sunitj

Description

@sunitj

Also reported here: ACG Forum

Running through the intro to Gremlin Console lab. Adding vertices, worked well enough. But adding edges did not. Receive the following error message:

gremlin> g.V('1').addE('similarity').to(g.V('2')).property('weight', 0.8).next()
The child traversal of [GraphStep(vertex,[2])] was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal
Type ':help' or ':h' for help.
Display stack trace? [yN]

Fix: I would submit a PR, but wasn't sure if you were accepting.
Replace the g. call in the nested vertex call with __.. Updating the edge commands to:

g.V('1').addE('similarity').to(__.V('2')).property('weight', 0.8).next()
g.V('1').addE('similarity').to(__.V('3')).property('weight', 0.4).next()
g.V('4').addE('similarity').to(__.V('3')).property('weight', 0.1).next()
g.V('5').addE('similarity').to(__.V('3')).property('weight', 0.8).next()
g.V('2').addE('similarity').to(__.V('5')).property('weight', 0.8).next()

Discussion: https://stackoverflow.com/questions/67733463/anonymous-traversal-vs-normal-traversal-gremlin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions