create multiple vertices in gremlin graph in local dynamodb

蹲街弑〆低调 提交于 2020-03-06 04:28:59

问题


I have to create multiple vertices in gremlin graph in its console using local DynamoDB few commands.

Uses := TitanDB

Storage Backend := DynamoDB

Server := Gremlin server


回答1:


Here's the same example I provided previously

gremlin> graph = TitanFactory.open('conf/gremlin-server/dynamodb-local.properties')
==>standardtitangraph[com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager:[127.0.0.1]]
gremlin> v0 = graph.addVertex('name', 'jason'); v1 = graph.addVertex('name', 'mustaffa'); v0.addEdge('helps', v1)
==>e[175-39k-1lh-374][4232-helps->4144]
gremlin> graph.tx().commit()
==>null

It creates 2 vertices and 1 edge. This example shows a direct connection to the Titan graph without using a Gremlin Server.

If you want to connect to a Gremlin Server, the syntax is largely the same. First create a remote connection to the Gremlin Server, then you have to use :> or :submit to send the request to the server. Also note that you don't need to explicitly call graph.tx().commit() because the transaction is automatically committed on each remote request.

gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> v0 = graph.addVertex('name', 'jason'); v1 = graph.addVertex('name', 'mustaffa'); v0.addEdge('helps', v1)
==>e[17c-3b4-1lh-3a8][4288-helps->4256]


来源:https://stackoverflow.com/questions/40889006/create-multiple-vertices-in-gremlin-graph-in-local-dynamodb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!