我正在使用 OrientDB 2.1.6 并具有以下 Gremling 示例查询:
g.V("username", "testark").out("IsFriendsWith").height.mean()
这在 Gremlin shell 上效果很好,但我需要能够在 Java 中使用它。使用 Java Graph API,我可以将其中的大部分内容转换为
final GremlinPipeline<Long, Vertex> pipe = new GremlinPipeline<>(orientGraph);
pipe.V("username", "testark").out("IsFriendsWith").property("height").????????
但不是,我似乎找不到与 mean
函数等效的东西。我当前的解决方法是根据 property
的返回值“手动”计算平均值,但我显然更喜欢通过 Gremlin 从数据库中获取该值。谁能告诉我mean
相当于什么?
最佳答案
mean
函数是 gremlin-groovy 的一个方法,因此您不会在 Java 端找到它:
您需要按照您正在做的方式进行操作并手动计算平均值。
关于java - Java 中 Gremlin 的 "mean"等效项(蓝图 2.6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34006471/