OrientDB - Gremlin.compile()中变量的初始化

时间:2016-06-02 15:50:41

标签: groovy orientdb gremlin orientdb-2.1

http://gremlindocs.spmallette.documentup.com/#shortest-path

尝试弄清楚如何在Gremlin脚本范围内对集合进行初始化,同时在Java中形成Gremlin管道,以优化最短路径查询

Pipe pipe;
pipe = Gremlin.compile("s = _() as      Set;_().as('x').bothE().bothV().simplePath().loop('x'){it.loops<=7 }{ !(it.object.id in ['#"+fromId+"','#"+toId+"'])}.path.filter{it.last().TYPE==\""+toType+"\" && it.last().OBJECTREF==\""+toObjectRef+"\"}.path[0]");
pipe.setStarts(new SingleIterator<Vertex>(fromV));

我试图实现以下内容,这在上面的链接中有记录

gremlin> s = [root] as Set
==>v[0]
gremlin> target = '99'; c = 0;root.both().except(s).store(s).sideEffect{c++}.loop(4){it.object.id != target && it.loops <= 10}.has('id',target).path().iterate(); c
==>100

任何帮助将不胜感激

0 个答案:

没有答案