I'm looking also for a way to do that, but with this example if the
vertex exists I get the matched vertex * the nb of vertices in the
graph:
gremlin> g.V().count()
==>991
# vertex already exists
gremlin> g.V().coalesce(V().hasId('8f1f2c14-bd12-4ec3-9b2d-019f9242b2dd'), g.addV('foo').property(id, '8f1f2c14-bd12-4ec3-9b2d-019f9242b2dd')).count()
==>991
gremlin> g.V().coalesce(hasId('8f1f2c14-bd12-4ec3-9b2d-019f9242b2dd'), g.addV('foo').property(id, '8f1f2c14-bd12-4ec3-9b2d-019f9242b2dd'))
Vertex with id already exists: 8f1f2c14-bd12-4ec3-9b2d-019f9242b2dd
Type ':help' or ':h' for help.
Display stack trace? [yN]
Is there some other solution ?
# vertex does not exists
gremlin> g.V().coalesce(hasId('e6b5951c-c918-4916-b0a6-f4c9468fb25d'), g.addV('foo').property(id, 'e6b5951c-c918-4916-b0a6-f4c9468fb25d'))
==>v[e6b5951c-c918-4916-b0a6-f4c9468fb25d]
That is fine...
Thanks,
JP
Excerpts from Yehonathan Sharvit's message of February 18, 2018 11:34 am:
> --
> You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
gremlin-user...@googlegroups.com.