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

Shane Hathaway shane@zope.com
Fri, 02 May 2003 12:43:33 -0400


Roch=E9 Compaan wrote:
> On Fri, 02 May 2003 09:47:37 -0400
> Shane Hathaway <shane@zope.com> wrote:
>>One request: the word "relation" should not appear anywhere in the API.=
=20
>>  We should use "relationship" consistently.  I'm pretty sure that=20
>>relations are only one possible implementation of relationship storage.
>=20
>=20
> If you are that sure then the distinction is not that clear to me. I
> understood "relation" as the *definition* of a logical association
> between two objects and relationship as the association itself. Marriag=
e
> is the relation, Peter's marriage to Susan is the relationship. Sure,
> there is some overlap with "relation" in relational theory but we
> describe the same thing: a logical association. When you use the word
> "relation" you are referring to it as a specific storage implementation=
:
> a table.

Well, perhaps I am incorrect in my thinking, but every discussion I can=20
Google (heh, I finally used Google as a verb) that mentions both the=20
entity-relationship model and the relational model explains it=20
differently.  First they introduce ERM then explain how to implement it=20
using relations in a relational database.  ERM seems to be described as=20
the underlying model for relations.

There are a few places that mix the use of relation and relationship.=20
In some contexts, the two words are synonyms, and it seems like some=20
authors use both words loosely.  I'd be happy to be proven wrong (so I=20
can agree with you.)  Is there a model that defines "relationship" as=20
the concrete form of "relation", as you explained it?  It seems to be=20
the other way around. :-)

In my search, I found a very nice introduction to ERM:

http://www.cs.nyu.edu/cs/dept_info/course_home_pages/spr97/V22.0444/unit0=
2/ppframe.htm

>>>I assume all objects have ids. This is not a requirement and if we dro=
p
>>>this assumption very little in the implementation have to change.
>>
>>We can't make the assumption that all objects have IDs.  One of the=20
>>requirements is that either direct or indirect references are possible.=
=20
>>  All of the requirements should be listed on the proposal.
>=20
>=20
> Just to be clear can you give me an example of a direct and indirect
> references.

Direct references are what ZODB does by default.  Containment is the=20
simplest kind of direct reference.  Indirect references, on the other=20
hand, use paths or hub IDs to find objects.

>>Actually, I meant for this class to be a ComputedAttribute/descriptor.=20
>>This class does not need to use computed attributes.
>=20
>=20
> Iow, Relationship should subclass ComputedAttribute? I tried something
> like that but ran into some problems and just wanted to get something
> out there for comment.

Ok.

>>If you have some time, I'd appreciate it if you started a proposal on a=
=20
>>wiki page.  Then we'll come up with an API.  Once we're satisfied with=20
>>the API, we'll ask for comments.
>=20
>=20
> I'll ask Jean to help me with this - he's formulates much better than I
> do and has a much better grip on the subtleties of language.

I wouldn't worry about making it formal, just complete (yet concise.)

Shane