Re: constraints in algebra instead of calculus

From: Jon Heggland <jon.heggland_at_idi.ntnu.no>
Date: Mon, 18 Jun 2007 09:15:34 +0200
Message-ID: <f55bem$q9r$1_at_orkan.itea.ntnu.no>


paul c wrote:
> It's looking to me now that you are right about WRAP and that I too was
> confusing it with GROUP, so maybe the constraint should look like:
>
> R{B} WRAP {B} as gB = R{B} GROUP {B} as gB,

No. On the left, gB is a tuple, while on the right, it is a relation. If you disregard that difference (I wouldn't), your constraint will hold iff R{B} has at most one tuple---not very interesting.

(WRAP is like EXTEND--it doesn't change the cardinality---while GROUP is like SUMMARIZE or project---reducing the cardinality based on the projection on a set of attributes. Loosely speaking. :)

R{B} WRAP {B} AS gB = (R GROUP {B} AS gB) {gB}

or better (as Jan Hidders writes, avoiding the tuple/relation mismatch):

(R EXTEND ( RELATION { TUPLE { B B } } AS gB )) {gB} = (R GROUP {B} AS gB) {gB}

makes more sense. Afaict, this is a superkey constraint, but imo not a particularly elegant, intuitive or efficient one. :)

> also that as far as TTM/Tutorial D is concerned, Bob B was right about
>
> R{B} GROUP {B} as gB = (R GROUP {B} as gB) {gB} being a tautology.
>
> p (waiting to be corrected for the umpteenth time!)

Here ya go:

R = { (A:1, B:2), (A:3, B:4) }

R{B} GROUP {B} AS gB = { (gB:{ (B:2), (B:4) }) }

(R GROUP {B} AS gB) {gB} = { (gB:{ (B:2) }), (gB:{ (B:4) }) }

I think all this indicates that GROUP is such a difficult operator that using it to express constraints is a bad idea. :)

-- 
Jon
Received on Mon Jun 18 2007 - 09:15:34 CEST

Original text of this message