Re: Demo: John, Mary and R2D2

From: Neo <neo55592_at_hotmail.com>
Date: 16 Nov 2004 09:35:31 -0800
Message-ID: <4b45d3ad.0411160935.7c8e433c_at_posting.google.com>


> From thread titled "Relational vs network vs hierarchic databases"
> Browne: Perhaps you should try finding something that _can't_ be easily
> modelled in a relational model, instead.
>
> Neo: How would one represent the following without redundancy or NULLs?
> john like mary.
> mary like john.
> (john like mary) because (mary like john).
> bob hit mary on elbow.
> john hit bob on shoulder during lunch.
> (john hit bob on shoulder during lunch) because (bob hit mary on elbow).
>
> Marshall: ... *representation* per se isn't that big of a problem.
>
> Neo: Then please post it using RM observing good practices
> such as avoiding NULLs and redundancy.
>
> Marshall: With regards to what set of operations? Otherwise I'm going to
> stick with my "string" answer, because it's easiest.

With regards to the below queries (on new data set: John, Mary, R2D2)

// Who did mary bite?
// Finds r2d2.
SELECT2 mary.bite = %;

// Who hit mary?
// Finds r2d2.
SELECT2 %.hit = mary;

// What did r2d2 do to mary?
// Finds hit
SELECT2 r2d2.% = mary;

// What kind of thing likes john?
// Finds horse (not mary).
SELECT2 %.cls=thing & %.inst=(%.like=john);

// Why did r2d2 hit mary?
// Finds mary.bite=r2d2 before breakfast. SELECT2 (r2d2.hit=mary).because = %;

// What did john do to r2d2 after dinner? // Finds reboot.
SELECT2 john.%=r2d2 _at_after=dinner;

Let me know if you need me to convert XDb2's script to RM's equivalent normalized/NULL-less schema in a manner similar to that in thread titled "Demo: Db for Dummies". Received on Tue Nov 16 2004 - 18:35:31 CET

Original text of this message