[Zope3-Users] Expressing n:m relationship in ZODB

Leonardo Rochael Almeida leo at enfoldsystems.com
Tue Jul 11 19:39:07 EDT 2006


What you describe sounds perfectly fine.

You might want to consider exposing the actual IArticleProjectRelation
object eventually if you decide to hang other attributes to it, say a
'start date'.

Cheers, Leo

Em Qua, 2006-07-12 às 00:40 +0200, Achim Domma escreveu:
> Leonardo Rochael Almeida wrote:
> 
> > In usual Object Oriented modeling, an n:m relationship is usually
> > modeled as a collection of relationship objects each one keeping one
> > direct reference to each side of the relationship. Of course, using
> > these systems that already try to model relationships helps you not to
> > reinvent another wheel.
> 
> I think I understand. So if I would like to reinvent another wheel, just 
> for the educatinal purpose, I should do it like this:
> 
> If I have IArticle and IProject which should have a relationship, I 
> would introduce IArticleProjectRelation which holds a reference to the 
> related objects. These relation objects will be managed by an 
> IArticleProjectRelationManager which has an interface like:
> 
> relate(article,project)
> unrelate(article,project)
> get_related_articles(project)
> get_related_projects(article)
> 
> In that case, IArticleProjectRelation would be an implementation detail 
> of IArticleProjectRelationManager and I do not have to expose it at all. 
> And in Zope 3 terms, I would implement the manager as a local utility. 
> Right so far?
> 
> If yes, I could add helper methods to IArticle and IProject which 
> encapsulate the access of the utility to hide this detail from the user. 
> Would you do that? Or has it some drawbacks which I don't see yet?
> 
> thanks for your help,
> 
> Achim
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
-- 
Leonardo Rochael Almeida
Enfold Systems
http://www.enfoldsystems.com
phone. +1.713.942.2377 Ext 215
fax. +1.832.201.8856



More information about the Zope3-users mailing list