问题
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