I'm using the Java embedded version of OrientDB and I wanted to execute some gremlin queries. So I'm using GremlinPipeline to do this. I was wondering how to do a groupBy.
Say each vertice contains a property "age", I want to do a group by on this property.
I tried doing following :
List a = new GremlinPipeline(graphDb.getVertices()).groupBy(new PipeFunction<Vertex, String>() {
public String compute(Vertex vertex) {
return "age";
}}, new PipeFunction<Vertex, Integer>() {
public Integer compute(Vertex vertex) {
return vertex.getProperty("age");
}}).toList();
System.out.println(a.toString());
But it's returning me all the vertices instead.
How to group them and count the number of items inside a group according to the property "age" ?