[Zope] 'or' queries in ZCatalogs? (and a general design question)

Howard Jones howie@thingy.com
Wed, 31 May 2000 17:57:58 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01BFCB29.C17B3C80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am currently working on a toy zope project for myself, which is a =
historical database of sorts (it's an On The Day In History type of =
thing - today.thingy.com is the current version, which is somewhat =
broken right now). What I wanted to do was be able to 'surf' events - =
have them linked by the people involved, the timing of them, or some =
general theme, in a similar way to wikiwebs (more like imdb really).

So far, I have a TodayPageItem ZClass, with some basic information (the =
body text, the date of the event) and a couple of 'Lines' type =
properties called People and Threads. In the index_html for presenting =
an event object, I use:

<dtml-if "threads[0] !=3D ''">
   <dtml-in threads>
      <dtml-in "Catalog(meta_type=3D'Today Page =
Item',threads=3D_['sequence-item'])">
         <dtml-if sequence-first>
            <h4>Threads</h4>
            <ul>
         </dtml-if>
         <dtml-unless "Catalog.getobject(data_record_id_).id =3D=3D =
PARENTS[0].id">
            <li><a href=3D"<dtml-var TodayBase><dtml-var =
"Catalog.getpath(data_record_id_)">"><dtml-var title></a>
         </dtml-unless>
         <dtml-if sequence-last>
             </ul>
         </dtml-if>
      </dtml-in>
   </dtml-in threads>
</dtml-if>

To show the related objects in the same threads as this one (objects may =
involve more than one thread - Inventions, and Government, for the found =
of the US Patent Office, for example).
However, I then have a similar piece of DTML directly below it to do the =
same for the People list.

Can I combine these? I would like to show one link only for each related =
object, even if it related more than one way, and also to show how they =
are related next to the link. According to the Advanced ZCatalog howto, =
the only way of doing this loads the whole lot into memory - I plan to =
have thousands of these! Is there some magic I'm missing?

Thanks in advance for any advice (don't do it this way?),

Best Regards,

Howard

------=_NextPart_000_0005_01BFCB29.C17B3C80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am currently working on a toy zope =
project for=20
myself, which is a historical database of sorts (it's an On The Day In =
History=20
type of thing - today.thingy.com is the current version, which is =
somewhat=20
broken right now). What I wanted to do was be able to 'surf' events - =
have them=20
linked by the people involved, the timing of them, or some general =
theme, in a=20
similar way to wikiwebs (more like imdb really).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So far, I have a TodayPageItem ZClass, =
with some=20
basic information (the body text, the date of the event) and a couple of =
'Lines'=20
type properties called People and Threads. In the index_html for =
presenting an=20
event object, I use:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-if "threads[0] !=3D =
''"&gt;<BR>&nbsp;&nbsp;=20
&lt;dtml-in threads&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dtml-in=20
"Catalog(meta_type=3D'Today Page=20
Item',threads=3D_['sequence-item'])"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
&lt;dtml-if=20
sequence-first&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
&lt;h4&gt;Threads&lt;/h4&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;ul&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/dtml-if&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;dtml-unless "Catalog.getobject(data_record_id_).id =3D=3D=20
PARENTS[0].id"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
&lt;li&gt;&lt;a href=3D"&lt;dtml-var TodayBase&gt;&lt;dtml-var=20
"Catalog.getpath(data_record_id_)"&gt;"&gt;&lt;dtml-var=20
title&gt;&lt;/a&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/dtml-unless&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

&lt;dtml-if=20
sequence-last&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
&lt;/ul&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/dtml-if&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/dtml-in&gt;<BR>&nbsp;&nbsp; &lt;/dtml-in=20
threads&gt;<BR>&lt;/dtml-if&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>To show the related objects in the same =
threads as=20
this one (objects may involve more than one thread - Inventions, and =
Government,=20
for the found of the US Patent Office, for example).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>However, I then have a similar piece of =
DTML=20
directly below it to do the same for the People list.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Can I combine these? I would like to =
show one link=20
only for each related object, even if it related more than one way, and =
also to=20
show how they are related next to the link. According to the Advanced =
ZCatalog=20
howto, the only way of doing this loads the whole lot into memory - I =
plan to=20
have thousands of these! Is there some magic I'm missing?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance for any advice (don't =
do it this=20
way?),</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Best Regards,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Howard</FONT></DIV></BODY></HTML>

------=_NextPart_000_0005_01BFCB29.C17B3C80--