tinkerpop3 - How to add multiple edges in a single gremlin query? -
my scenario add multiple edges between vertices in single query:
assume nodes below: these labels , ids have
users:
4100
songs:
4200
4355
4676
i have establish edges between these vertices
4100 --> 4200, 4100 --> 4355, 4100 --> 4676.
we can creating single edge between node.it not efficient method if want create edge between more 50 vertices @ time. using tinkerpop 3.0.1
.
if have vertex ids, efficient lookup id. if using gremlin server, each request gremlin server treated single transaction. can pass multiple statements in gremlin query on single request (with bindings) rather sending multiple requests. separate statements in gremlin query semicolons.
l=[4200, 4355, 4676]; v=graph.vertices(4100).next(); l.each { v.addedge("knows", graph.vertices(it).next()) }
Comments
Post a Comment