[ZODB-Dev] n-way join algoritms

Roché Compaan roche at upfrontsystems.co.za
Sat Jun 21 22:18:28 EDT 2003


Does anybody now of an example n-way join algorithm in python or a
resource that may get me going. I've googled for them but mainly ran
into very technical papers with lots a relational algebra which I am not
familiar with.

I am building a query service for a Zope app that uses the catalog for
simple queries on properties and an associations repository for
associations between objects. 

In the absence of a good algorithm I made one that goes like this:

Say I query on metatypes a,b,c and d. The result should be joined with
the condition: a.x == b.x and b.y == c.y and c.z == d.z. What I do at
the moment is to process conditions from left to right and then from
right to left and I seem to be getting the right result:

left to right:
    a.x == b.x: filter a and b
    b.y == c.y: filter b and c
    c.z == d.z: filter c and d
right to left:
    b.y == c.y: filter b and c
    a.x == b.x: filter a and b

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the ZODB-Dev mailing list