Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Types and "join compatibility"

Re: Types and "join compatibility"

From: x <x_at_not-exists.org>
Date: Mon, 8 Aug 2005 13:02:07 +0300
Message-ID: <dd7aj1$a3e$1@domitilla.aioe.org>

"Marshall Spight" <marshall.spight_at_gmail.com> wrote in message news:1123487612.981221.298680_at_g14g2000cwa.googlegroups.com...

>Okay, difference I can see: what if the subtrahend has attributes
>that are not in the minuend? But that's not much of an issue;
>you either say 1) it doesn't matter; ignore it or 2) not allowed.
>It hardly matters which one you pick.

What about the type of t=(r(A)-(r(A)-s(B))) then ? Is t(A) or t(A\/B) or t(A/\B) ?

>But restrict? It's kind of weird in that it takes a relation and
>a predicate, (instead of two relations) but the result type is
>always the same as the relation. So what's the issue?

As you can see below, restrict take two relations and a mapping between the domains of them.
So restriction is a join followed by a projection. If there are questions regarding the type of a join, then there are questions regarding the type of a restriction.

Codd - Comm of the ACM Vol.13/Nr. 6/June 1970 : 2.1.5. Restriction. A subset of a relation is a relation. One way in which a relation S may act on a relation R to generate a subset of R is through the operation restriction of R by S. This operation is a generalization of the restriction of a function to a subset of its domain, and is defined as follows.

Let L, M be equal-length lists of indices such that L = i1,i2, ... , ik, M = jl , j2 , ... ,jk where k <= degree of R and k <= degree of S. Then the L, M restriction of R by S denoted R L|M S is the maximal subset R' of R such that Proj L (R') = Proj M (S).
The operation is defined only if equality is applicable between elements of Proj ih (R) on the one hand and Proj jh (S) on the other for all h = 1, 2,..., k.

The three relations R, S, R' of Figure 13 satisfy the equation R' = R(2,3)|(1,2)S.

R (s p j)
1 a A
2 a A
2 a B
2 b A
2 b B

S (p j)
a A
c B
b B

R' (s p j)
1 a A
2 a A
2 b B

FIG. 13. Example of restriction

> >One thing that troubles me is the
> >relationship between types and constraints.
> >To me it seems that types
> >and constraints overlap to a large degree.

>I propose they are completely distinct: types are checked
>only at compile time; constraints are checked only at
>runtime. Types can be checked without needing to look at
>values; constraints must be checked against runtime values.

But in TTM subtypes are defined by constraints. How can one check them at compile time?
They perform type checking in two steps: - at compile time by using a supertype (the declared type) - at run time (the most specific type)

>> One thing that troubles me is the
>> relationship between types and relationships.

>> A mathematical relation is a subset of a cartesian product of some sets.
>> As a set it can be defined by :
>> a) enumeration
>> b) properties

>> A database relation can be defined by:
>> a) the system
>> b) enumeration
>> c) relational expression

>> A TTM scalar type can be defined by
>> a) the system
>> b) union of some types - union type
>> c) cartesian product of some types
>> d) restriction on a cartesian product of some types

>> The case d) define a subset of a cartesian product of some sets which by
>> definition is a relation (not a relvar).

>> What is the active domain in the d) case ?

>Relation.

Why this overlapping between types and relations ? Received on Mon Aug 08 2005 - 05:02:07 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US