Re: Demo: Modelling Cost of Travel Paths Between Towns
Date: Sun, 21 Nov 2004 18:29:11 GMT
Message-ID: <X75od.4589$hJ6.604_at_trndny01>
"Neo" <neo55592_at_hotmail.com> wrote in message
news:4b45d3ad.0411211019.646e3e_at_posting.google.com...
> Neo: Demo XDb2's flexibility compared to RM. In particular, that
> XDb2's query ("SELECT %.age & %.name=john;") to find any thing with
> age and name john, written once at design-time, continues to work
> forever regardless of what things have to be represented later. Assume
> RMDM and R2D2 are two robots sent to Mars. RMDM is based on RM and
> uses Alan's initial schema shown below. R2D2 is based on XDb2 which
> doesn't require user to specify a schema.
>
> Alan's initial RM schema:
> CREATE TABLE test (class VCHAR PK, name VCHAR PK, age NUMBER);
>
> Alan's initial RM query to find things with age and name john ???:
> SELECT * FROM test WHERE age > 0;
>
> Neo: Suppose RMDM and R2D2 meet a martian who doesn't have a name and
> his age is unknown. Here is how R2D2 represents him using XDb2:
>
> CREATE *martian.cls = thing; // Create a martian class
> CREATE *; // Create a thing
> CREATE it.cls = martian; // Classify it as a martian
>
> // Execute query, finds nothing (for now)
> SELECT %.age & %.name=john;
>
> Alan: RM's equivalent is...
> INSERT INTO test VALUES(whatever they are, but name='Neotest1',
> age='-1')
> SELECT * FROM test WHERE age > 0;
>
> Neo asserts: Provided RM schema incurrs NULLs in the above case which
> are being masked over by "Neotest1" and "-1" leading to 3VL. See
> "Missing Info" chapter in CJ Date's "Intro to Db Systems" which ends
> with "NULLs and 3VL undermine the entire foundation of the relational
> model".
>
> Alan asserts: There are no NULLs, but unknowns are represented by
> "Neotest1" and "-1" and are known by users and progammers of the
> system.
>
> Neo: Next case, suppose RMDM and R2D2 meet a second life form. It can
> be classified as a martian and plutonian, he has two names and three
> ages. Here is how R2D2 represents him using XDb2:
>
> CREATE *plutonian.cls = thing; // Create plutonian
> CREATE *age.cls = thing; // Create age
> CREATE *; // Create a thing
> CREATE it.cls = martian; // Classify it as a martian
> CREATE it.cls = plutonian; // Classify it as a plutonian
> CREATE it.name = mary; // Set its 1st name
> CREATE it.name = john; // Set its 2nd name
> CREATE it.age = +1; // Set its 1st age
> CREATE it.age = +2.5; // Set its 2nd age
> CREATE it.age = +thirty; // Set its 3rd age
>
> // Execute query, finds the above life form
> SELECT %.age & %.name=john;
>
> Could you show how RMDM handles above case, else provide updated RM
> schema and query.
I will not bother to post the code, as everyone else here will know what it is, and I have better things to do than prove to you something that everyone else here already knows. Figure it out for yourself, or don't. I don't care. Again, the problem you repesent is quite trivial. You have modified the situation so 1:M relationships exists. This simply entails:
- Creating an "artificial" PK.
- Creating additional tables (one for name, one for age)
- Doing the necessary inserts and updates.
It is really no big deal, but I usually get paid for doing this, so, as I said, figure it out yourself. Received on Sun Nov 21 2004 - 19:29:11 CET
