用户定义的gremlin步骤适用于gremlin,但不适用于rexster

假骨

我试图确定与gremlin shell相比,rexster处理用户定义的Gremlin查询的方式似乎存在差异的原因。

我在用:

  • rexster-server-2.6.0;
  • gremlin-groovy-2.5.0;
  • orientdb-community-1.7.9;

我已加载以定向表示简单层次树的图形。每个节点都有一个标记为“父”的边,它指向其父。它是DAG。

在Gremlin中定义了一个用户定义的步骤(通过其init-scripts加载到rexster中)如下:

   Gremlin.defineStep('children', 
      [Vertex, Pipe], 
      {int depth ->  _().out('parent').loop(1) 
        {it.loops < depth} 
        {it.object != null} 
    })

在rexster狗屋中使用命令行gremlin工具时,通过这些命令,我​​得到以下错误(向右滚动以查看整个错误消息):

gremlin> g.V('type', 'LSNetwork')
==>v[#9:6312]
gremlin> g.V('type', 'LSNetwork').out('parent').out('parent').name
==>Leaf 0
==>Leaf 1
==>Leaf 2
==>Leaf 3   
gremlin> g.V('type', 'LSNetwork').children(2)
==>javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline.children() is applicable for argument types: (java.lang.Integer) values: [2]

但是,如果我启动了gremlin.sh,连接到我的图形,定义了该步骤,然后执行它,那么它可以完美地工作:

gremlin> Gremlin.defineStep('children', [Vertex, Pipe], {int depth -> _().out('parent').loop(1){it.loops < depth}{it.object != null}})
==>null
gremlin> sg=new OrientGraph('remote:localhost/scratch')                                                                               
==>orientgraph[remote:localhost/scratch]
gremlin> sg.V('type','LSNetwork').children(3).name
==>Spine 0
==>Spine 1
==>Leaf 0
==>Leaf 1
==>Leaf 2
==>Leaf 3

(注意:名称正确,我希望看到的是正确的名称)。

为什么我的gremlin脚本可以在gremlin控制台上运行,而不是通过bulbs / rexster运行?

在此先感谢您,我们将为您提供任何帮助,见解或指向适当文档的指导。

斯蒂芬·马勒

使用codeveloper文档中定义步骤版本时,我对此没有任何问题

$ curl "http://localhost:8182/graphs/tinkergraph/tp/gremlin?script=g.v(1).codeveloper.name"
{"success":true,"results":["josh","peter"],"version":"2.5.0","queryTime":39.294181}

似乎也可以在Dog House工作。我最好的猜测是Rexster找不到脚本。您确定您的<init-scripts>设置路径正确吗?如果正确指定并加载了初始化脚本,则应该看到此日志条目:

[INFO] EngineHolder - ScriptEngine initializing with a custom script

ScriptEngine启动之前,您将不会看到它,直到您对它发出请求(即,如我上面的curl命令)之后才会看到它

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Gremlin 查询适用于 TinkerGraph、JanusGraph 和 Neo4j,但不适用于 DSE Graph 6.8.1

适用于 PHP 但不适用于脚本

ssh私钥适用于root用户,但不适用于普通用户

.pgpass适用于一个用户,但不适用于postgres用户

SAS:左联接适用于定义的号码,但不适用于选定的号码列表

自定义链接功能适用于GLM,但不适用于mgcv GAM

自定义元素适用于Safari,但不适用于Firefox和Chrome

CSS 适用于自定义标签但不适用于 DIV?

用户定义的功能不适用于Pandas

HashMap不适用于用户定义的键类

RDD 减法不适用于用户定义的类型

用户定义的容器不适用于std :: ranges

绑定不适用于用户实例

localStorage不适用于用户帐户

授权不适用于用户搜索

用户选择不适用于 a:visited

全局SSH密钥,适用于root用户,但不适用于其他用户

AutoMapper 不适用于定义的规则

自定义用户身份验证适用于 python3.5,但不适用于 python3.6

带有 WebApi 的 Dnn SPA 模块适用于管理员,但不适用于注册用户

substringWithRange适用于硬编码字符串,但不适用于用户输入的字符串

get_user_by('ID',7)适用于用户,但不适用于管理员

Tailwind CSS自定义颜色适用于文本,但不适用于ReactJS中的背景

Magento:自定义模块适用于本地主机但不适用于服务器

适用于用户定义的类型

不适用于参数()

instanceof 不适用于“或”

IndexRoute 不适用于“/”

表单验证不适用于多步骤表单