In my java project, I can create in-memory "GraphTraversalSource
" and I can create traversal queries easily. But I wonder how can I create script queries like client.submit(query)
?
public GraphTraversalSource gremlinGraph()
{
final Graph graph = TinkerGraph.open();
return graph.traversal();
}
I need a create Client
object from TinkerGraph. Then I want to call client.submit(query)
queries.
Is there any suggestion?
I'd say that the easiest way is to reference the
gremlin-groovy
module and create aGremlinGroovyScriptEngine
instance (source code). Then you can just do:Note that
client.submit()
is meant to submit Gremlin to a Gremlin Server compliant system. To use TinkerGraph in that context would mean hosting TinkerGraph in Gremlin Server.