# Re: Initial draft of Design:Aggregate

From: Chimezie Ogbuji <ogbujic@ccf.org>
Date: Tue, 11 Aug 2009 09:40:48 -0400
To: "Seaborne, Andy" <andy.seaborne@hp.com>, "SPARQL Working Group" <public-rdf-dawg@w3.org>
Message-ID: <C6A6ED20.BCA8%ogbujic@ccf.org>
```Hey Andy

On 8/10/09 9:10 AM, "Seaborne, Andy" <andy.seaborne@hp.com> wrote:
>> http://www.w3.org/2009/sparql/wiki/Design:Aggregate
> Hi Chime,
> Yes - including LaTeX is hard. I think you can cut-and-paste the symbols into
> the wiki text because it's all UTF-8 HTML but that's a bit fragile and only
> marginally better.

Okay, thanks.  I'll give that a try

> I took tried to write out some formal definitions to check my understanding:
> is this the sort of thing you had in mind?
>
>
> Single valued function: returns a solution projected down to named variables
> only:
>   key(varlist, mu) = { (v,x) | (v,x) in mu, v in varlist }
>
> and the set of all keys:
>   key(varlist, Omega) = { k | mu in Omeag, k=key(varlist,mu) }
>
> The partition of the multiset Omega is:
>   Partition(varlist, Omega) = { (k,mu) | mu in Omega, k=key(varlist, mu) }

Yes, this needs to return a set from the multiset and varlist in order to
ensure uniqueness of the partitions.

> Let agg(VarList,SubOmega) be the aggregation function run on a multiset of
> solutions taking variables VarList
>
> Aggregation(VarList, FuncAndVars, Omega, Mu) =
>    { merge(k, (Vout, agg(Vin,X)) | (k, X) in Partition(varlist, Omega),
> FuncAndVars=(f, Vin, Vout), agg in set f }

I believe we are on the same page.

> Aside: we may need to restrict variable Vout so it does not clash with the
> key.

Yes.

> One last point: do we want GROUP BY expressions, not just variables?  In think
> we do; does create some issues about the projected down variables that are
> arguments to the partitioning expression.
> Some SQL systems put a random
> selection (AKAK first found?) but I prefer to not include the variables of an
> expression at all so as to get ehy same results each time.
>
> Andy

Good question, I don't know off head (will need to chew on that).

-- Chimezie

===================================

P Please consider the environment before printing this e-mail

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2008).
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.

Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If