[Zope] zope design pattern type question

Gary Poster garykaryn@earthlink.net
Tue, 26 Jun 2001 12:57:35 -0400


Hi everyone.  I'm a Zope newbie who, after reading the zope book and the
developer's guide, has a design pattern type question.

I'm sure this has been dealt with before--my approach to this type of
problem for 4+ years now has been RDBMS-based, and I'm having trouble coming
up with a graceful ODB/Zope equivalency.  The basic question is, "what's the
best Zope/ODB equivalency to a many-to-many relationship such as one
implements via a join table in RDBs?"

Now I'll elaborate, but that's the heart of it.

Let's say we're implementing the standard tutorial RDB book database project
in Zope/ODB.  In one example of what I'm talking about you have objects that
represent authors in one branch of the ODB, an author collection, and you
have objects that represent books in another branch, a book collection.  The
books might have an ordered list of author objects to represent authors of
that book.  The book object can now easily report who its authors are.
However, the author objects, as found normally in another branch of the ODB,
have a much more annoying time reporting the books they have authored--they
might have to query the book collection, for instance, which lacks grace to
me.  But that's the only solution I can come up with.

Similarly, should I store a reference to the actual author object in the
book object's author list, or to an acquisition-"wrapped" version of the
author?  The wrapped version seems both more powerful and more dangerous,
and I'm not even sure if the wrapping would survive putting it in the ZODB.

Finally, can I use zcatalog with the field indexing to speed up looking for
the authors in the book collection, or is zcatalog really only for text?

Thanks in advance.  If there's a how-to on this just point away, or if
there's some specific source code example that would help me out, that would
be cool too.

Gary