Re: What is Aggregation? Re: grouping in tuple relational calculus

From: Paul <paul_at_test.com>
Date: Fri, 18 Feb 2005 09:15:04 +0000
Message-ID: <4215b218$0$68538$ed2619ec_at_ptn-nntp-reader01.plus.net>


Mikito Harakiri wrote:

>>It would have to be commutative as well. Unless you want your aggregate
>>to require a sort order I suppose. In which case you could drop
>>associativity too!

>
> Can you give an example of an aggregate that violates accociativity? (For
> commutativity it's simple: just aggragate elements into a list, or
> concatenate a string.)

How about the function f(a,b) -> a*b + 1 ?

It's a commutative but not associative binary operator on some numerical domain (e.g. integers). You could aggregate this in the usual way but the aggregate would depend on the order that you did it.

Maybe it's not one you would use in practice but I'm sure there must be examples that are more realistic - all you need is a non-associative binary operator - maybe some matrix multiplication or something?

>>I don't think the binary operation has to have an identity element or
>>inverses does it? It just needs to be associative, commutative, and
>>closed for the general case.

>
> Neutral element is required. Otherwise what is your answer on an empty
> set/bag/list?

Ah yes. What is the rationale for having the neutral/identity element as the answer for an empty aggregate? Is it so that:

  SUM(A union B) = SUM(A) * SUM(B)

for non-overlapping relations A,B works in the case where A is empty? (where * is the binary operator that defines the SUM aggregate here)

So that structure is an associative & commutative semigroup? Where a semigroup is a group without the inverses requirement.

Paul. Received on Fri Feb 18 2005 - 10:15:04 CET

Original text of this message