Re: Generic Modeling
Date: 5 Jan 2002 15:58:31 -0800
Message-ID: <60360d48.0201051558.776b9f65_at_posting.google.com>
jraustin1_at_hotmail.com (James) wrote in message news:<a6e74506.0201041458.2b5137df_at_posting.google.com>...
> > You can't compare tables to objects.
> In XDb, an object can be a class, an instance or both at the same time
> and they have nearly the same properties and methods. It is this type
> of orthogonality that allows an oodb to implement solutions in a more
> general manner than rdbs.
And this is the same as my system, which I am implementing in Oracle9i (an SQL database). In the same way that XDb doesn't have a seperate idea of "class", my system doesn't seperate objects into tables based on their properties. Instead, each object is stored in the same table and I'm only using tables as a concrete storage mechanism.
> In XDb, each object is the instance of its class. In turn, each
> instance can be the class for new instances and this process can be
> extended. Therefore, an object can be both a class and an instance.
> The root is the ancestor class of all other objects and is the only
> object without a class (or parent).
>
> For example, Person is the instance of Root. John, Mary and Doctor are
> instances of Person. Dr. Brown, Dr. Smith and Surgeon are instances of
> Doctor, etc.
>
> Are you modelling inheritance of this type in your "generic model"?
Yes, I am actually doing exactly this. But I will point out that I think that "Doctor" is not an instance of "Person" and "Surgeon" is not an instance of "Doctor" but rather these are specializations (subclass relationships). At least, that is how I will model it below since my system distinguishes very distinctly between the "instance of" and "subclass of" relationships. Also, my system is not singly-rooted. My system would store the following facts:
Level M2:
The definition of <Class> and <Attribute>,
and the definitions of the "subclass of", "has an",
and "is" relationships, which are omitted.
Level M1:
<Person> is an instance of <Class>
The <Class.name> of <Person> is "Person"
<Person> has an <Attribute> <Person.first_name> of type <String>
<Person> has an <Attribute> <Person.last_name> of type <String>
<Doctor> is an instance of <Class>
<Doctor> is a subclass of <Person>
The <Class.name> of <Doctor> is "Doctor"
<Surgeon> is an instance of <Class>
<Surgeon> is a subclass of <Doctor>
The <Class.name> of <Surgeon> is "Surgeon"
Level M0:
<John> is an instance of <Person> <Mary> is an instance of <Person> <Brown> is an instance of <Doctor> The <Person.last_name> of <Brown> is "Brown"<Smith> is an instance of <Doctor>
The <Person.last_name> of <Smith> is "Smith"
My system is based on OMG MOF, which has "levels" such that each object is an instance of an object in the previous level. In general, each item in <Brackets> represents one object. All objects are stored in one table. The relationships between objects are stored in another table.
- Brian