| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: RA with MV attributes
Marshall wrote:
> On Jan 16, 6:51 pm, "David" <davi..._at_iinet.net.au> wrote:
>
>>Marshall wrote: >> >>>On Jan 16, 4:48 pm, "David" <davi..._at_iinet.net.au> wrote: >> >>>Furthermore you will find that this property holds true of many >>>functions over generic types. Consider a simple generic list >>>type supporting a "get first element" operation. The type of >>>the generic list is parameterized by the element type T. >>>The type of getFirstElement() is int -> T. Hence the getFirstElement >>>operation could also be said to "calculate the type" but if you >>>code this up in, say, C++, the type calculating occurs entirely >>>at compile time. >> >>>>To avoid the infinite regress you should say >>>>1. A relation value r comprises both A(r) and T(r). >>>>2. The *type* of all relation values is the same: ie "relation" >>>>3. T(r) on its own is not a relation value >>>>4. The type of T(r) is "set of tuples", not "relation" >> >>>>BTW saying "r is a relation value" is naff. Really should say "r >>>>is a relation". >> >>>That doesn't work for me. In 2, your proposal only considers >>>abstract, parameterized type "relation" and doesn't consider >>>concrete relation types. >> >>1 & 2 are saying *by definition* there is a type called "relation".
>> It is neither abstract nor parameterised.
>>Why can't we say that *by definition* the set of attributes of a >>relation is part of its state not its type?
>>Here's an analogy. A C++ library provides a matrix class that is not
>>parameterised on the number of rows and columns. You can write this
>>
>> void foo(int n,int m)
>> {
>> Matrix A(n,3), B(3,m);
>> Matrix C = A * B; // Size = n x m
>> }
>>
>>The non-parameterised type also allows for mutative operations that add >>or remove rows and columns.
>>>In 4, you draw a distinction between >>>a set of tuples and a relation, but those are equivalent as far >>>as I know. Can you explain the distinction? >> >>4 follows from 1 which is a definition of the type "relation". My >>point is that it is self consistent.
>>Consider this: In mathematics a function is defined on a particular >>domain and codomain. Restrict the domain and you have a *different* >>function. Otherwise we can't make statements about whether a given >>function is 1:1 or onto. This suggests that domain and codomain >>should be regarded as *properties* of a given function.
>>A similar >>thing seems to be true for a relation - it is more than its set of >>tuples. Note in any case that I defined a tuple to be a mapping on >>A(r), so therefore you can't really disconnect the tuple from the set >>of attributes anyway.
A quibble: If one accepts that a type is a set of values and the operations defined on those values, then "3" is "part of the type" as it is an element of the value set.
> Types may disappear (or not) at runtime; values do not exist at
> compile time. If we remove this distinction, we remove valuable
> capabilities from our language.
I don't follow that at all. Types and values just are.
> A simple example:
>
> Consider the idea of join compatibility. This is violated if we attempt
> to join two relations each having an attribute of a given name but a
> different type in each relation. Now, whatever your feelings
> about how this should be handled, warning, error, whatever, we have
> to consider the question of when and whether this situation can be
> detected.
I assume by "different type" you mean neither type shares a subtype other than the universal subtype.
> Under a system in which we consider the attributes as part of the
> static type, and not part of the value, the presence or absence of
> join compatibility in a given query can be established by looking
> *only at the query* and not at the value of any of the operands.
> In other words, if the query is included in some source code, we
> can analyze the source code *without ever running it* and determine
> exactly the status of join compatibility. (Let me know if this needs
> further explanation.)
>
> Under a system in which we consider the attributes as part of the
> value, and under which we have a single universal type "relation";
> we *cannot* determine this ahead of time. Join compatibility checking
> *has to* be deferred until runtime, and it has to be checked
> every time a join occurs.
>
>
>
>>>>I presume in a proper general purpose system strong typing of relvars >>>>won't work. Having to specify the type of relvars would be painful. >> >>>Well, the term "strong typing" is fraught with peril, but assuming >>>you mean "static typing" then I don't see why you think this >>>would be an issue. Consider that a CREATE TABLE statement >>>specifies the type of relvars. >> >>>>It would also disallow conditional projection, such as >> >>>> relation r = test ? r1 : proj(r1,B) >> >>>>...not that I have an example of where that would be useful. >> >>>I think you will find that *every* language with a ? : operator >>>does not allow the two possible results to have incompatible types. >> >>That's my point. That's why it seems better to have a >>non-parameterized type called "relation".
Uh, yup. Received on Wed Jan 17 2007 - 07:43:45 CST
![]() |
![]() |