[ 
https://issues.apache.org/jira/browse/TINKERPOP-1212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15198317#comment-15198317
 ] 

Matthias Broecheler commented on TINKERPOP-1212:
------------------------------------------------

[~dkuppitz] How do I read that query? Why do you have to do "as" and then 
"select" the same thing? Are the "by"s modulating the select clause here? 


> Better support for aggregation
> ------------------------------
>
>                 Key: TINKERPOP-1212
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1212
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.1.1-incubating
>            Reporter: Matthias Broecheler
>
> 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