将Gremlin图存储在本地DynamoDB中 [英] Store Gremlin graph in local DynamoDB

查看:113
本文介绍了将Gremlin图存储在本地DynamoDB中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有使用AWS,而是使用其本地可用的DynamoDB数据库,并在Gremlin控制台中创建了图形.

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

我的电脑正在使用Gremlin-version=3.0.1.incubatingTitan-version=1.0.0

我的问题:如何在我的本地DynamoDB中保存图形,以便我可以随时取回它? (例如,计算机重新启动后).

My question: How to save a graph in my local DynamoDB so that I can retrieve it back whenever I wish? (E.g. after computer restart).

我已经尝试了很多,使用save()commit()图.但我总是出错:

I have tried a lot, using save() or commit() graph. But I always got an error:

g.commit()
No signature of method: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph
  .GraphTraversalSource.commit() is applicable for argument types: () values: []
Possible solutions: wait(), computer(), collect(), wait(long), computer(java.lang.Class), collect(groovy.lang.Closure)

我正在使用Tinkerpop 3.

推荐答案

相关文档链接:

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

如Filipe所述,g.commit()引发异常,因为g上没有commit()方法,这是 Transaction /apache/tinkerpop/gremlin/structure/Graph.html#tx--"rel =" nofollow noreferrer> Graph .在评论中,我们发现您正在尝试commit()TinkerGraph上进行交易,该交易不支持交易.

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.

您需要实例化 TitanGraph ,而不是TinkerGraph.这通常是通过属性文件完成的,并且有一个DynamoDB Local

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

还要注意,DynamoDB-Titan指令最终会启动内存中的DynamoDB Local实例.可以通过注释-inMemory参数来更改此行为. ="nofollow noreferrer"> pom.xml .

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.

这篇关于将Gremlin图存储在本地DynamoDB中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆