问题
Hey Can anyone help me figure out how I can connect to remote JanusGraph server hosting several graphs and query a specific graph (by graph name) using C# JanusGraph.net ?
I can connect to the server but I can't query a specific graph.
var c = JanusGraph.Net.JanusGraphClientBuilder.BuildClientForServer(server).Create();
var connection = new DriverRemoteConnection(c);
var g = Traversal().WithRemote(connection);
How we can implement ConfiguredGraphFactory.create("graphName") or ConfiguredGraphFactory.open("graphName") in JanusGrapgh.net
回答1:
DriverRemoteConnection
can take another parameter in addition to the GremlinClient
argument:
var c = JanusGraph.Net.JanusGraphClientBuilder.BuildClientForServer(server).Create();
var connection = new DriverRemoteConnection(c, "graphTraversalSourceName");
var g = Traversal().WithRemote(connection);
Note that remote traversals do not bind against Graph
instances. They bind against a GraphTraversalSource
, so you must change "graphTraversalSourceName" to the name of one of those configured objects on the server. When you don't supply this argument, it just defaults to "g" by the way. Also, please note that .NET API documentation can be found here.
来源:https://stackoverflow.com/questions/61393535/janusgraph-net-c-sharp