El vie, 21-07-2006 a las 10:21 -0400, Pete Taylor escribió: > Lorenzo, > I've run into a very (very!) similar situation, and ended up writing > some wrapper/simplification utilities for zc.relationship. > zc.relationship is wonderfully powerful, but a bit complex. It's use > is intuitive once you wade through the 2000+ lines of documentation > (which is worthwhile reading), but it's a bit intimidating at first.
Ok, I was afraid of an answer like this because in a recent thread I've read Jim Fulton saying that we are trying to use zodb as a relational database which is a shame and I think I agree with that quote. So that's why I tried not to use external packages like zc.relationship and stick to a plain object model with intrinsic relations modeled as simple object attributes. The obvious question is: does this allow powerful queries like the ones I mentioned in my first email or I should switch and use extrinsic relations for this kind of features? > > I've packaged up my wrapper utilities as a product, and ZPL2.1'd the > code. If you'd like it, even just for reference, let me know. I > intend to release it more publicly shortly. Sure! I'm 120% interested in reading your solution since reinventing the wheel is something I always try to avoid. Thanks a lot for you kindly offer! Lorenzo > It implements nice > adapters, so objects implementing a particular marker interface can do > things like: > > client = MyClient() > q = IQuestion(obj) > orders = q.ask_as_subject("owns") > orders > ['<some.Order object at...>'] > > you can also build filter functions that take the relationship you're > targeting as an argument, and check any property of the relationship > in question... > > let me know if you'd like a copy. if not, then i'd suggest going > through at least the containers.txt in zc.relationship. > > as far as the catalog goes, i'd get into using hurry.query as fast as > possible ;) > > On 7/21/06, Lorenzo Gil Sanchez <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I've been following recent discussion about relations in Zope. Both > > intrinsic and extrinsic relationships. > > > > For the following question lets assume we have a IClient and an IOrder > > content types and the IOrder schema has a IClient attribute called 'client'. > > > > Reading previous messages to this list I understand that's the best way > > to model this kind of intrinsic relationship between an Order and a Client. > > > > Now the question: using a Catalog, what should I do to answer these kind > > of questions: > > > > - Give me all orders whose client's name starts with 'John' > > > > - Give me all orders whose client's age is between 20 and 30 > > > > - Give me all orders for a certain client > > > > I guess I need to use a special kind of FieldIndex for objects but I'm > > new to the Catalog land and I'm pretty much lost. > > > > Any help, examples or pointers to detailed doc are greatly appreciated :-) > > > > Best regards, > > > > Lorenzo Gil > > _______________________________________________ > > Zope3-users mailing list > > Zope3email@example.com > > http://mail.zope.org/mailman/listinfo/zope3-users > > > > _______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users