0

I have the following script to update a property on a vertex (janusgraph 0.2.0). When I run it from the Gremlin Console the value gets changed as expected:

g.V().hasLabel('airport').has('airport_code','ATL').fold().coalesce(__.V().hasLabel('airport').has('airport_code','ATL').property('airport_runways', 5),__.unfold()).next()

However, when I paste the same script on my python code, using gremlin_python(3.2.6) and goblin (2.1.0)

session = await app.session()

await session.g.V().hasLabel('airport').has('airport_code', 'ATL').fold().coalesce(
    __.V().hasLabel('airport').has('airport_code','ATL').property('airport_runways', 7),
    __.unfold()).next()

await session.flush()

The value for the airport_runways property does not get updated. Any suggestions on what could I be missing ?

Cracoras
  • 347
  • 3
  • 16
  • I'm not a Goblin user, but if you had a sample project shared on GitHub, that might make it easier to try to reproduce the behavior you are seeing. – Jason Plurad Aug 08 '18 at 03:42
  • Hi Jason, I noticed since I posted is that it seems like it's not that the update is not happening, but each time I run an update query, a new vertex is created however I can't see the properties in it. The original vertex is created with 10 properties, but the update only provides the unique key and the changed property . So I am not sure if there is some setting that forces a new vertex to be created if there is no match in all properties? Also, I can only see these vertex using this query: g.V().valueMap(true).toList(), which returns [label:airport,id:12488]. If I try – Cracoras Aug 08 '18 at 17:36

1 Answers1

0

I had a similar problem with gremlin_python with a different graphdb vendor.

See if replacing the final .next() with something that enforces a full iteration over vertexes like .count().next() or .toList() solves the issue.

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43