Java 中 Gremlin 的 "mean" 等价物(蓝图 2.6)
Gremlin's "mean" equivalent in Java (Blueprints 2.6)
我正在使用 OrientDB 2.1.6 并有以下 Gremling 示例查询:
g.V("username", "testark").out("IsFriendsWith").height.mean()
这在 Gremlin shell 上非常有效,但我需要能够在 Java 中使用它。使用 Java 图 API 我可以将其中的大部分翻译成
final GremlinPipeline<Long, Vertex> pipe = new GremlinPipeline<>(orientGraph);
pipe.V("username", "testark").out("IsFriendsWith").property("height").????????
但不是 我似乎找不到与 mean
函数等效的函数。我当前的解决方法涉及根据 property
的 return 值计算平均值 "manually",但我显然更愿意通过 Gremlin 从数据库中获取该值。谁能告诉我 mean
的等价物是什么?
mean
函数是 gremlin-groovy 的一个方法,因此您不会在 Java 端找到它:
您需要像现在这样手动计算平均值。
我正在使用 OrientDB 2.1.6 并有以下 Gremling 示例查询:
g.V("username", "testark").out("IsFriendsWith").height.mean()
这在 Gremlin shell 上非常有效,但我需要能够在 Java 中使用它。使用 Java 图 API 我可以将其中的大部分翻译成
final GremlinPipeline<Long, Vertex> pipe = new GremlinPipeline<>(orientGraph);
pipe.V("username", "testark").out("IsFriendsWith").property("height").????????
但不是 我似乎找不到与 mean
函数等效的函数。我当前的解决方法涉及根据 property
的 return 值计算平均值 "manually",但我显然更愿意通过 Gremlin 从数据库中获取该值。谁能告诉我 mean
的等价物是什么?
mean
函数是 gremlin-groovy 的一个方法,因此您不会在 Java 端找到它:
您需要像现在这样手动计算平均值。