Change makefiles so that html files are automatically installed and
[idzebra-moved-to-github.git] / doc / architecture.xml
1  <chapter id="architecture">
2   <!-- $Id: architecture.xml,v 1.12 2006-09-03 21:37:26 adam Exp $ -->
3   <title>Overview of Zebra Architecture</title>
4   
5
6   <section id="architecture-representation">
7    <title>Local Representation</title>
8    
9    <para>
10     As mentioned earlier, Zebra places few restrictions on the type of
11     data that you can index and manage. Generally, whatever the form of
12     the data, it is parsed by an input filter specific to that format, and
13     turned into an internal structure that Zebra knows how to handle. This
14     process takes place whenever the record is accessed - for indexing and
15     retrieval.
16    </para>
17
18    <para>
19     The RecordType parameter in the <literal>zebra.cfg</literal> file, or
20     the <literal>-t</literal> option to the indexer tells Zebra how to
21     process input records.
22     Two basic types of processing are available - raw text and structured
23     data. Raw text is just that, and it is selected by providing the
24     argument <emphasis>text</emphasis> to Zebra. Structured records are
25     all handled internally using the basic mechanisms described in the
26     subsequent sections.
27     Zebra can read structured records in many different formats.
28     <!--
29     How this is done is governed by additional parameters after the
30     "grs" keyword, separated by "." characters.
31     -->
32    </para>
33   </section>
34
35   <section id="architecture-maincomponents">
36    <title>Main Components</title>
37    <para>
38     The Zebra system is designed to support a wide range of data management
39     applications. The system can be configured to handle virtually any
40     kind of structured data. Each record in the system is associated with
41     a <emphasis>record schema</emphasis> which lends context to the data
42     elements of the record.
43     Any number of record schemas can coexist in the system.
44     Although it may be wise to use only a single schema within
45     one database, the system poses no such restrictions.
46    </para>
47    <para>
48     The Zebra indexer and information retrieval server consists of the
49     following main applications: the <command>zebraidx</command>
50     indexing maintenance utility, and the <command>zebrasrv</command>
51     information query and retrieval server. Both are using some of the
52     same main components, which are presented here.
53    </para>    
54    <para>    
55     The virtual Debian package <literal>idzebra-2.0</literal>
56     installs all the necessary packages to start
57     working with Zebra - including utility programs, development libraries,
58     documentation and modules. 
59   </para>    
60    
61    <section id="componentcore">
62     <title>Core Zebra Libraries Containing Common Functionality</title>
63     <para>
64      The core Zebra module is the meat of the <command>zebraidx</command>
65     indexing maintenance utility, and the <command>zebrasrv</command>
66     information query and retrieval server binaries. Shortly, the core
67     libraries are responsible for  
68      <variablelist>
69       <varlistentry>
70        <term>Dynamic Loading</term>
71        <listitem>
72         <para>of external filter modules, in case the application is
73         not compiled statically. These filter modules define indexing,
74         search and retrieval capabilities of the various input formats.  
75         </para>
76        </listitem>
77       </varlistentry>
78       <varlistentry>
79        <term>Index Maintenance</term>
80        <listitem>
81         <para> Zebra maintains Term Dictionaries and ISAM index
82         entries in inverted index structures kept on disk. These are
83         optimized for fast inset, update and delete, as well as good
84         search performance.
85         </para>
86        </listitem>
87       </varlistentry>
88       <varlistentry>
89        <term>Search Evaluation</term>
90        <listitem>
91         <para>by execution of search requests expressed in PQF/RPN
92          data structures, which are handed over from
93          the YAZ server frontend API. Search evaluation includes
94          construction of hit lists according to boolean combinations
95          of simpler searches. Fast performance is achieved by careful
96          use of index structures, and by evaluation specific index hit
97          lists in correct order. 
98         </para>
99        </listitem>
100       </varlistentry>
101       <varlistentry>
102        <term>Ranking and Sorting</term>
103        <listitem>
104         <para>
105          components call resorting/re-ranking algorithms on the hit
106          sets. These might also be pre-sorted not only using the
107          assigned document ID's, but also using assigned static rank
108          information. 
109         </para>
110        </listitem>
111       </varlistentry>
112       <varlistentry>
113        <term>Record Presentation</term>
114        <listitem>
115         <para>returns - possibly ranked - result sets, hit
116          numbers, and the like internal data to the YAZ server backend API
117          for shipping to the client. Each individual filter module
118          implements it's own specific presentation formats.
119         </para>
120        </listitem>
121       </varlistentry>
122      </variablelist>
123      </para>
124     <para> 
125      The Debian package <literal>libidzebra-2.0</literal> 
126      contains all run-time libraries for Zebra, the 
127      documentation in PDF and HTML is found in 
128      <literal>idzebra-2.0-doc</literal>, and
129      <literal>idzebra-2.0-common</literal>
130      includes common essential Zebra configuration files.
131     </para>
132    </section>
133    
134
135    <section id="componentindexer">
136     <title>Zebra Indexer</title>
137     <para>
138      The  <command>zebraidx</command>
139      indexing maintenance utility 
140      loads external filter modules used for indexing data records of
141      different type, and creates, updates and drops databases and
142      indexes according to the rules defined in the filter modules.
143     </para>    
144     <para>    
145      The Debian  package <literal>idzebra-2.0-utils</literal> contains
146      the  <command>zebraidx</command> utility.
147     </para>
148    </section>
149
150    <section id="componentsearcher">
151     <title>Zebra Searcher/Retriever</title>
152     <para>
153      This is the executable which runs the Z39.50/SRU/SRW server and
154      glues together the core libraries and the filter modules to one
155      great Information Retrieval server application. 
156     </para>    
157     <para>    
158      The Debian  package <literal>idzebra-2.0-utils</literal> contains
159      the  <command>zebrasrv</command> utility.
160     </para>
161    </section>
162
163    <section id="componentyazserver">
164     <title>YAZ Server Frontend</title>
165     <para>
166      The YAZ server frontend is 
167      a full fledged stateful Z39.50 server taking client
168      connections, and forwarding search and scan requests to the 
169      Zebra core indexer.
170     </para>
171     <para>
172      In addition to Z39.50 requests, the YAZ server frontend acts
173      as HTTP server, honoring
174       <ulink url="http://www.loc.gov/standards/sru/srw/">SRW</ulink> 
175      SOAP requests, and  
176      <ulink url="&url.sru;">SRU</ulink> 
177      REST requests. Moreover, it can
178      translate incoming 
179      <ulink url="&url.cql;">CQL</ulink>
180      queries to
181      <ulink url="http://indexdata.com/yaz/doc/tools.tkl#PQF">PQF</ulink>
182       queries, if
183      correctly configured. 
184     </para>
185     <para>
186      <ulink url="http://www.indexdata.com/yaz">YAZ</ulink>
187      is an Open Source  
188      toolkit that allows you to develop software using the
189      ANSI Z39.50/ISO23950 standard for information retrieval.
190      It is packaged in the Debian packages     
191      <literal>yaz</literal> and <literal>libyaz</literal>.
192     </para>
193    </section>
194    
195    <section id="componentmodules">
196     <title>Record Models and Filter Modules</title>
197     <para>
198      The hard work of knowing <emphasis>what</emphasis> to index, 
199      <emphasis>how</emphasis> to do it, and <emphasis>which</emphasis>
200      part of the records to send in a search/retrieve response is
201      implemented in 
202      various filter modules. It is their responsibility to define the
203      exact indexing and record display filtering rules.
204      </para>
205      <para>
206      The virtual Debian package
207      <literal>libidzebra-2.0-modules</literal> installs all base filter
208      modules. 
209     </para>
210
211    
212    <section id="componentmodulestext">
213     <title>TEXT Record Model and Filter Module</title>
214     <para>
215       Plain ASCII text filter. TODO: add information here.
216     </para>
217    </section>
218
219    <section id="componentmodulesgrs">
220     <title>GRS Record Model and Filter Modules</title>
221     <para>
222     The GRS filter modules described in 
223     <xref linkend="grs"/>
224     are all based on the Z39.50 specifications, and it is absolutely
225     mandatory to have the reference pages on BIB-1 attribute sets on
226     you hand when configuring GRS filters. The GRS filters come in
227     different flavors, and a short introduction is needed here.
228     GRS filters of various kind have also been called ABS filters due
229     to the <filename>*.abs</filename> configuration file suffix.
230     </para>
231     <para>
232       The <emphasis>grs.marc</emphasis> and 
233       <emphasis>grs.marcxml</emphasis> filters are suited to parse and
234       index binary and XML versions of traditional library MARC records 
235       based on the ISO2709 standard. The Debian package for both
236       filters is 
237      <literal>libidzebra-2.0-mod-grs-marc</literal>.
238     </para>
239     <para>
240       GRS TCL scriptable filters for extensive user configuration come
241      in two flavors: a regular expression filter 
242      <emphasis>grs.regx</emphasis> using TCL regular expressions, and
243      a general scriptable TCL filter called 
244      <emphasis>grs.tcl</emphasis>        
245      are both included in the 
246      <literal>libidzebra-2.0-mod-grs-regx</literal> Debian package.
247     </para>
248     <para>
249       A general purpose SGML filter is called
250      <emphasis>grs.sgml</emphasis>. This filter is not yet packaged,
251      but planned to be in the  
252      <literal>libidzebra-2.0-mod-grs-sgml</literal> Debian package.
253     </para>
254     <para>
255       The Debian  package 
256       <literal>libidzebra-2.0-mod-grs-xml</literal> includes the 
257       <emphasis>grs.xml</emphasis> filter which uses <ulink
258       url="http://expat.sourceforge.net/">Expat</ulink> to 
259       parse records in XML and turn them into IDZebra's internal GRS node
260       trees. Have also a look at the Alvis XML/XSLT filter described in
261       the next session.
262     </para>
263    </section>
264
265    <section id="componentmodulesalvis">
266     <title>ALVIS Record Model and Filter Module</title>
267      <para>
268       The Alvis filter for XML files is an XSLT based input
269       filter. 
270       It indexes element and attribute content of any thinkable XML format
271       using full XPATH support, a feature which the standard Zebra
272       GRS SGML and XML filters lacked. The indexed documents are
273       parsed into a standard XML DOM tree, which restricts record size
274       according to availability of memory.
275     </para>
276     <para>
277       The Alvis filter 
278       uses XSLT display stylesheets, which let
279       the Zebra DB administrator associate multiple, different views on
280       the same XML document type. These views are chosen on-the-fly in
281       search time.
282      </para>
283     <para>
284       In addition, the Alvis filter configuration is not bound to the
285       arcane  BIB-1 Z39.50 library catalogue indexing traditions and
286       folklore, and is therefore easier to understand.
287     </para>
288     <para>
289       Finally, the Alvis  filter allows for static ranking at index
290       time, and to to sort hit lists according to predefined
291       static ranks. This imposes no overhead at all, both
292       search and indexing perform still 
293       <emphasis>O(1)</emphasis> irrespectively of document
294       collection size. This feature resembles Googles pre-ranking using
295       their Pagerank algorithm.
296     </para>
297     <para>
298       Details on the experimental Alvis XSLT filter are found in 
299       <xref linkend="record-model-alvisxslt"/>.
300       </para>
301      <para>
302       The Debian package <literal>libidzebra-2.0-mod-alvis</literal>
303       contains the Alvis filter module.
304      </para>
305     </section>
306
307     <!--
308    <section id="componentmodulessafari">
309     <title>SAFARI Record Model and Filter Module</title>
310     <para>
311      SAFARI filter module TODO: add information here.
312     </para>
313    </section>
314     -->
315
316    </section>
317
318   </section>
319
320
321   <section id="architecture-workflow">
322    <title>Indexing and Retrieval Workflow</title>
323
324   <para>
325    Records pass through three different states during processing in the
326    system.
327   </para>
328
329   <para>
330
331    <itemizedlist>
332     <listitem>
333      
334      <para>
335       When records are accessed by the system, they are represented
336       in their local, or native format. This might be SGML or HTML files,
337       News or Mail archives, MARC records. If the system doesn't already
338       know how to read the type of data you need to store, you can set up an
339       input filter by preparing conversion rules based on regular
340       expressions and possibly augmented by a flexible scripting language
341       (Tcl).
342       The input filter produces as output an internal representation,
343       a tree structure.
344
345      </para>
346     </listitem>
347     <listitem>
348
349      <para>
350       When records are processed by the system, they are represented
351       in a tree-structure, constructed by tagged data elements hanging off a
352       root node. The tagged elements may contain data or yet more tagged
353       elements in a recursive structure. The system performs various
354       actions on this tree structure (indexing, element selection, schema
355       mapping, etc.),
356
357      </para>
358     </listitem>
359     <listitem>
360
361      <para>
362       Before transmitting records to the client, they are first
363       converted from the internal structure to a form suitable for exchange
364       over the network - according to the Z39.50 standard.
365      </para>
366     </listitem>
367
368    </itemizedlist>
369
370   </para>
371   </section>
372
373  </chapter> 
374
375  <!-- Keep this comment at the end of the file
376  Local variables:
377  mode: sgml
378  sgml-omittag:t
379  sgml-shorttag:t
380  sgml-minimize-attributes:nil
381  sgml-always-quote-attributes:t
382  sgml-indent-step:1
383  sgml-indent-data:t
384  sgml-parent-document: "zebra.xml"
385  sgml-local-catalogs: nil
386  sgml-namecase-general:t
387  End:
388  -->