26. One or more non-transitory computer-readable storage media encoded with instructions that, when executed by one or more computers, 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 )|}}.
26. One or more non-transitory computer-readable storage media encoded with instructions that, when executed by one or more computers, 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 )|}}. 28. The one or more non-transitory computer-readable storage media of claim 26 , wherein only <term> contains a recursive reference.