目前,无法通过远程驱动程序调用JanusGraph Schema API。如果您不想从应用程序中打开JanusGraph实例,则必须将模式构建为String并使用 客户提交 将它发送到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();