Re: Demo: Modelling Cost of Travel Paths Between Towns

From: Ed Prochak <ed.prochak_at_magicinterface.com>
Date: Sun, 14 Nov 2004 13:36:41 -0500
Message-ID: <FyNld.1009$Tu.566_at_fe39.usenetserver.com>


Neo wrote:

>>I thought YOU were the Original poster, at least that's how it looks

>
>
> The OP was in OT titled "Representing a Graph in an RDB...again...(BUT
> DIFFER...". For some reason, I failed to post there.
>
>
>>>CREATE2 (a.goto=b).weekday = +monday;
>>>The + indicates that if monday does not already exist as an instance
>>>of the verb (weekday), go ahead and create it.
>>
>>How does the language distinquish between the operation or changing the 
>>value to +1 from the operation of adding a new instance with the value 1.

>
>
> By enclosing it in quotes (ie CREATE2 (a.goto=b).weekday =
> +'+monday';). The portion after the optional + is the string that will
> name the new instance. The prior command creates a weekday named by
> the string '+monday' if it does not already exist. Currently UPDATE
> has not been implemented but it may look like this UPDATE2 john.age=35
> to 54; or UPDATE2 john.favorite-word="to" to "too";

I asked about NUMERIC operations. Sounds like your DB cannot do arithmetic like SQL:

update people set age=age+1 where name='john' ;

Too bad.
>
>

>>Matching that model in a Relational data model is easy enough.
>>(Joe Celko already posted a SQL model.)

>
>
> This problem didn't not have highly variable data and relationships or
> require a higher degree of normalization. This problem falls within
> RM's scope. Try adding a different property to each city or name two
> cites the same. RM solution will require some changes to schema and
> code already written against. XDb2 solution will be minimally
> affected. Script below shows how:
>
> // Add state property to existing town a
> CREATE2 *state.cls = thing;
> CREATE2 a.state = +texas;
>
> // Add population to existing town b
> CREATE2 *population.cls = thing;
> CREATE2 b.population = +10000;
>
> // Add a new town a, but in different state
> CREATE2 *a.cls = town;
> CREATE2 a.state = +florida;
>

Code changes can be minimal when using views. But it is annoying that you pose a toy example and then complain that the RM schema is a toy schema. The changes you suggest here would not be hard to add, even if we let the table become denormalized.

>
> In fact, in the original XDb2 solution, two towns could possibly have
> the same name. To distinguish them would require specifying which
> towns it goes to. For example suppose we change town c's name to
> string 'a' (via GUI). One can still find the original town a (top-left
> position) because only it goes to town b and what used to be town c
> (now named 'a') using the following query:
>
> SELECT2 %.cls=town & %.goto=b & %.goto=(%.cls=town & %.name='a');
>
> In RM's current solution, symbol and town name are the same thing
> resulting in inflexiblity in above case. In XDb2's solutions a symbol
> or string names a town which is a different thing than the symbol or
> string. RM has its own advantages which I did not list here.

Now your model seems at least as muddled as the RM solution. You cannot distinquish between the two towns named "a" with out strange contortions.

Now you are going to come back and say, something along the lines that c.name is different from a.name though they have the same values.

  Well then I would say Joe DID leave out an ID column in his model, and I would populate that with your object ID. In some databases, I wouldn't even have to do that, as it it possible to get a pseudo-column row ID value.

And yes I know many of RM advantages, I am losing any confidence of seeing advantages to your DB. The syntax is awkward, the model is hierarchical (ie, ancient), and your presentation is no well thought out. There may be advantages to your approach in some applications, but I haven't seen them so far. I'll try to keep an open mind, but you are losing me quickly.

-- 
Ed Prochak
running    http://www.faqs.org/faqs/running-faq/
netiquette http://www.psg.com/emily.html
--
"Two roads diverged in a wood and I
I took the one less travelled by
and that has made all the difference."
robert frost
Received on Sun Nov 14 2004 - 19:36:41 CET

Original text of this message