我在AWS上部署了dynamodb-janusgraph-storage-backend,并尝试找出如何从Java连接到gremlin服务器。我在项目中有dynamodb-janusgraph-storage-backend的sbt依赖项,但我不想使用作为java应用程序一部分运行的gremlin服务器。我需要它独立运行,并将Java应用程序连接到它。
我研究了多个选项,如使用Cluster(gremlin-java)和withRemote(gremlin-driver),但两者都有限制。我想使用Java Gremlin API,但如果使用Cluster,则无法使用它。使用withRemote方法,我无法弄清楚如何初始化图实例。
gremlin文档中的示例显示
我需要将
我研究了多个选项,如使用Cluster(gremlin-java)和withRemote(gremlin-driver),但两者都有限制。我想使用Java Gremlin API,但如果使用Cluster,则无法使用它。使用withRemote方法,我无法弄清楚如何初始化图实例。
gremlin文档中的示例显示
EmptyGraph.instance()
,但如果要使用JanusGraph API,则无法使用它。我需要这部分与Janusgraph配合使用:Cluster cluster = Cluster.open("conf/remote-objects.yaml"); // this has hosts and ports to gremlin server running in AWS
graph = EmptyGraph.instance();
graph.traversal().withRemote(DriverRemoteConnection.using(cluster))
我需要将
graph
对象转换为JanusGraph类型,这样我才能使用openManagement()
和其他方法。同时使用高级Graph类型无法添加新的顶点。我需要在我的Java代码中能够创建、获取、更新数据。