Gremlin:无法对边进行排序并返回顶点

时间:2015-04-12 19:25:46

标签: gremlin tinkerpop-frames

我正在尝试编写一个Gremlin查询来使用Tinkerpop框架遍历图形。

这是我的代码:

@GremlinGroovy("it"
            + ".outE"
            + ".filter{it.label=='usedwith'}"
            + ".sort{-it.weight}"
            + ".toList()"
            + ".reverse()"
            + "[start, 'start+size']"
            +"._"
            + ".inV")
public Iterable<Ingredient> getMostUsedWith(@GremlinParam("start") int start, 
                                            @GremlinParam("size") int size);

我基本上想要从当前顶点获取所有边缘的'usedwith'类型,根据权重属性降序排序,然后从这些边指向的顶点列表中获取一个页面。

可悲的是,这段代码不起作用,并且会引发很多错误。你能修改一下吗?

1 个答案:

答案 0 :(得分:1)

也许您可以将查询编写为:

it.outE('usedwith').order{it.b.weight <=> it.a.weight}.inV[start..(start + size)]
相关问题