[英]Gremlin : Add multiple vertices in single gremlin query?
I am using Titan 0.4 + Cassandra. 我正在使用Titan 0.4 + Cassandra。 My use-case requires insert multiple vertices at a time.
我的用例需要一次插入多个顶点。 (aprrox batch size is 100 vertices at a time.) eg :
(aprrox批处理大小一次是100个顶点。)例如:
v01 = g.addVertex(["UC":"B","i":2]); v02 = g.addVertex(["UC":"H","i":1])
v03 = g.addVertex(["LC":"a"]); v04 = g.addVertex(["LC":"a"]);
v05 = g.addVertex(["LC":"d"]); v06 = g.addVertex(["LC":"h"]);
v07 = g.addVertex(["LC":"i"]); v08 = g.addVertex(["LC":"p"]);
Is there any gremlin command to add all Eight vertices in a single request
. 是否有任何gremlin命令可
Eight vertices in a single request
添加所有Eight vertices in a single request
。 ( something like g.addVertices()
?? ) (类似
g.addVertices()
东西)
Gremlin没有addVertices()包装器-您需要多次调用addVertex()。
I'm using the c# SDK. 我正在使用c#SDK。 What worked for me is just chaining the addV commands:
对我有用的只是链接addV命令:
g.addV('item').property('id', '5aa3a51e-6434-4d53-aed4-
5db3c90e3551').addV('item').property('id', '7f859920-2251-4553-8325-
5dbb2f626d1c')
for your example: 以您的示例为例:
g.addVertex(["UC":"B","i":2]).addVertex(["UC":"H","i":1]).addVertex(["LC":"a"]).addVertex(["LC":"a"]).addVertex(["LC":"d"]).addVertex(["LC":"h"]).addVertex(["LC":"i"]).addVertex(["LC":"p"])
hope this helps 希望这可以帮助
I had the requirement to add several vertices at the same time too. 我也需要同时添加多个顶点。 Individual addV queries weren't practical for inserting thousands of record at a time, while also retrieving their database generated ids.
单个addV查询对于一次插入数千条记录并不实际,同时还需要检索其数据库生成的ID。
Here's what I came up with as a batch insertion command/query 这是我作为批处理插入命令/查询想到的
g.addV('One').values('id').as('one').addV('Two').values('id').as('two').select('one', 'two')
CosmosDB returns CosmosDB返回
[{
"one": "372be552-7f63-4d7b-be81-a73d5d677afa",
"two": "a60d3773-5c29-454e-b079-dec734c4f431"
}]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.