Store Gremlin graph in local DynamoDB

后端 未结 2 540
旧巷少年郎
旧巷少年郎 2020-12-21 03:50

Instead of using AWS, I am using its local available DynamoDB database and creating a graph in the Gremlin console.

My PC is using Gremlin-version=3.0.1.incuba

相关标签:
2条回答
  • 2020-12-21 04:32

    Relevant documentation links:

    • Amazon DynamoDB Storage Backend for Titan
    • Running DynamoDB on Your Computer

    As Filipe mentioned, g.commit() throws an exception because there is no commit() method on g which is a GraphTraversalSource. I suggested that you use graph.tx().commit(), where graph.tx() gets the Transaction from the Graph. In the comments we found out that you were trying to commit() a transaction on a TinkerGraph, which does not support transactions.

    You need to instantiate a TitanGraph, not a TinkerGraph. This commonly done with a properties file, and there is a DynamoDB Local example properties file in the dynamodb-titan-storage-backend repository. Make sure to update the storage.dynamodb.client.endpoint to match your configuration. If you are using the Titan Server directions from the DynamoDB-Titan link, the port is 4567. If you are using the directions from the DynamoDB local link above, the default port is 8000.

    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
    

    Also note, the DynamoDB-Titan directions end up starting an in-memory DynamoDB Local instance. This behavior can be changed by commenting out the -inMemory argument the pom.xml.

    0 讨论(0)
  • 2020-12-21 04:32

    You are attempting to commit your traversal g. You should be attempting to commit your graph like so: graph.commit().

    g is the traversal which is initialised as such: g = graph.traversal() and it cannot be committed.

    0 讨论(0)
提交回复
热议问题