Search code examples
javagremlintinkerpop3

Use gremlin traversals (Tinkergraph) against the gremlin server


Is it possible to use Tinkergraph-Gremlin against a local instance of the gremlin-server? In other words, what's missing from the following source code to make it query the localhost:8182 gremlin-server instead of the in-memory DB:

Graph graph = TinkerGraph.open();
GraphTraversalSource g = graph.traversal();

Solution

  • Sounds like you want to use a remote traversal.

    EmptyGraph graph = EmptyGraph.instance();
    GraphTraversalSource g = graph.traversal().withRemote("conf/remote-graph.properties");
    

    Check out the TinkerPop documentation for Connecting via withRemote().