Matthias Broecheler created TINKERPOP-1212:
----------------------------------------------

             Summary: Better support for aggregation
                 Key: TINKERPOP-1212
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1212
             Project: TinkerPop
          Issue Type: Bug
            Reporter: Matthias Broecheler
            Priority: Critical


Currently, it is pretty verbose to write aggregate queries in Gremlin. For 
instance, consider a simple query that asks for the top 10 movies by average 
rating:

{code}
g.V().hasLabel("movie").order().by("avgRating",inE("rated").values("rating").mean(),
 decr).limit(10).values("id","name","avgRating")
{code}

The problem here is that you have to repeat that nested traversal in order to 
get the actual rating. What's even worse is the fact that this will be computed 
twice. In aggregates, it is very common to order and then retrieve by some 
aggregate. As such, we should be treating those as "virtual properties" on the 
elements that are being aggregated and be able to refer to them as properties:

{code}
g.V().hasLabel("movie").order().by(inE("rated").values("rating").mean(), 
decr).limit(10).group().by(inE("rated").values('rating').mean())
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to