42. A system comprising: one or more computers and one or more storage devices storing instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising: receiving input specifying, explicitly or implicitly: an aggregation function agg; <to_agg>, a variable that will contain values to be aggregated; <variables>, one or more variables that are local to <range> and <term>; <range>, a constraint on the values of the variables <variables> that defines a relation s that has a domain and a range, wherein the domain of s is free variables and the range of s is variables listed in <variables>; <term>, a constraint that constrains <to_agg> to values that will be aggregated, which defines a relation t that has a domain and a range, wherein the domain of t is the variables listed in <variables> and the range of t is <to_agg>; and a recursive relation definition that has a recursive term, the recursive term including an aggregation construct agg* for the aggregation function agg; and evaluating the recursive relation definition, including evaluating the aggregation construct agg* for the aggregation function agg according to the semantics 
 agg*( s,t )={( m ,agg( n ))|∃ d :( m,d )ε s,nεΠ{|t ( y )| yεs ( m )|}}.
48. The system of claim 42 , wherein receiving input comprises: receiving input specifying arguments for the aggregation construct agg* that explicitly include <to_agg>, <variables>, <range>, and <term>.