| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Theory Question--Two tables relating in more than one way?
> 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 - 15:02:53 CST
![]() |
![]() |