I'm trying to create a graph from scratch that i'm visualising in graphexp, but i'm struggling to undertand the anonymized traversals concept and how to create them
I'm using python 3.9 and gremlinpython 3.5.1
- Creating the connection and graph:
from gremlin_python.process.anonymous_traversal import traversal
self.g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin', 'g'))
- I imported the statics so I could use the steps without the __ class:
statics.load_statics(globals())
- Creating a vertex if it doesnt exists:
def _add_vertex(self, name):
return self.g.V().has('name', name).fold().coalesce(unfold(), addV().property('name',name)).next()
- Creating an edge if it doesnt exist between two vertices:
def _add_edge(self, v1, v2, weight, label):
return self.g.V(v1).as_("fromVertex").V(v2).coalesce(inE(label).where(outV().as_(
"fromVertex")), addE(label).property("weight", weight).from_("fromVertex")).next()
But i'm getting this error in graphexp when clicking on a vertex
Error retrieving data
The child traversal of [GraphStep(vertex,[696560]), PropertyMapStep(value)] was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal
The documentation is generally good but not very helpful for the anonymized traversals part. So how can I spawn anonymous child traversals using this method? and what does it really mean ?