0
votes

In gremlin is it possible to store a vertex ID inside another vertex? For instance if I created a vertex like this

g.
addV('my_vertex_label').property(id,'my_vertex_id').
property('anotherVertexID','other_vertex_id')

and then queried it

V('my_vertex_id').properties('anotherVertexID').value()

it will return

["other_vertex_id"]

is there anyway I can query the other vertex like this:

V(V('my_vertex_id').properties('anotherVertexID').value())

Note that I am using AWS Neptune so the query must be pure gremlin no java/groovy

1

1 Answers

2
votes

You could do something like this

gremlin> g.addV('x').property('otherid','3').iterate()

gremlin> g.V().hasLabel('x').as('a').V().where(eq('a')).by(id).by('otherid')
==>v[3]

As far as I am aware the neither the hasId() step nor the V() step can take a traversal but there may be other ways. The example above does work in my testing on Neptune.