Re: Demo: Modelling Cost of Travel Paths Between Towns
Date: 20 Nov 2004 12:10:00 -0800
Message-ID: <4b45d3ad.0411201210.7c3381de_at_posting.google.com>
Summarization:
Goal: To demo XDb2's flexibility compared to RM. In particular, to
show 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.
Neo: Assume RMDM and R2D2 are two robots sent to Mars. They have
similar hardware, OS and programs except for their dbs. RMDM is based
on RM and uses your above initial schema as shown below. R2D2 is based
on XDb2 which doesn't require user to specify a schema.
Alan's initial RM schema:
// Query to find things with age and name john ???
SELECT * FROM test WHERE age > 0;
Neo: Initial schema/query has some errors, please correct. Now 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:
// Execute query, finds nothing (for now)
SELECT %.age & %.name=john;
Please show how RMDM deals with the above scenario (without NULLs and
redundancy) starting with corrected initial schema.
Alan: Since I don't know his name, I have no way of uniquely
identifying him from any other Martian whose name I do not know. You
don't either.
Neo: In the above scenario, that is all the info available. At the
moment we are only concerned with representing that which the scenario
provides. Why are you trying to represent something not given or
known. It is possible to represent a thing without a name or age. You
just need to start with a more generic initial schema/query. Try
again.
CREATE TABLE test (class VARCHAR2() PK, name VARCHAR2() PK, age
NUMBER);
INSERT INTO test VALUES (put the values here);
SELECT * FROM test WHERE age > 0;
ALTER TABLE age ADD color VARCHAR2(50);
UPDATE age SET color = 'brown' WHERE class = 'Tree Trunk';
CREATE *martian.cls = thing; // Create a martian class
CREATE *; // Create a thing
CREATE it.cls = martian; // Classify it as a martian
Alan: I would need to create an artificial value to assign to his name, so I'll call him Neosense1. Maybe one day, he will use his real name, and I can issue a simple UPDATE statement.
Neo: Artifical values for NULLs, lead to 3VL. Do you understand why CJ Date's writes "NULLs and 3VL undermine the entire foundation of the relational model". If two martians are named "Neosense1", is it true or false that they have the same name?
Alan: INSERT INTO test VALUES(whatever they are, but name='Neotest1',
age='-1')
Neo: Which RM Db handles "whatever they are"? And your not serious
about age being -1 are you? Artifical values for NULLs, lead to 3VL.
Do you understand why CJ Date's writes "NULLs and 3VL undermine the
entire fuoundation of the relational model". If two martians have the