[Zope-dev] Re: [ZODB-Dev] Re: [Zope3-dev] PROPOSAL: ZODB Relationships

Shane Hathaway shane@zope.com
Fri, 09 May 2003 10:39:13 -0400


Ugh, which mailing list should I send this to?  I'm going to pick 
zope-dev since it's a fairly general list without too much traffic.

Phillip J. Eby wrote:
> Issues:
> 
> 1. "Global relationship repository" has no use cases, and smells like 
> trouble.  Why not just explicitly store the Relationship() somewhere?  
> After all, every RelationshipView will have a reference to it.  (For 
> ZODB4, a persistent module might be the natural place to put the 
> "official" reference to the Relationship(); for ZODB3, just hang them 
> off the root with suitably unique keys.)

One thing that perhaps wasn't made clear is that the repository doesn't 
directly contain relationships.  It contains named relationship sets.  I 
don't know if this is what you're talking about--correct me if I 
misunderstood.

> 2. There is no directionality to the associations; this doesn't work for 
> hierarchies or graphs.  E.g. think 'parent_child = Relationship()'.  
> That won't work.

I have that concern also, although it was only a gut feeling until now. 
  Elaborating on your example, an object may participate in multiple 
parent/child relationships, sometimes as a parent, sometimes as a child. 
  With the current API, you can't distinguish between the parents and 
the children.  That certainly won't work, and I'm sure it's only one 
example of needing directionality.

> All in all, I don't see any reason to make this part of ZODB's API or 
> add special repositories to support it.  However, like PersistentDict or 
> BTree, relationships might be a nice tool to have available in the ZODB 
> library.

That is what is intended by the proposal.  Jim suggested, in fact, that 
all this might be used independently of ZODB.

> A final comment...  Once this takes directionality into consideration, 
> you might consider calling it an 'Association' rather than a 
> 'Relationship', as it would then largely meet the MOF and UML semantics 
> of an "Association".  That is, an association is a collection of 
> directed links between objects.  It would then make sense to refer to 
> refer to the 'RelationshipView' as an 'AssociationEnd'.

That is an excellent idea if we can determine that this project is 
distinct from the Zope 3 relationship service.  It feels like the two 
projects are aiming to solve largely the same problem, but if they 
aren't, a name change will help clarify the difference.

Shane