Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to model object containment in relational
asya_at_bayarea.net (Asya Kamsky) wrote
> I have a list of base_objects and containers (a table for each:
> object_table (id, name) and container_table (id, name).
>
> Containers contain objects. That's simple to model. However
> containers can also contain containers. Is there a cleaner
> way to represent that relationally than
> join_table (container_id, container_or_object_id, flag) where
> flag says whether the containee is itself container or object.
I would approach it using the following to relational tables (assumming a relational DB implementation with an OO interface layer).
Class = ( class_id[pk], class_name[unique], parent_class_id[fk] )
Object = ( object_id[pk], class_id[fk], object_name[unique], parent_object_id[fk] )
Both classes and objects can be nested - i.e. you can have bases classes and any number of sub-classes and derived classes. Objects also can be instantiated in a hierarchical way, where you get parent and child objects.
On the the physical implementation I would consider partitioning and IOT and possible clusters.
On top of this I would design Oracle UDTs that provides the interface to these two tables.
What is missing from this design is the
implementation/handling/management of class methods and object
properties... but seeing that the user specs/requirements in this case
are non-existant, that's not surprising. :-)
-- BillyReceived on Thu Mar 18 2004 - 02:21:34 CST