Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
dynamodb janusgraph存储后端从Java远程连接_Java_Amazon Dynamodb_Gremlin_Titan_Janusgraph - Fatal编程技术网

dynamodb janusgraph存储后端从Java远程连接

dynamodb janusgraph存储后端从Java远程连接,java,amazon-dynamodb,gremlin,titan,janusgraph,Java,Amazon Dynamodb,Gremlin,Titan,Janusgraph,我在AWS上部署了dynamodb janusgraph存储后端,我正在尝试找出如何从Java连接到gremlin服务器。 我的项目中有dynamodb janusgraph存储后端的sbt依赖项,但我不想使用作为java应用程序一部分运行的gremlin服务器。我需要它独立运行,并将java应用程序连接到它 我研究了多种选择,如使用集群(GremlinJava)和withRemote(GremlinDriver),但两者都有局限性。我想使用JavaGremlinAPI,如果我使用集群,我就不能

我在AWS上部署了dynamodb janusgraph存储后端,我正在尝试找出如何从Java连接到gremlin服务器。 我的项目中有dynamodb janusgraph存储后端的sbt依赖项,但我不想使用作为java应用程序一部分运行的gremlin服务器。我需要它独立运行,并将java应用程序连接到它

我研究了多种选择,如使用集群(GremlinJava)和withRemote(GremlinDriver),但两者都有局限性。我想使用JavaGremlinAPI,如果我使用集群,我就不能使用它。使用withRemote方法,我无法确定如何初始化graph实例

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类型,以便使用
OpenManage()
和其他方法。此外,使用高级图形类型,我不能添加新的顶点。我需要能够从我的java代码中创建、获取和更新。目前无法通过远程驱动程序调用JanusGraph模式API。如果不想从应用程序中打开JanusGraph实例,则必须将模式构建为字符串,并使用将其发送到Gremlin服务器。您仍然可以使用来构建和查询图形

Cluster cluster = Cluster.open("conf/remote-objects.yaml");

// use client to create the schema
Client client = cluster.connect();
String schema = "mgmt=graph.openManagement();";
schema += "mgmt.makeVertexLabel(\"person\").make();";
schema += "mgmt.makeVertexLabel(\"person\");";
schema + "mgmt.makePropertyKey(\"name\").dataType(String.class).make();"
schema += "mgmt.commit(); true";
CompletableFuture<List<Result>> results = client.submit(schema).all();

// use traversals only to interact with the graph
Graph graph = EmptyGraph.instance();
GraphTraversalSource g = graph.traversal().withRemote(DriverRemoteConnection.using(cluster));
Vertex v = g.addV("person").property("name", "pepe").next();
List<Vertex> vlist = g.V().toList();
Cluster Cluster=Cluster.open(“conf/remote objects.yaml”);
//使用客户端创建模式
Client=cluster.connect();
String schema=“mgmt=graph.openManagement();”;
schema+=“mgmt.makeVertexLabel(\'person\”).make();”;
schema+=“mgmt.makeVertexLabel(\“person\”)”;
schema+“mgmt.makePropertyKey(\“name\”).dataType(String.class).make();”
schema+=“mgmt.commit();true”;
CompletableFuture results=client.submit(schema.all();
//仅使用遍历与图形交互
Graph Graph=EmptyGraph.instance();
GraphTraversalSource g=graph.traversal().withRemote(DriverRemoteConnection.using(cluster));
顶点v=g.addV(“person”).property(“name”、“pepe”).next();
List vlist=g.V().toList();

如何在顶点之间创建边?我试过了,但没有成功:g.V().has(“name”,“pepe”).addE(“created”).to(g.V().has(“name”,“anotherUser”).next()).property(“created_AT”,LocalDateTime.now().toEpochSecond(ZoneOffset.UTC));我知道了-这起作用了:g.V().has(“name”,“pepe”).as(“a”).V().has(“name”,“anotherUser”).addE(created).from(“a”).property(“created_AT”,LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)).next();我想我的问题是无法添加顶点和边,我可以通过GraphTraversalSource来完成,所以现在,这个解决方案可以工作了。我将通过控制台或一次性代码创建模式和索引,因此,如果必须使用客户端来创建模式和索引,应该没问题;“;”graph属于graph类型,但没有该方法