Sentences expressed as ORM
[1/1] from: AJMartin::orcon::net::nz at: 24-Jan-2004 11:49
Hi!
Some time ago we had a look at the Sentences database product and how it
could be expressed in Rebol as a general database. At the time, I couldn't
figure out to put it together. Just today, I came across ORM or Object Role
Modelling at http://www.orm.net/ which is where I think that Sentences came
from.
I also figured out a Rebol implementation of ORM that's easy to understand
and use (and seems easy to explain). Here's Table 1 from Business Rules and
Object Role Modeling:
{
Athlete Country Birthplace
Ann Arbor USA USA
Bill Abbot UK ?
Chris Lee USA NZ
}
And here's the facts (or "objects"):
Athlete [
"Ann Arbor"
"Bill Abbot"
"Chris Lee"
]
Country [
"USA"
"UK"
"NZ"
]
and their roles (or relations):
Athlete "represents" Country "represented by" [
1 1
2 2
3 3
]
Athlete "was born in" Country "birthplace of" [
1 1
; Note that the birthplace of "Bill Abbot" is unknown.
3 3
]
I've even added an extra unary relation/role:
Athlete "smokes" [
2
]
The dialect for roles/relationships is:
Unary
Fact opt "relationship string" block of integer indexes
Binary
Fact "relationship string" Fact "reverse relationship" block of pairs of
integer indexes.
Ternary (I think!)
Fact "relationship string" "reverse relationship" Fact "relationship"
reverse relationship Fact block of pairs of integer indexes.
For a small-ish database, one file holding the above information would be
OK. For a much larger database, I'd use a file for each block of
facts/objects, and a file for each block of relationships.
--
Andrew J Martin
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/