Value variables: filtering and ordering

If the context provided by the UIDs of the block is correct, value variables can also be used in filtering and ordering.

Here, ID will be the UID’s of all directors of name Steven and average is a map from those UID’s to the average for each director. The filtering, ordering and result for var(average) are evaluated in that context to obtain each value.

A value variable can be used in place of a UID variable, uid(<value-variable>) evaluates to the UID’s in the map. For example, the avs query block could be written:

avs(func: uid(average), orderdesc: val(average)) @filter(ge(val(average), 40)) @normalize {
Endpoint: /query