[Zope-dev] RFC: RelationAware class for relations between objects

Shane Hathaway shane@zope.com
Sat, 3 May 2003 12:00:15 -0400 (EDT)


On Sat, 3 May 2003, [iso-8859-1] Roch=E9 Compaan wrote:
> I am not quite sure how either model can be the basis for the API? Both
> models are conceptual tools for visualising data, relationships, etc.

SQL is based on the relational model.  The API of most of the
"relationship"  Zope products I've heard about are based on the
entity-relationship model.  I hope that gives you a better idea of what I=
=20
mean.

It seems pretty clear we're going with something like the E-R model, we
just have to acknowledge that it will create limitations later on.

> Interestingly enough in one of the links you posted (the notes of Osmar
> Zaiane) another data model is the object oriented data model. Isn't this
> the most applicable model especially since we are working with the ZODB?

ZODB is built on the OO data model.  What we're talking about is allowing=
=20
applications to use another model at the same time, because the OO data=20
model (or perhaps the way ZODB interprets it) has limitations.

> Both the entity-relationship model and the relational model has one
> serious constraint. Entities in the e-r model and relations in the
> relational model have a fixed schemas or fixed set of attributes.
> Although this is true most of the time when dealing with objects one can
> easily imagine cases where it is not like adding a property to an
> instance of a folder.

The E-R model can support non-fixed schemas.  It's much looser.

> Reading through the notes mentioned above two other terms struck a cord
> especially since they are mentioned in the context of object databases.
> In the notes on Chapter 8, "Object oriented databases" what we call a
> relationship seems to be called a "reference" or persistent pointer.
>=20
>     http://www.cs.sfu.ca/CC/354/zaiane/material/notes/Chapter8/node16.htm=
l
>=20
> The other term is "association". Both terms are common and used in many
> contexts and wont necessarily dry up the confusion but I thought I'll
> throw them in the hat. I am inclined to "reference" since in an object
> oriented world it makes much more sense to say attribute x of object y
> is a reference to object z than attribute x of object y is a
> relationship to object z.

ZODB already uses persistent references.  That's what OIDs are for.  But=20
ZODB references are not bidirectional.

> Coming back to the problem statement, shouldn't it be as simple as "The
> ZODB should be able to persist references?" or did I just take the wrong
> turn?

I'm afraid you did. :-)  The inverse relationship mentioned in the page
you linked is talking about adding an integrity constraint, not about
creating bidirectional references.

Shane