[Zope] Re: returning related objects
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Tue, 10 Sep 2002 17:50:04 +0200
VanL wrote:
> Hello,
>
> I have some objects stored in the ZODB that I am accessing via a
> ZCatalog query. The problem is that I sometimes don't want the exact
> results of a search, but an item that is related to it via the ZODB
> tree. For example, say I have the following hierarchy (everything is a
> folderish object):
>
> Orchards/
> Hill Orchard/
> Manager
> Fields/
> North_Field/
> AppleTypes/
> McIntosh
> Golden Delicious
> South_Field/
> AppleTypes/
> Red Delicious
> East_Field/
> AppleTypes/
> McIntosh
> Fuji
> Valley Orchard/
> Manager
> Fields/
> North_Field/
> AppleTypes/
> Golden Delicious
> South_Field/
> AppleTypes/
> Granny
>
> I want to do queries like:
> "Who are the managers that look over Golden Delicious Fields?"
> "What kinds of apples are grown in the Valley Orchard?"
>
> Currently, I am trying to do a zcatalog query for the known item (say,
> the Orchard) and then run up or down the acquisition chain to retrieve
> the unknown, but related quantity.
>
> Is there an easier way to do this? One of the things that I like about
> Zope is the ability to store objects in their natural hierarchies. Can
> I use that to get information about objects that are related to my
> current object?
>
> Thanks,
>
> VanL
have a look at ZCatalogs-PathIndex... with some python-logic you should
be able to do this kind of questions.
cheers, maik