Use @groupby, @normalize as a source for a variable

I was hopping to be able to save the result of an aggregation into a variable and use that later somehow together with count(uid(variable)) to get the cardinality of the “buckets” of an @orderby.

Like in

{
  var(func:type(Office))  {
    officename: Office.bezeichnung
		CNT as Office.jobs @groupby(Job.employees)
  }
 q(func: uid(CNT))  {
    total: count(val(OJ))
  }
}

I know this query is invalid, but I am interested in the number of buckets the @groupby results in and fr this to be effective I think I should be able to assign variables at the @groupby-level.

Btw, this question really is a “generalisation” of my example in Unique count of edges

1 Like