![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I was trying to lookup some old posts, maybe started by Marshall, not sure about that, to do with defining keys. Finally gave up, for some reason the google new archive isn't my cup of tea. I remember thinking that keys could be defined algebraically something like this: Let {K} stand for the set of attributes of r that make a key, ( r GROUP ( {K} AS k ) ) {k} = ( r {K}) GROUP ( {K} AS k)) {k} will be true when r satisfies the key constraint. ( r GROUP ( {K} AS k ) ) {k} MINUS ( r {K}) GROUP ( {K} AS k)) {k} will contain rva's that include the keys of tuples that violate the constraint. UNGROUP could also be used. Seem to remember some objection or other, but not exactly what it was. ... |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
( r GROUP *( { N } AS n ) ) *= *( EXTEND *r *ADD *( RELATION { TUPLE { N * } *AS *n ) *{ K, n } |
#5
| |||
| |||
|
|
On Apr 7, 3:05*am, paul c <toledobythe... (AT) oohay (DOT) ac> wrote: ( r GROUP *( { N } AS n ) ) *= *( EXTEND *r *ADD *( RELATION { TUPLE { N * } *AS *n ) *{ K, n } How about A join project_K(A)=A? |
#6
| |||
| |||
|
|
How about A join project_K(A)=A? This is not a constraint. [...] |
#7
| |||
| |||
|
|
On Apr 7, 3:05 am, paul c <toledobythe... (AT) oohay (DOT) ac> wrote: ( r GROUP ( { N } AS n ) ) = ( EXTEND r ADD ( RELATION { TUPLE { N } AS n ) { K, n } How about A join project_K(A)=A? ... |
|
... No counts, nesting or aggregates there, ... |
#8
| |||
| |||
|
|
On Apr 8, 6:59*pm, Vadim Tropashko <vadim... (AT) gmail (DOT) com> wrote: How about A join project_K(A)=A? This is not a constraint. [...] As I spelled it, no, it indeed isn't; a hardy remainder of why I should never try to do any mental calculation or to device any new notation to suit my intuitions. But I'll try again: perhaps I meant to say A join_K A=A instead, without renaming attributes.. We want to express K_1=K_2 => (A\K)_1=(A\K)_2, algebraically and point-free. The basic idea remains the same: no extra tuples. |
#9
| |||
| |||
|
|
On Apr 8, 10:18 am, Sampo Syreeni <de... (AT) iki (DOT) fi> wrote: On Apr 8, 6:59 pm, Vadim Tropashko <vadim... (AT) gmail (DOT) com> wrote: How about A join project_K(A)=A? This is not a constraint. [...] As I spelled it, no, it indeed isn't; a hardy remainder of why I should never try to do any mental calculation or to device any new notation to suit my intuitions. But I'll try again: perhaps I meant to say A join_K A=A instead, without renaming attributes.. We want to express K_1=K_2 => (A\K)_1=(A\K)_2, algebraically and point-free. The basic idea remains the same: no extra tuples. Algebraically and point free -- no argument there. Unless I understand your idea differently, from my perspective "point-free" algebraic notation means no mentioning attribute sets whatsoever. I'm not sure what Paul meant by "key constraint", but inclusion dependency is expressed algebraically (http://arxiv.org/abs/0902.3532) as r v x < s v x To think of it: this kind of inequality is the simplest expressionn that one can manufacture from 3 relation symbols and relational operations, so no wonder it is important. The functional depndency constraint, is entirely different animal, however. It can be expressed with the count ("given a function argument the number of values in the range of is no more than one"), but this is outside the scope of relational algebra. The other (rather neat) construction from database folklore involves partitions (http:// vadimtropashko.wordpress.com/relational-lattice/lattice-perspective- into-funcional-dependencies/) |
#10
| |||
| |||
|
|
say A join_K A=A instead, without renaming attributes.. We want to express K_1=K_2 => (A\K)_1=(A\K)_2 |
|
True, this is still hazy logic, but not quite as bad as my previous post. And even if it needs emendation, the gist of the argument should be clear. |
![]() |
| Thread Tools | |
| Display Modes | |
| |