以字符串的形式获取Gremlin查询,并在Java中执行它,而无需将其提交给GremlinServer [英] Get Gremlin query as a String and execute it in java without submitting it to the GremlinServer

查看:192
本文介绍了以字符串的形式获取Gremlin查询,并在Java中执行它,而无需将其提交给GremlinServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个String格式的Gremlin查询(例如"g.V()").我想执行此字符串而不将其提交给GremlinServer.

I have a Gremlin query in the String format (for example "g.V()"). I want to execute this String without submitting it to the GremlinServer.

我使用以下依赖项:

<dependency>
    <groupId>org.apache.tinkerpop</groupId>
    <artifactId>gremlin-driver</artifactId>
    <version>3.3.1</version>
</dependency>

有什么办法吗?

推荐答案

您可以直接在

You can execute Gremlin string directly in GremlinGroovyScriptEngine or through the GremlinExecutor (which just passes the string to the GremlinGroovyScriptEngine but has some additional features to it). Simple pass the Gremlin string to the appropriate eval() method and get back a result from that script evaluation. That's basically what Gremlin Server does internally.

您可能需要gremlin-groovy依赖而不是gremlin-driver.

You will likely need the gremlin-groovy dependency rather than gremlin-driver.

这篇关于以字符串的形式获取Gremlin查询,并在Java中执行它,而无需将其提交给GremlinServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆