Gremlin's "mean" equivalent in Java (Blueprints 2.6)

I'm using OrientDB 2.1.6 and have the following Gremling example query:

g.V("username", "testark").out("IsFriendsWith").height.mean()

This works great on the Gremlin shell, but I need to be able to use that from within Java. Using the Java Graph API I could translate most of it to

final GremlinPipeline<Long, Vertex> pipe = new GremlinPipeline<>(orientGraph);
pipe.V("username", "testark").out("IsFriendsWith").property("height").????????

but not I cannot seem to find the equivalent of the mean function. My current workaround involves computing the mean "manually" based on the return value of property, but I'd obviously prefer to get that value from the database via Gremlin. Can anyone please point out to me what's the equivalent of mean?

Answers


The mean function is a method of gremlin-groovy so you won't find it on the Java side:

https://github.com/tinkerpop/gremlin/blob/88de5e5d95bd0b704c5090c43a04a3d42992dfb9/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/PipeLoader.groovy#L28-L35

You would need to do as you are doing and manually calculate the mean.


Need Your Help

Cheetah with Cherrypy: how to load base templates, and do so automatically on change during development

python template-engine cherrypy cheetah

I am working on a cherrypy+cheetah app and would like to improve the development experience.

perl configuration file which contains variables?

perl configuration configuration-files

I want to create a perl configuration file. I want a file format which has variables. So something like this: