AG(val(varName))
For AG
replaced with
min
: select the minimum value in the value variable varName
max
: select the maximum valuesum
: sum all values in value variable varName
avg
: calculate the average of values in varName
Aggregation | Schema Types |
---|---|
min / max | int , float , string , dateTime , default |
sum / avg | int , float |
A
and B
are the lists of all UIDs that match these blocks. Value
variable x
is a mapping from UIDs in B
to values. The aggregation
min(val(x))
, however, is computed for each UID in A
. That is, it has a
semantics of: for each UID in A
, take the slice of x
that corresponds to
A
βs outgoing predicateB
edges and compute the aggregation for those values.
Aggregations can themselves be assigned to value variables, making a UID to
aggregation map.
json { var(func: allofterms(name@en, "Harry Potter")) { d as initial_release_date } me() { min(val(d)) } }
json { var(func: allofterms(name@en, "Harry Potter")) { d as initial_release_date } me() { max(val(d)) } }