Re: Theory Question--Two tables relating in more than one way?
Date: 1 Mar 2005 13:02:53 -0800
Message-ID: <1109710973.795156.310310_at_o13g2000cwo.googlegroups.com>
> owner has at least one primary car and may have others. > .. car could have more than one owner ..
Following script models above with an experimental db (XDb3):
// Create person type and add to directory.
(CREATE type inst *person & dir item it)
// Create car type and add to directory.
(CREATE type inst *car & dir item it)
(CREATE type inst *vin)
// Create predicate own.
(CREATE verb inst *own)
// Create john owns a chevette and two corvettes.
(CREATE person inst *john)
(CREATE john own (CREATE car inst *chevette & it vin +MX369))
(CREATE john own (CREATE car inst *corvette & it vin +H867Q))
(CREATE john own (CREATE car inst *corvette & it vin +ZD732))
// Create mary who also owns 2nd corvette above.
(CREATE person inst *mary)
(CREATE mary own (* vin ZD732))
// Find vin of cars owned by both john and mary.
// Finds ZD732.
(SELECT (car inst * & john own * & mary own *) vin *)
// Deleting "john own chevette" makes 1st corvette his primary car. Received on Tue Mar 01 2005 - 22:02:53 CET