gremlinrestclient
gremlinrestclient copied to clipboard
Creating a Edge
Hi Dave, I am trying to create a edge but the weight property is not working. Even if I specify the weight its creating a edge without the property. I used your below example
>>> d = {"name": "dave", "label": "person"}
>>> p = {"name": "python", "label": "lang"}
>>> e = (d, "LIKES", p, {'weight': 1})
>>> graph.create(e)
I traced the gremlin query which was being generated. You can see the weight property is missing.
{"gremlin": "v0 = graph.addVertex(label, p0, 'name', p1, );v1 = graph.addVertex(label, p2, 'name', p3, );e0 = v1.addEdge('LIKES', v0, );graph.tx().commit();[[v0,v1], [e0]];", "bindings": {"p2": "lang", "p3": "python", "p0": "person", "p1": "dave"}, "language": "gremlin-groovy"}
Thanks,
Hi there,
There is a bug in the _divide_elements function. Note that properties is always set to {}. I fixed it as follows.
try:
properties = arg[3]
except IndexError:
properties = {}
Sorry somehow I missed this issue when it was first open. @adriagascon would you like to make a PR to fix this issue (with a test)?