g.addV('person').property('name','Tim')
I got V[0] node
g.addV('person').property('name','Tim')
I got V[1] node with with the exact same label and key value again.
I just want V[0],if there is V[0] exist, V[1] can not be added.
g.addV('person').property('name','Tim')
I got V[0] node
g.addV('person').property('name','Tim')
I got V[1] node with with the exact same label and key value again.
I just want V[0],if there is V[0] exist, V[1] can not be added.
The recommended way to do this with Gremlin today is to use the
coalesce
pattern as follows:This will return the existing vertex or if it does not exist will create it and return the new vertex.
You can read more about this in the Gremlin Recipes and in Practical Gremlin .