Re: deductive databases

From: vc <boston103_at_hotmail.com>
Date: 17 May 2005 08:59:24 -0700
Message-ID: <1116345564.666824.203370_at_g14g2000cwa.googlegroups.com>


Please see in-line:

Simon Taylor wrote:
> In article <p56dnTmpwdoJWxTfRVn-sQ_at_comcast.com>, VC wrote:
> >
> > "Simon Taylor" <stayl_at_cs.mu.oz.au> wrote in message
> > news:428982b5$1_at_news.unimelb.edu.au...
> >> Nesting is not significant; it's allowing data structures to
express
> >> choice that increases the expressive power.
> >
> > Could you please elaborate on this one ?
>
> Nested data where there is no choice between function symbols
> can always be flattened into 1NF.

Sorry, could you give an example ?

>
> With function symbols / functors / algebraic data types:
> ---Table Person_Info --------------------------------
> Id Name Job_Info Salary
> -----------------------------------------------------
> 1234 "Anne" employed("lawyer") salary(10000)
> 1235 "Boris" employed("banker") unknown
> 1236 "Cindy" unknown salary(70000)
> 1237 "Dave" unemployed unsalaried
> -----------------------------------------------------
>
> Using NULLs, if there are multiple reasons for a field to be
> missing, it is impossible to distinguish between them.
>
> Special values are a poor solution because queries can mistake
> them for real data.
>
> With function symbols, any number of cases can be handled.
> When programming a query the programmer must explicitly handle
> the unknown or inapplicable values; they don't automatically
> propagate themselves through the query like NULLs, and they
> can't be mistaken for real data.
>
> In short, the version using function symbols has much more of
> a "say what you mean" flavour to it, and is simpler and more
> robust for it. The downside is that it is more difficult for
> application languages like C and Java to work with.

But using database user-defined types you can achieve precisely the same. E.g. in Oracle:

CREATE OR REPLACE TYPE salary AS OBJECT ( ...);

insert into emp values(1000, 'sam', salary('1000')); ...
insert into emp values(1010, 'nick', salary('unemployed'));

The same can be done in DB2 or any other database (Postgress) implementing user-defined types (also known as 'object' types).

Admittedly, the syntax is not as nice, but expressive power is there ;)

VC

>
> Simon Taylor.
Received on Tue May 17 2005 - 17:59:24 CEST

Original text of this message