0

I am using Amazon Neptune engine version 1.1.1.0 and I am trying to execute below query

g.E().has(id, '6529056485837422516').fold().coalesce(unfold().property('id','6529056485837422516').property('createdat', 1553676114).property('status', 0).property('edgeproperty', 'connects').property('source', '63').property('destination', '54'),g.V('54').addE('connects').to(__.V('63')).property(id,'6529056485837422516').property('id','6529056485837422516').property('createdat', 1553676114).property('status', 0).property('edgeproperty', 'connects').property('source', '63').property('destination', '54'))

I am executing this query from my gremlin console and after executing this I am getting error like below {"detailedMessage":"The child traversal of [GraphStep(vertex,[54]), AddEdgeStep({label=[connects], createdat=[1553676114], edgeproperty=[connects], ~to=[[GraphStep(vertex,[63])]], destination=[54], id=[6529056485837422516], id=[6529056485837422516], source=[63], status=[0]})] was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal","code":"InternalFailureException","requestId":"ceee889e-c382-4bde-ad91-86ea1cb010c1"}

But If I am adding edge separately with below query then I am able to add edge g.V('54').addE('connects').to(__.V('63')).property(id,'6529056485837422516').property('id','6529056485837422516').property('createdat', 1553676114).property('status', 0).property('edgeproperty', 'connects').property('source', '63').property('destination', '54')

Even if I am able to update edge with below query then also I am able to update g.E().has(id, '6529056485837422516').fold().coalesce(unfold().property('id','6529056485837422516').property('createdat', 1553676114).property('status', 0).property('edgeproperty', 'connects').property('source', '63').property('destination', '54'))

but if I am trying to update or add same time by using fold(). coalesce() then I am getting error as not spawned anonymously - use the __ class rather than a TraversalSource.

Please help me how to solve this error

  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Oct 06 '22 at 04:45

1 Answers1

0

The resolution is in the error message itself and is described in further detail here, but basically as of TinkerPop 3.5.0 you can no longer use a child traversal spawned from g (i.e. a GraphTraversalSource). It must be spawned anonymously from __ (i.e. double underscore class).

In short, you need to spawn the g.V('54').addE(... traversal as __V('54').addE(....

stephen mallette
  • 45,298
  • 5
  • 67
  • 135