Re: RM and definition of relations/tuples

From: Mikito Harakiri <mikharakiri_nospaum_at_yahoo.com>
Date: 23 Nov 2005 15:40:15 -0800
Message-ID: <1132789215.853317.56170_at_g44g2000cwa.googlegroups.com>


Martin Zapf wrote:
> I have a question to the Relational Model and the definition of
> relations and tuples.
>
>
> I learned the following definitions:
>
> A relation schema R is a set of Attributes R={A_1,A_2,...,A_n}
> Each Attribute A has a domain dom(A)
>
> Here comes the problem, there are two definitions for relations/tuples
>
> 1. defintion:
>
> A relation r for schema R is a mathematical relation (cartesian
> product) over the
> domains from the attributes of R.
> So r:=dom(A_1)xdom(A_2)x...xdom(A_n)
> A tuple is an element of r.
>
> 2. definition
>
> A relation r for schem R is a set of tuples.
> A tuple t is a function
> t: R -> Union (dom(A_1),dom(A_2),...,dom(A_1))
> t maps each Attribute of R to an value of its domain.
> So a relation is a set of functions, which are called tuples.
>
>
> I noticed, that the difference between this two definition is that
> definition 1 forces a certain order for the Attributes and the values
> for them in the tuples.
> The 2. definition doesnt need any order for the attributes.
>
>
> Im quite confussed, is there a "better" definition or should you always
> use both?

Don't quite understand your question. Unnamed perspective is formally dependent on the order of the attributes. Relational operators, however, are order agnostic. Cartesian product, for example, wouldn't be associative and commutative, if we take attribute order literally.

The other idea, which the Alice book puts forward, is that there is a natural correspondence between the named and unnamed perspective...

As long as you asked about "better" definition, I take the opportunity to digress the discussion to the axiomatic side of it. So you have defined relations and tuples, now what? Well, there are 6 (or 5 1/2) relational operators. Ok, but where are the axioms?

Alternative definition.
A relational system is a set Rho (capital letter) of elements called relations together with the two binary operations \/ and /\
which meet lattce axioms (idempotence, commutativity, associativity, and absorption)
In addition to that, there are 4 special elements (or nullary operations)
00, 01, 10, 11

Informally,
\/ is union
/\ is join
00 is empty relation with empty set of attributes 01 is the relation with empty set of attributes and 1 row 10 is the empty relation with attribute set that contains the union of all the attributes among all the relations in the system 11 is the cartesian product of all the domain relations

Additional axioms. For any R, A, B, and C: 01 \/ R = 01 (01 is the minimal element) 10 /\ R = 10 (10 is the maximal element) R = (00 /\ R) \/ (11 \/ R) (decomposition of R into attributes and tuples)

R /\ 00 maps the set of all the relations into a boolean algebra of all the attribute relations (the attribute relation is the empty relation with a given set of attributes)
R \/ 00 maps the set of all the relations into a boolean algebra of just the two elements {00, 01}
R /\ 11 maps the set of all the relations into a boolean algebra of all tuples
R \/ 11 maps the set of all the relations into a boolean algebra the domain relations Received on Thu Nov 24 2005 - 00:40:15 CET

Original text of this message