Minor fixes, especially in the beginning
[idzebra-moved-to-github.git] / doc / recordmodel.xml
1 <chapter id="record-model">
2  <!-- $Id: recordmodel.xml,v 1.3 2002-04-10 14:47:49 heikki Exp $ -->
3  <title>The Record Model</title>
4  
5  <para>
6   The Zebra system is designed to support a wide range of data management
7   applications. The system can be configured to handle virtually any
8   kind of structured data. Each record in the system is associated with
9   a <emphasis>record schema</emphasis> which lends context to the data
10   elements of the record.
11   Any number of record schema can coexist in the system.
12   Although it may be wise to use only a single schema within
13   one database, the system poses no such restrictions.
14  </para>
15
16  <para>
17   The record model described in this chapter applies to the fundamental,
18   structured
19   record type <literal>grs</literal> as introduced in
20   <xref linkend="record-types"/>.
21   FIXME - Need to describe the simple string-tag model, or at least 
22           refer to it here. -H
23  </para>
24
25  <para>
26   Records pass through three different states during processing in the
27   system.
28  </para>
29
30  <para>
31
32   <itemizedlist>
33    <listitem>
34
35     <para>
36      When records are accessed by the system, they are represented
37      in their local, or native format. This might be SGML or HTML files,
38      News or Mail archives, MARC records. If the system doesn't already
39      know how to read the type of data you need to store, you can set up an
40      input filter by preparing conversion rules based on regular
41      expressions and possibly augmented by a flexible scripting language
42      (Tcl).
43      The input filter produces as output an internal representation:
44
45     </para>
46    </listitem>
47    <listitem>
48
49     <para>
50      When records are processed by the system, they are represented
51      in a tree-structure, constructed by tagged data elements hanging off a
52      root node. The tagged elements may contain data or yet more tagged
53      elements in a recursive structure. The system performs various
54      actions on this tree structure (indexing, element selection, schema
55      mapping, etc.),
56
57     </para>
58    </listitem>
59    <listitem>
60
61     <para>
62      Before transmitting records to the client, they are first
63      converted from the internal structure to a form suitable for exchange
64      over the network - according to the Z39.50 standard.
65     </para>
66    </listitem>
67
68   </itemizedlist>
69
70  </para>
71
72  <sect1 id="local-representation">
73   <title>Local Representation</title>
74
75   <para>
76    As mentioned earlier, Zebra places few restrictions on the type of
77    data that you can index and manage. Generally, whatever the form of
78    the data, it is parsed by an input filter specific to that format, and
79    turned into an internal structure that Zebra knows how to handle. This
80    process takes place whenever the record is accessed - for indexing and
81    retrieval.
82   </para>
83
84   <para>
85    The RecordType parameter in the <literal>zebra.cfg</literal> file, or
86    the <literal>-t</literal> option to the indexer tells Zebra how to
87    process input records.
88    Two basic types of processing are available - raw text and structured
89    data. Raw text is just that, and it is selected by providing the
90    argument <emphasis>text</emphasis> to Zebra. Structured records are
91    all handled internally using the basic mechanisms described in the
92    subsequent sections.
93    Zebra can read structured records in many different formats.
94    How this is done is governed by additional parameters after the
95    "grs" keyboard, separated by "." characters.
96   </para>
97
98   <para>
99    Four basic subtypes to the <emphasis>grs</emphasis> type are
100    currently available:
101   </para>
102
103   <para>
104    <variablelist>
105     <varlistentry>
106      <term>grs.sgml</term>
107      <listitem>
108       <para>
109        This is the canonical input format &mdash;
110        described below. It is a simple SGML-like syntax.
111       </para>
112      </listitem>
113     </varlistentry>
114     <varlistentry>
115      <term>grs.regx.<emphasis>filter</emphasis></term>
116      <listitem>
117       <para>
118        This enables a user-supplied input
119        filter. The mechanisms of these filters are described below.
120       </para>
121      </listitem>
122     </varlistentry>
123     <varlistentry>
124      <term>grs.tcl.<emphasis>filter</emphasis></term>
125      <listitem>
126       <para>
127        Similar to grs.regx but using Tcl for rules.
128       </para>
129      </listitem>
130     </varlistentry>
131     <varlistentry>
132      <term>grs.marc.<emphasis>abstract syntax</emphasis></term>
133      <listitem>
134       <para>
135        This allows Zebra to read
136        records in the ISO2709 (MARC) encoding standard. In this case, the
137        last parameter <emphasis>abstract syntax</emphasis> names the
138        <literal>.abs</literal> file (see below)
139        which describes the specific MARC structure of the input record as
140        well as the indexing rules.
141       </para>
142      </listitem>
143     </varlistentry>
144    </variablelist>
145   </para>
146
147   <sect2>
148    <title>Canonical Input Format</title>
149
150    <para>
151     Although input data can take any form, it is sometimes useful to
152     describe the record processing capabilities of the system in terms of
153     a single, canonical input format that gives access to the full
154     spectrum of structure and flexibility in the system. In Zebra, this
155     canonical format is an "SGML-like" syntax.
156    </para>
157
158    <para>
159     To use the canonical format specify <literal>grs.sgml</literal> as
160     the record type.
161    </para>
162
163    <para>
164     Consider a record describing an information resource (such a record is
165     sometimes known as a <emphasis>locator record</emphasis>).
166     It might contain a field describing the distributor of the
167     information resource, which might in turn be partitioned into
168     various fields providing details about the distributor, like this:
169    </para>
170
171    <para>
172
173     <screen>
174      &#60;Distributor&#62;
175      &#60;Name&#62; USGS/WRD &#60;/Name&#62;
176      &#60;Organization&#62; USGS/WRD &#60;/Organization&#62;
177      &#60;Street-Address&#62;
178      U.S. GEOLOGICAL SURVEY, 505 MARQUETTE, NW
179      &#60;/Street-Address&#62;
180      &#60;City&#62; ALBUQUERQUE &#60;/City&#62;
181      &#60;State&#62; NM &#60;/State&#62;
182      &#60;Zip-Code&#62; 87102 &#60;/Zip-Code&#62;
183      &#60;Country&#62; USA &#60;/Country&#62;
184      &#60;Telephone&#62; (505) 766-5560 &#60;/Telephone&#62;
185      &#60;/Distributor&#62;
186     </screen>
187
188    </para>
189
190    <note>
191    <para>
192     The indentation used above is used to illustrate how Zebra
193      interprets the mark-up. The indentation, in itself, has no
194      significance to the parser for the canonical input format, which
195      discards superfluous whitespace.
196     </para>
197    </note>
198    <para>
199     The keywords surrounded by &lt;...&gt; are
200     <emphasis>tags</emphasis>, while the sections of text
201     in between are the <emphasis>data elements</emphasis>.
202     A data element is characterized by its location in the tree
203     that is made up by the nested elements.
204     Each element is terminated by a closing tag - beginning
205     with <literal>&#60;</literal>/, and containing the same symbolic
206     tag-name as the corresponding opening tag.
207     The general closing tag - <literal>&#60;</literal>&gt;/ -
208     terminates the element started by the last opening tag. The
209     structuring of elements is significant.
210     The element <emphasis>Telephone</emphasis>,
211     for instance, may be indexed and presented to the client differently,
212     depending on whether it appears inside the
213     <emphasis>Distributor</emphasis> element, or some other,
214     structured data element such a <emphasis>Supplier</emphasis> element.
215    </para>
216
217    <sect3>
218     <title>Record Root</title>
219
220     <para>
221      The first tag in a record describes the root node of the tree that
222      makes up the total record. In the canonical input format, the root tag
223      should contain the name of the schema that lends context to the
224      elements of the record
225      (see <xref linkend="internal-representation"/>).
226       The following is a GILS record that
227       contains only a single element (strictly speaking, that makes it an
228       illegal GILS record, since the GILS profile includes several mandatory
229       elements - Zebra does not validate the contents of a record against
230       the Z39.50 profile, however - it merely attempts to match up elements
231       of a local representation with the given schema):
232     </para>
233
234     <para>
235
236      <screen>
237       &#60;gils&#62;
238       &#60;title&#62;Zen and the Art of Motorcycle Maintenance&#60;/title&#62;
239       &#60;/gils&#62;
240      </screen>
241
242     </para>
243
244    </sect3>
245
246    <sect3>
247     <title>Variants</title>
248
249     <para>
250      Zebra allows you to provide individual data elements in a number of
251      <emphasis>variant forms</emphasis>. Examples of variant forms are
252      textual data elements which might appear in different languages, and
253      images which may appear in different formats or layouts.
254      The variant system in Zebra is essentially a representation of
255      the variant mechanism of Z39.50-1995.
256     </para>
257
258     <para>
259      The following is an example of a title element which occurs in two
260      different languages.
261     </para>
262
263     <para>
264
265      <screen>
266       &#60;title&#62;
267       &#60;var lang lang "eng"&#62;
268       Zen and the Art of Motorcycle Maintenance&#60;/&#62;
269       &#60;var lang lang "dan"&#62;
270       Zen og Kunsten at Vedligeholde en Motorcykel&#60;/&#62;
271       &#60;/title&#62;
272      </screen>
273
274     </para>
275
276     <para>
277      The syntax of the <emphasis>variant element</emphasis> is
278      <literal>&lt;var class type value&gt;</literal>.
279      The available values for the <emphasis>class</emphasis> and
280      <emphasis>type</emphasis> fields are given by the variant set
281      that is associated with the current schema
282      (see <xref linkend="variant-set"/>).
283     </para>
284
285     <para>
286      Variant elements are terminated by the general end-tag &#60;/&#62;, by
287      the variant end-tag &#60;/var&#62;, by the appearance of another variant
288      tag with the same <emphasis>class</emphasis> and
289      <emphasis>value</emphasis> settings, or by the
290      appearance of another, normal tag. In other words, the end-tags for
291      the variants used in the example above could have been saved.
292     </para>
293
294     <para>
295      Variant elements can be nested. The element
296     </para>
297
298     <para>
299
300      <screen>
301       &#60;title&#62;
302       &#60;var lang lang "eng"&#62;&#60;var body iana "text/plain"&#62;
303       Zen and the Art of Motorcycle Maintenance
304       &#60;/title&#62;
305      </screen>
306
307     </para>
308
309     <para>
310      Associates two variant components to the variant list for the title
311      element.
312     </para>
313
314     <para>
315      Given the nesting rules described above, we could write
316     </para>
317
318     <para>
319
320      <screen>
321       &#60;title&#62;
322       &#60;var body iana "text/plain&#62;
323       &#60;var lang lang "eng"&#62;
324       Zen and the Art of Motorcycle Maintenance
325       &#60;var lang lang "dan"&#62;
326       Zen og Kunsten at Vedligeholde en Motorcykel
327       &#60;/title&#62;
328      </screen>
329
330     </para>
331
332     <para>
333      The title element above comes in two variants. Both have the IANA body
334      type "text/plain", but one is in English, and the other in
335      Danish. The client, using the element selection mechanism of Z39.50,
336      can retrieve information about the available variant forms of data
337      elements, or it can select specific variants based on the requirements
338      of the end-user.
339     </para>
340
341    </sect3>
342
343   </sect2>
344
345   <sect2>
346    <title>Input Filters</title>
347
348    <para>
349     In order to handle general input formats, Zebra allows the
350     operator to define filters which read individual records in their
351     native format and produce an internal representation that the system
352     can work with.
353    </para>
354
355    <para>
356     Input filters are ASCII files, generally with the suffix
357     <literal>.flt</literal>.
358     The system looks for the files in the directories given in the
359     <emphasis>profilePath</emphasis> setting in the
360     <literal>zebra.cfg</literal> files.
361     The record type for the filter is
362     <literal>grs.regx.</literal><emphasis>filter-filename</emphasis>
363     (fundamental type <literal>grs</literal>, file read
364     type <literal>regx</literal>, argument
365     <emphasis>filter-filename</emphasis>).
366    </para>
367    
368    <para>
369     Generally, an input filter consists of a sequence of rules, where each
370     rule consists of a sequence of expressions, followed by an action. The
371     expressions are evaluated against the contents of the input record,
372     and the actions normally contribute to the generation of an internal
373     representation of the record.
374    </para>
375    
376    <para>
377     An expression can be either of the following:
378    </para>
379
380    <para>
381     <variablelist>
382
383      <varlistentry>
384       <term>INIT</term>
385       <listitem>
386        <para>
387         The action associated with this expression is evaluated
388         exactly once in the lifetime of the application, before any records
389         are read. It can be used in conjunction with an action that
390         initializes tables or other resources that are used in the processing
391         of input records.
392        </para>
393       </listitem>
394      </varlistentry>
395      <varlistentry>
396       <term>BEGIN</term>
397       <listitem>
398        <para>
399         Matches the beginning of the record. It can be used to
400         initialize variables, etc. Typically, the
401         <emphasis>BEGIN</emphasis> rule is also used
402         to establish the root node of the record.
403        </para>
404       </listitem>
405      </varlistentry>
406      <varlistentry>
407       <term>END</term>
408       <listitem>
409        <para>
410         Matches the end of the record - when all of the contents
411         of the record has been processed.
412        </para>
413       </listitem>
414      </varlistentry>
415      <varlistentry>
416       <term>/pattern/</term>
417       <listitem>
418        <para>
419         Matches a string of characters from the input record.
420        </para>
421       </listitem>
422      </varlistentry>
423      <varlistentry>
424       <term>BODY</term>
425       <listitem>
426        <para>
427         This keyword may only be used between two patterns.
428         It matches everything between (not including) those patterns.
429        </para>
430       </listitem>
431      </varlistentry>
432      <varlistentry>
433       <term>FINISH</term>
434       <listitem>
435        <para>
436         The expression associated with this pattern is evaluated
437         once, before the application terminates. It can be used to release
438         system resources - typically ones allocated in the
439         <emphasis>INIT</emphasis> step.
440        </para>
441       </listitem>
442      </varlistentry>
443     </variablelist>
444    </para>
445
446    <para>
447     An action is surrounded by curly braces (&lcub;...&rcub;), and
448     consists of a sequence of statements. Statements may be separated
449     by newlines or semicolons (;).
450     Within actions, the strings that matched the expressions
451     immediately preceding the action can be referred to as
452     &dollar;0, &dollar;1, &dollar;2, etc.
453    </para>
454
455    <para>
456     The available statements are:
457    </para>
458
459    <para>
460     <variablelist>
461
462      <varlistentry>
463       <term>begin <emphasis>type &lsqb;parameter ... &rsqb;</emphasis></term>
464       <listitem>
465        <para>
466         Begin a new
467         data element. The type is one of the following:
468         <variablelist>
469
470          <varlistentry>
471           <term>record</term>
472           <listitem>
473            <para>
474             Begin a new record. The following parameter should be the
475             name of the schema that describes the structure of the record, eg.
476             <literal>gils</literal> or <literal>wais</literal> (see below).
477             The <literal>begin record</literal> call should precede
478             any other use of the <emphasis>begin</emphasis> statement.
479            </para>
480           </listitem>
481          </varlistentry>
482          <varlistentry>
483           <term>element</term>
484           <listitem>
485            <para>
486             Begin a new tagged element. The parameter is the
487             name of the tag. If the tag is not matched anywhere in the tagsets
488             referenced by the current schema, it is treated as a local string
489             tag.
490            </para>
491           </listitem>
492          </varlistentry>
493          <varlistentry>
494           <term>variant</term>
495           <listitem>
496            <para>
497             Begin a new node in a variant tree. The parameters are
498             <emphasis>class type value</emphasis>.
499            </para>
500           </listitem>
501          </varlistentry>
502         </variablelist>
503        </para>
504       </listitem>
505      </varlistentry>
506      <varlistentry>
507       <term>data</term>
508       <listitem>
509        <para>
510         Create a data element. The concatenated arguments make
511         up the value of the data element.
512         The option <literal>-text</literal> signals that
513         the layout (whitespace) of the data should be retained for
514         transmission.
515         The option <literal>-element</literal>
516         <emphasis>tag</emphasis> wraps the data up in
517         the <emphasis>tag</emphasis>.
518         The use of the <literal>-element</literal> option is equivalent to
519         preceding the command with a <emphasis>begin
520          element</emphasis> command, and following
521         it with the <emphasis>end</emphasis> command.
522        </para>
523       </listitem>
524      </varlistentry>
525      <varlistentry>
526       <term>end <emphasis>&lsqb;type&rsqb;</emphasis></term>
527       <listitem>
528        <para>
529         Close a tagged element. If no parameter is given,
530         the last element on the stack is terminated.
531         The first parameter, if any, is a type name, similar
532         to the <emphasis>begin</emphasis> statement.
533         For the <emphasis>element</emphasis> type, a tag
534         name can be provided to terminate a specific tag.
535        </para>
536       </listitem>
537      </varlistentry>
538     </variablelist>
539    </para>
540
541    <para>
542     The following input filter reads a Usenet news file, producing a
543     record in the WAIS schema. Note that the body of a news posting is
544     separated from the list of headers by a blank line (or rather a
545     sequence of two newline characters.
546    </para>
547
548    <para>
549
550     <screen>
551      BEGIN                { begin record wais }
552
553      /^From:/ BODY /$/    { data -element name $1 }
554      /^Subject:/ BODY /$/ { data -element title $1 }
555      /^Date:/ BODY /$/    { data -element lastModified $1 }
556      /\n\n/ BODY END      {
557          begin element bodyOfDisplay
558          begin variant body iana "text/plain"
559          data -text $1
560          end record
561        }
562     </screen>
563
564    </para>
565
566    <para>
567     If Zebra is compiled with support for Tcl (Tool Command Language)
568     enabled, the statements described above are supplemented with a complete
569     scripting environment, including control structures (conditional
570     expressions and loop constructs), and powerful string manipulation
571     mechanisms for modifying the elements of a record. Tcl is a popular
572     scripting environment, with several tutorials available both online
573     and in hardcopy.
574    </para>
575
576   </sect2>
577
578  </sect1>
579
580  <sect1 id="internal-representation">
581   <title>Internal Representation</title>
582
583   <para>
584    When records are manipulated by the system, they're represented in a
585    tree-structure, with data elements at the leaf nodes, and tags or
586    variant components at the non-leaf nodes. The root-node identifies the
587    schema that lends context to the tagging and structuring of the
588    record. Imagine a simple record, consisting of a 'title' element and
589    an 'author' element:
590   </para>
591
592   <para>
593
594    <screen>
595     TITLE     "Zen and the Art of Motorcycle Maintenance"
596     ROOT 
597     AUTHOR    "Robert Pirsig"
598    </screen>
599
600   </para>
601
602   <para>
603    A slightly more complex record would have the author element consist
604    of two elements, a surname and a first name:
605   </para>
606
607   <para>
608
609    <screen>
610     TITLE     "Zen and the Art of Motorcycle Maintenance"
611     ROOT  
612     FIRST-NAME "Robert"
613     AUTHOR
614     SURNAME    "Pirsig"
615    </screen>
616
617   </para>
618
619   <para>
620    The root of the record will refer to the record schema that describes
621    the structuring of this particular record. The schema defines the
622    element tags (TITLE, FIRST-NAME, etc.) that may occur in the record, as
623    well as the structuring (SURNAME should appear below AUTHOR, etc.). In
624    addition, the schema establishes element set names that are used by
625    the client to request a subset of the elements of a given record. The
626    schema may also establish rules for converting the record to a
627    different schema, by stating, for each element, a mapping to a
628    different tag path.
629   </para>
630
631   <sect2>
632    <title>Tagged Elements</title>
633
634    <para>
635     A data element is characterized by its tag, and its position in the
636     structure of the record. For instance, while the tag "telephone
637     number" may be used different places in a record, we may need to
638     distinguish between these occurrences, both for searching and
639     presentation purposes. For instance, while the phone numbers for the
640     "customer" and the "service provider" are both
641     representatives for the same type of resource (a telephone number), it
642     is essential that they be kept separate. The record schema provides
643     the structure of the record, and names each data element (defined by
644     the sequence of tags - the tag path - by which the element can be
645     reached from the root of the record).
646    </para>
647
648   </sect2>
649
650   <sect2>
651    <title>Variants</title>
652
653    <para>
654     The children of a tag node may be either more tag nodes, a data node
655     (possibly accompanied by tag nodes),
656     or a tree of variant nodes. The children of  variant nodes are either
657     more variant nodes or a data node (possibly accompanied by more
658     variant nodes). Each leaf node, which is normally a
659     data node, corresponds to a <emphasis>variant form</emphasis> of the
660     tagged element identified by the tag which parents the variant tree.
661     The following title element occurs in two different languages:
662    </para>
663
664    <para>
665
666     <screen>
667      VARIANT LANG=ENG  "War and Peace"
668      TITLE
669      VARIANT LANG=DAN  "Krig og Fred"
670     </screen>
671
672    </para>
673
674    <para>
675     Which of the two elements are transmitted to the client by the server
676     depends on the specifications provided by the client, if any.
677    </para>
678
679    <para>
680     In practice, each variant node is associated with a triple of class,
681     type, value, corresponding to the variant mechanism of Z39.50.
682    </para>
683
684   </sect2>
685
686   <sect2>
687    <title>Data Elements</title>
688
689    <para>
690     Data nodes have no children (they are always leaf nodes in the record
691     tree).
692    </para>
693
694    <note>
695     <para>
696      FIXME! Documentation needs extension here about types of nodes - numerical,
697      textual, etc., plus the various types of inclusion notes.
698     </para>
699    </note>
700    
701   </sect2>
702
703  </sect1>
704
705  <sect1 id="data-model">
706   <title>Configuring Your Data Model</title>
707
708   <para>
709    The following sections describe the configuration files that govern
710    the internal management of data records. The system searches for the files
711    in the directories specified by the <emphasis>profilePath</emphasis>
712    setting in the <literal>zebra.cfg</literal> file.
713   </para>
714
715   <sect2>
716    <title>The Abstract Syntax</title>
717
718    <para>
719     The abstract syntax definition (also known as an Abstract Record
720     Structure, or ARS) is the focal point of the
721     record schema description. For a given schema, the ABS file may state any
722     or all of the following:
723    </para>
724
725    <para>
726     FIXME - Need a diagram here, or a simple explanation how it all hangs together -H
727    </para>
728
729    <para>
730
731     <itemizedlist>
732      <listitem>
733
734       <para>
735        The object identifier of the Z39.50 schema associated
736        with the ARS, so that it can be referred to by the client.
737       </para>
738      </listitem>
739
740      <listitem>
741       <para>
742        The attribute set (which can possibly be a compound of multiple
743        sets) which applies in the profile. This is used when indexing and
744        searching the records belonging to the given profile.
745       </para>
746      </listitem>
747
748      <listitem>
749       <para>
750        The Tag set (again, this can consist of several different sets).
751        This is used when reading the records from a file, to recognize the
752        different tags, and when transmitting the record to the client -
753        mapping the tags to their numerical representation, if they are
754        known.
755       </para>
756      </listitem>
757
758      <listitem>
759       <para>
760        The variant set which is used in the profile. This provides a
761        vocabulary for specifying the <emphasis>forms</emphasis> of data that appear inside
762        the records.
763       </para>
764      </listitem>
765
766      <listitem>
767       <para>
768        Element set names, which are a shorthand way for the client to
769        ask for a subset of the data elements contained in a record. Element
770        set names, in the retrieval module, are mapped to <emphasis>element
771         specifications</emphasis>, which contain information equivalent to the
772        <emphasis>Espec-1</emphasis> syntax of Z39.50.
773       </para>
774      </listitem>
775
776      <listitem>
777       <para>
778        Map tables, which may specify mappings to
779        <emphasis>other</emphasis> database profiles, if desired.
780       </para>
781      </listitem>
782
783      <listitem>
784       <para>
785        Possibly, a set of rules describing the mapping of elements to a
786        MARC representation.
787
788       </para>
789      </listitem>
790
791      <listitem>      
792       <para>
793        A list of element descriptions (this is the actual ARS of the
794        schema, in Z39.50 terms), which lists the ways in which the various
795        tags can be used and organized hierarchically.
796       </para>
797      </listitem>
798
799     </itemizedlist>
800
801    </para>
802
803    <para>
804     Several of the entries above simply refer to other files, which
805     describe the given objects.
806    </para>
807
808   </sect2>
809
810   <sect2>
811    <title>The Configuration Files</title>
812
813    <para>
814     This section describes the syntax and use of the various tables which
815     are used by the retrieval module.
816    </para>
817
818    <para>
819     The number of different file types may appear daunting at first, but
820     each type corresponds fairly clearly to a single aspect of the Z39.50
821     retrieval facilities. Further, the average database administrator,
822     who is simply reusing an existing profile for which tables already
823     exist, shouldn't have to worry too much about the contents of these tables.
824    </para>
825
826    <para>
827     Generally, the files are simple ASCII files, which can be maintained
828     using any text editor. Blank lines, and lines beginning with a (&num;) are
829     ignored. Any characters on a line followed by a (&num;) are also ignored.
830     All other lines contain <emphasis>directives</emphasis>, which provide
831     some setting or value to the system.
832     Generally, settings are characterized by a single
833     keyword, identifying the setting, followed by a number of parameters.
834     Some settings are repeatable (r), while others may occur only once in a
835     file. Some settings are optional (o), while others again are
836     mandatory (m).
837    </para>
838    
839   </sect2>
840   
841   <sect2>
842    <title>The Abstract Syntax (.abs) Files</title>
843    
844    <para>
845     The name of this file type is slightly misleading in Z39.50 terms,
846     since, apart from the actual abstract syntax of the profile, it also
847     includes most of the other definitions that go into a database
848     profile.
849    </para>
850    
851    <para>
852     When a record in the canonical, SGML-like format is read from a file
853     or from the database, the first tag of the file should reference the
854     profile that governs the layout of the record. If the first tag of the
855     record is, say, <literal>&lt;gils&gt;</literal>, the system will look
856     for the profile definition in the file <literal>gils.abs</literal>.
857     Profile definitions are cached, so they only have to be read once
858     during the lifespan of the current process. 
859    </para>
860
861    <para>
862     When writing your own input filters, the
863     <emphasis>record-begin</emphasis> command
864     introduces the profile, and should always be called first thing when
865     introducing a new record.
866    </para>
867    
868    <para>
869     The file may contain the following directives:
870    </para>
871
872    <para>
873     <variablelist>
874
875      <varlistentry>
876       <term>name <emphasis>symbolic-name</emphasis></term>
877       <listitem>
878        <para>
879         (m) This provides a shorthand name or
880         description for the profile. Mostly useful for diagnostic purposes.
881        </para>
882       </listitem>
883      </varlistentry>
884      <varlistentry>
885       <term>reference <emphasis>OID-name</emphasis></term>
886       <listitem>
887        <para>
888         (m) The reference name of the OID for the profile.
889         The reference names can be found in the <emphasis>util</emphasis>
890         module of <emphasis>YAZ</emphasis>.
891        </para>
892       </listitem>
893      </varlistentry>
894      <varlistentry>
895       <term>attset <emphasis>filename</emphasis></term>
896       <listitem>
897        <para>
898         (m) The attribute set that is used for
899         indexing and searching records belonging to this profile.
900        </para>
901       </listitem>
902      </varlistentry>
903      <varlistentry>
904       <term>tagset <emphasis>filename</emphasis></term>
905       <listitem>
906        <para>
907         (o) The tag set (if any) that describe
908         that fields of the records.
909        </para>
910       </listitem>
911      </varlistentry>
912      <varlistentry>
913       <term>varset <emphasis>filename</emphasis></term>
914       <listitem>
915        <para>
916         (o) The variant set used in the profile.
917        </para>
918       </listitem>
919      </varlistentry>
920      <varlistentry>
921       <term>maptab <emphasis>filename</emphasis></term>
922       <listitem>
923        <para>
924         (o,r) This points to a
925         conversion table that might be used if the client asks for the record
926         in a different schema from the native one.
927        </para>
928       </listitem></varlistentry>
929      <varlistentry>
930       <term>marc <emphasis>filename</emphasis></term>
931       <listitem>
932        <para>
933         (o) Points to a file containing parameters
934         for representing the record contents in the ISO2709 syntax. Read the
935         description of the MARC representation facility below.
936        </para>
937       </listitem></varlistentry>
938      <varlistentry>
939       <term>esetname <emphasis>name filename</emphasis></term>
940       <listitem>
941        <para>
942         (o,r) Associates the
943         given element set name with an element selection file. If an (@) is
944         given in place of the filename, this corresponds to a null mapping for
945         the given element set name.
946        </para>
947       </listitem></varlistentry>
948      <varlistentry>
949       <term>any <emphasis>tags</emphasis></term>
950       <listitem>
951        <para>
952         (o) This directive specifies a list of attributes
953         which should be appended to the attribute list given for each
954         element. The effect is to make every single element in the abstract
955         syntax searchable by way of the given attributes. This directive
956         provides an efficient way of supporting free-text searching across all
957         elements. However, it does increase the size of the index
958         significantly. The attributes can be qualified with a structure, as in
959         the <emphasis>elm</emphasis> directive below.
960        </para>
961       </listitem></varlistentry>
962      <varlistentry>
963       <term>elm <emphasis>path name attributes</emphasis></term>
964       <listitem>
965        <para>
966         (o,r) Adds an element to the abstract record syntax of the schema.
967         The <emphasis>path</emphasis> follows the
968         syntax which is suggested by the Z39.50 document - that is, a sequence
969         of tags separated by slashes (/). Each tag is given as a
970         comma-separated pair of tag type and -value surrounded by parenthesis.
971         The <emphasis>name</emphasis> is the name of the element, and
972         the <emphasis>attributes</emphasis>
973         specifies which attributes to use when indexing the element in a
974         comma-separated list.
975         A ! in place of the attribute name is equivalent to
976         specifying an attribute name identical to the element name.
977         A - in place of the attribute name
978         specifies that no indexing is to take place for the given element.
979         The attributes can be qualified with <emphasis>field
980          types</emphasis> to specify which
981         character set should govern the indexing procedure for that field.
982         The same data element may be indexed into several different
983         fields, using different character set definitions.
984         See the <xref linkend="field-structure-and-character-sets"/>.
985          The default field type is "w" for <emphasis>word</emphasis>.
986        </para>
987       </listitem></varlistentry>
988     </variablelist>
989    </para>
990
991    <note>
992    <para>
993      The mechanism for controlling indexing is not adequate for
994      complex databases, and will probably be moved into a separate
995      configuration table eventually.
996     </para>
997    </note>
998    
999    <para>
1000     The following is an excerpt from the abstract syntax file for the GILS
1001     profile.
1002    </para>
1003
1004    <para>
1005
1006     <screen>
1007      name gils
1008      reference GILS-schema
1009      attset gils.att
1010      tagset gils.tag
1011      varset var1.var
1012
1013      maptab gils-usmarc.map
1014
1015      # Element set names
1016
1017      esetname VARIANT gils-variant.est  # for WAIS-compliance
1018      esetname B gils-b.est
1019      esetname G gils-g.est
1020      esetname F @
1021
1022      elm (1,10)              rank                        -
1023      elm (1,12)              url                         -
1024      elm (1,14)              localControlNumber     Local-number
1025      elm (1,16)              dateOfLastModification Date/time-last-modified
1026      elm (2,1)               title                       w:!,p:!
1027      elm (4,1)               controlIdentifier      Identifier-standard
1028      elm (2,6)               abstract               Abstract
1029      elm (4,51)              purpose                     !
1030      elm (4,52)              originator                  - 
1031      elm (4,53)              accessConstraints           !
1032      elm (4,54)              useConstraints              !
1033      elm (4,70)              availability                -
1034      elm (4,70)/(4,90)       distributor                 -
1035      elm (4,70)/(4,90)/(2,7) distributorName             !
1036      elm (4,70)/(4,90)/(2,10 distributorOrganization     !
1037      elm (4,70)/(4,90)/(4,2) distributorStreetAddress    !
1038      elm (4,70)/(4,90)/(4,3) distributorCity             !
1039     </screen>
1040
1041    </para>
1042
1043   </sect2>
1044
1045   <sect2 id="attset-files">
1046    <title>The Attribute Set (.att) Files</title>
1047
1048    <para>
1049     This file type describes the <emphasis>Use</emphasis> elements of
1050     an attribute set. 
1051     It contains the following directives. 
1052    </para>
1053    
1054    <para>
1055     <variablelist>
1056      <varlistentry>
1057       <term>name <emphasis>symbolic-name</emphasis></term>
1058       <listitem>
1059        <para>
1060         (m) This provides a shorthand name or
1061         description for the attribute set.
1062         Mostly useful for diagnostic purposes.
1063        </para>
1064       </listitem></varlistentry>
1065      <varlistentry>
1066       <term>reference <emphasis>OID-name</emphasis></term>
1067       <listitem>
1068        <para>
1069         (m) The reference name of the OID for
1070         the attribute set.
1071         The reference names can be found in the <emphasis>util</emphasis>
1072         module of <emphasis>YAZ</emphasis>.
1073        </para>
1074       </listitem></varlistentry>
1075      <varlistentry>
1076       <term>include <emphasis>filename</emphasis></term>
1077       <listitem>
1078        <para>
1079         (o,r) This directive is used to
1080         include another attribute set as a part of the current one. This is
1081         used when a new attribute set is defined as an extension to another
1082         set. For instance, many new attribute sets are defined as extensions
1083         to the <emphasis>bib-1</emphasis> set.
1084         This is an important feature of the retrieval
1085         system of Z39.50, as it ensures the highest possible level of
1086         interoperability, as those access points of your database which are
1087         derived from the external set (say, bib-1) can be used even by clients
1088         who are unaware of the new set.
1089        </para>
1090       </listitem></varlistentry>
1091      <varlistentry>
1092       <term>att
1093        <emphasis>att-value att-name &lsqb;local-value&rsqb;</emphasis></term>
1094       <listitem>
1095        <para>
1096         (o,r) This
1097         repeatable directive introduces a new attribute to the set. The
1098         attribute value is stored in the index (unless a
1099         <emphasis>local-value</emphasis> is
1100         given, in which case this is stored). The name is used to refer to the
1101         attribute from the <emphasis>abstract syntax</emphasis>. 
1102        </para>
1103       </listitem></varlistentry>
1104     </variablelist>
1105    </para>
1106
1107    <para>
1108     This is an excerpt from the GILS attribute set definition.
1109     Notice how the file describing the <emphasis>bib-1</emphasis>
1110     attribute set is referenced.
1111    </para>
1112
1113    <para>
1114
1115     <screen>
1116      name gils
1117      reference GILS-attset
1118      include bib1.att
1119
1120      att 2001           distributorName
1121      att 2002           indextermsControlled
1122      att 2003           purpose
1123      att 2004           accessConstraints
1124      att 2005           useConstraints
1125     </screen>
1126
1127    </para>
1128
1129   </sect2>
1130
1131   <sect2>
1132    <title>The Tag Set (.tag) Files</title>
1133
1134    <para>
1135     This file type defines the tagset of the profile, possibly by
1136     referencing other tag sets (most tag sets, for instance, will include
1137     tagsetG and tagsetM from the Z39.50 specification. The file may
1138     contain the following directives.
1139    </para>
1140
1141    <para>
1142     <variablelist>
1143
1144      <varlistentry>
1145       <term>name <emphasis>symbolic-name</emphasis></term>
1146       <listitem>
1147        <para>
1148         (m) This provides a shorthand name or
1149         description for the tag set. Mostly useful for diagnostic purposes.
1150        </para>
1151       </listitem></varlistentry>
1152      <varlistentry>
1153       <term>reference <emphasis>OID-name</emphasis></term>
1154       <listitem>
1155        <para>
1156         (o) The reference name of the OID for the tag set.
1157         The reference names can be found in the <emphasis>util</emphasis>
1158         module of <emphasis>YAZ</emphasis>.
1159         The directive is optional, since not all tag sets
1160         are registered outside of their schema.
1161        </para>
1162       </listitem></varlistentry>
1163      <varlistentry>
1164       <term>type <emphasis>integer</emphasis></term>
1165       <listitem>
1166        <para>
1167         (m) The type number of the tagset within the schema
1168         profile (note: this specification really should belong to the .abs
1169         file. This will be fixed in a future release).
1170        </para>
1171       </listitem></varlistentry>
1172      <varlistentry>
1173       <term>include <emphasis>filename</emphasis></term>
1174       <listitem>
1175        <para>
1176         (o,r) This directive is used
1177         to include the definitions of other tag sets into the current one.
1178        </para>
1179       </listitem></varlistentry>
1180      <varlistentry>
1181       <term>tag <emphasis>number names type</emphasis></term>
1182       <listitem>
1183        <para>
1184         (o,r) Introduces a new tag to the set.
1185         The <emphasis>number</emphasis> is the tag number as used
1186         in the protocol (there is currently no mechanism for
1187         specifying string tags at this point, but this would be quick
1188         work to add).
1189         The <emphasis>names</emphasis> parameter is a list of names
1190         by which the tag should be recognized in the input file format.
1191         The names should be separated by slashes (/).
1192         The <emphasis>type</emphasis> is the recommended data type of
1193         the tag.
1194         It should be one of the following:
1195
1196         <itemizedlist>
1197          <listitem>
1198           <para>
1199            structured
1200           </para>
1201          </listitem>
1202
1203          <listitem>
1204           <para>
1205            string
1206           </para>
1207          </listitem>
1208
1209          <listitem>
1210           <para>
1211            numeric
1212           </para>
1213          </listitem>
1214
1215          <listitem>
1216           <para>
1217            bool
1218           </para>
1219          </listitem>
1220
1221          <listitem>
1222           <para>
1223            oid
1224           </para>
1225          </listitem>
1226
1227          <listitem>
1228           <para>
1229            generalizedtime
1230           </para>
1231          </listitem>
1232
1233          <listitem>
1234           <para>
1235            intunit
1236           </para>
1237          </listitem>
1238
1239          <listitem>
1240           <para>
1241            int
1242           </para>
1243          </listitem>
1244
1245          <listitem>
1246           <para>
1247            octetstring
1248           </para>
1249          </listitem>
1250
1251          <listitem>
1252           <para>
1253            null
1254           </para>
1255          </listitem>
1256
1257         </itemizedlist>
1258
1259        </para>
1260       </listitem></varlistentry>
1261     </variablelist>
1262    </para>
1263
1264    <para>
1265     The following is an excerpt from the TagsetG definition file.
1266    </para>
1267
1268    <para>
1269     <screen>
1270      name tagsetg
1271      reference TagsetG
1272      type 2
1273
1274      tag        1       title           string
1275      tag        2       author          string
1276      tag        3       publicationPlace string
1277      tag        4       publicationDate string
1278      tag        5       documentId      string
1279      tag        6       abstract        string
1280      tag        7       name            string
1281      tag        8       date            generalizedtime
1282      tag        9       bodyOfDisplay   string
1283      tag        10      organization    string
1284     </screen>
1285    </para>
1286
1287   </sect2>
1288
1289   <sect2 id="variant-set">
1290    <title>The Variant Set (.var) Files</title>
1291
1292    <para>
1293     The variant set file is a straightforward representation of the
1294     variant set definitions associated with the protocol. At present, only
1295     the <emphasis>Variant-1</emphasis> set is known.
1296    </para>
1297
1298    <para>
1299     These are the directives allowed in the file.
1300    </para>
1301
1302    <para>
1303     <variablelist>
1304
1305      <varlistentry>
1306       <term>name <emphasis>symbolic-name</emphasis></term>
1307       <listitem>
1308        <para>
1309         (m) This provides a shorthand name or
1310         description for the variant set. Mostly useful for diagnostic purposes.
1311        </para>
1312       </listitem></varlistentry>
1313      <varlistentry>
1314       <term>reference <emphasis>OID-name</emphasis></term>
1315       <listitem>
1316        <para>
1317         (o) The reference name of the OID for
1318         the variant set, if one is required. The reference names can be found
1319         in the <emphasis>util</emphasis> module of <emphasis>YAZ</emphasis>.
1320        </para>
1321       </listitem></varlistentry>
1322      <varlistentry>
1323       <term>class <emphasis>integer class-name</emphasis></term>
1324       <listitem>
1325        <para>
1326         (m,r) Introduces a new
1327         class to the variant set.
1328        </para>
1329       </listitem></varlistentry>
1330      <varlistentry>
1331       <term>type <emphasis>integer type-name datatype</emphasis></term>
1332       <listitem>
1333        <para>
1334         (m,r) Addes a
1335         new type to the current class (the one introduced by the most recent
1336         <emphasis>class</emphasis> directive).
1337         The type names belong to the same name space as the one used
1338         in the tag set definition file.
1339        </para>
1340       </listitem></varlistentry>
1341     </variablelist>
1342    </para>
1343
1344    <para>
1345     The following is an excerpt from the file describing the variant set
1346     <emphasis>Variant-1</emphasis>.
1347    </para>
1348
1349    <para>
1350
1351     <screen>
1352      name variant-1
1353      reference Variant-1
1354
1355      class 1 variantId
1356
1357      type       1       variantId               octetstring
1358
1359      class 2 body
1360
1361      type       1       iana                    string
1362      type       2       z39.50                  string
1363      type       3       other                   string
1364     </screen>
1365
1366    </para>
1367
1368   </sect2>
1369
1370   <sect2>
1371    <title>The Element Set (.est) Files</title>
1372
1373    <para>
1374     The element set specification files describe a selection of a subset
1375     of the elements of a database record. The element selection mechanism
1376     is equivalent to the one supplied by the <emphasis>Espec-1</emphasis>
1377     syntax of the Z39.50 specification.
1378     In fact, the internal representation of an element set
1379     specification is identical to the <emphasis>Espec-1</emphasis> structure,
1380     and we'll refer you to the description of that structure for most of
1381     the detailed semantics of the directives below.
1382    </para>
1383
1384    <note>
1385     <para>
1386      Not all of the Espec-1 functionality has been implemented yet.
1387      The fields that are mentioned below all work as expected, unless
1388      otherwise is noted.
1389     </para>
1390    </note>
1391    
1392    <para>
1393     The directives available in the element set file are as follows:
1394    </para>
1395
1396    <para>
1397     <variablelist>
1398      <varlistentry>
1399       <term>defaultVariantSetId <emphasis>OID-name</emphasis></term>
1400       <listitem>
1401        <para>
1402         (o) If variants are used in
1403         the following, this should provide the name of the variantset used
1404         (it's not currently possible to specify a different set in the
1405         individual variant request). In almost all cases (certainly all
1406         profiles known to us), the name
1407         <literal>Variant-1</literal> should be given here.
1408        </para>
1409       </listitem></varlistentry>
1410      <varlistentry>
1411       <term>defaultVariantRequest <emphasis>variant-request</emphasis></term>
1412       <listitem>
1413        <para>
1414         (o) This directive
1415         provides a default variant request for
1416         use when the individual element requests (see below) do not contain a
1417         variant request. Variant requests consist of a blank-separated list of
1418         variant components. A variant compont is a comma-separated,
1419         parenthesized triple of variant class, type, and value (the two former
1420         values being represented as integers). The value can currently only be
1421         entered as a string (this will change to depend on the definition of
1422         the variant in question). The special value (@) is interpreted as a
1423         null value, however.
1424        </para>
1425       </listitem></varlistentry>
1426      <varlistentry>
1427       <term>simpleElement
1428        <emphasis>path &lsqb;'variant' variant-request&rsqb;</emphasis></term>
1429       <listitem>
1430        <para>
1431         (o,r) This corresponds to a simple element request
1432         in <emphasis>Espec-1</emphasis>.
1433         The path consists of a sequence of tag-selectors, where each of
1434         these can consist of either:
1435        </para>
1436
1437        <para>
1438         <itemizedlist>
1439          <listitem>
1440           <para>
1441            A simple tag, consisting of a comma-separated type-value pair in
1442            parenthesis, possibly followed by a colon (:) followed by an
1443            occurrences-specification (see below). The tag-value can be a number
1444            or a string. If the first character is an apostrophe ('), this
1445            forces the value to be interpreted as a string, even if it
1446            appears to be numerical.
1447           </para>
1448          </listitem>
1449
1450          <listitem>
1451           <para>
1452            A WildThing, represented as a question mark (?), possibly
1453            followed by a colon (:) followed by an occurrences
1454            specification (see below).
1455           </para>
1456          </listitem>
1457
1458          <listitem>
1459           <para>
1460            A WildPath, represented as an asterisk (*). Note that the last
1461            element of the path should not be a wildPath (wildpaths don't
1462            work in this version).
1463           </para>
1464          </listitem>
1465
1466         </itemizedlist>
1467
1468        </para>
1469
1470        <para>
1471         The occurrences-specification can be either the string
1472         <literal>all</literal>, the string <literal>last</literal>, or
1473         an explicit value-range. The value-range is represented as
1474         an integer (the starting point), possibly followed by a
1475         plus (+) and a second integer (the number of elements, default
1476         being one).
1477        </para>
1478
1479        <para>
1480         The variant-request has the same syntax as the defaultVariantRequest
1481         above. Note that it may sometimes be useful to give an empty variant
1482         request, simply to disable the default for a specific set of fields
1483         (we aren't certain if this is proper <emphasis>Espec-1</emphasis>,
1484         but it works in this implementation).
1485        </para>
1486       </listitem></varlistentry>
1487     </variablelist>
1488    </para>
1489
1490    <para>
1491     The following is an example of an element specification belonging to
1492     the GILS profile.
1493    </para>
1494
1495    <para>
1496
1497     <screen>
1498      simpleelement (1,10)
1499      simpleelement (1,12)
1500      simpleelement (2,1)
1501      simpleelement (1,14)
1502      simpleelement (4,1)
1503      simpleelement (4,52)
1504     </screen>
1505
1506    </para>
1507
1508   </sect2>
1509
1510   <sect2 id="schema-mapping">
1511    <title>The Schema Mapping (.map) Files</title>
1512
1513    <para>
1514     Sometimes, the client might want to receive a database record in
1515     a schema that differs from the native schema of the record. For
1516     instance, a client might only know how to process WAIS records, while
1517     the database record is represented in a more specific schema, such as
1518     GILS. In this module, a mapping of data to one of the MARC formats is
1519     also thought of as a schema mapping (mapping the elements of the
1520     record into fields consistent with the given MARC specification, prior
1521     to actually converting the data to the ISO2709). This use of the
1522     object identifier for USMARC as a schema identifier represents an
1523     overloading of the OID which might not be entirely proper. However,
1524     it represents the dual role of schema and record syntax which
1525     is assumed by the MARC family in Z39.50.
1526    </para>
1527
1528    <para>
1529     <emphasis>NOTE: FIXME! The schema-mapping functions are so far limited to a
1530      straightforward mapping of elements. This should be extended with
1531      mechanisms for conversions of the element contents, and conditional
1532      mappings of elements based on the record contents.</emphasis>
1533    </para>
1534
1535    <para>
1536     These are the directives of the schema mapping file format:
1537    </para>
1538
1539    <para>
1540     <variablelist>
1541
1542      <varlistentry>
1543       <term>targetName <emphasis>name</emphasis></term>
1544       <listitem>
1545        <para>
1546         (m) A symbolic name for the target schema
1547         of the table. Useful mostly for diagnostic purposes.
1548        </para>
1549       </listitem></varlistentry>
1550      <varlistentry>
1551       <term>targetRef <emphasis>OID-name</emphasis></term>
1552       <listitem>
1553        <para>
1554         (m) An OID name for the target schema.
1555         This is used, for instance, by a server receiving a request to present
1556         a record in a different schema from the native one.
1557         The name, again, is found in the <emphasis>oid</emphasis>
1558         module of <emphasis>YAZ</emphasis>.
1559        </para>
1560       </listitem></varlistentry>
1561      <varlistentry>
1562       <term>map <emphasis>element-name target-path</emphasis></term>
1563       <listitem>
1564        <para>
1565         (o,r) Adds
1566         an element mapping rule to the table.
1567        </para>
1568       </listitem></varlistentry>
1569     </variablelist>
1570    </para>
1571
1572   </sect2>
1573
1574   <sect2>
1575    <title>The MARC (ISO2709) Representation (.mar) Files</title>
1576
1577    <para>
1578     This file provides rules for representing a record in the ISO2709
1579     format. The rules pertain mostly to the values of the constant-length
1580     header of the record.
1581    </para>
1582
1583    <para>
1584     <emphasis>NOTE: FIXME! This will be described better. We're in the process of
1585      re-evaluating and most likely changing the way that MARC records are
1586      handled by the system.</emphasis>
1587    </para>
1588
1589   </sect2>
1590
1591   <sect2 id="field-structure-and-character-sets">
1592    <title>Field Structure and Character Sets
1593    </title>
1594
1595    <para>
1596     In order to provide a flexible approach to national character set
1597     handling, Zebra allows the administrator to configure the set up the
1598     system to handle any 8-bit character set &mdash; including sets that
1599     require multi-octet diacritics or other multi-octet characters. The
1600     definition of a character set includes a specification of the
1601     permissible values, their sort order (this affects the display in the
1602     SCAN function), and relationships between upper- and lowercase
1603     characters. Finally, the definition includes the specification of
1604     space characters for the set.
1605    </para>
1606
1607    <para>
1608     The operator can define different character sets for different fields,
1609     typical examples being standard text fields, numerical fields, and
1610     special-purpose fields such as WWW-style linkages (URx).
1611    </para>
1612
1613    <para>
1614     The field types, and hence character sets, are associated with data
1615     elements by the .abs files (see above).
1616     The file <literal>default.idx</literal>
1617     provides the association between field type codes (as used in the .abs
1618     files) and the character map files (with the .chr suffix). The format
1619     of the .idx file is as follows
1620    </para>
1621
1622    <para>
1623     <variablelist>
1624
1625      <varlistentry>
1626       <term>index <emphasis>field type code</emphasis></term>
1627       <listitem>
1628        <para>
1629         This directive introduces a new search index code.
1630         The argument is a one-character code to be used in the
1631         .abs files to select this particular index type. An index, roughly,
1632         corresponds to a particular structure attribute during search. Refer
1633         to <xref linkend="search"/>.
1634        </para>
1635       </listitem></varlistentry>
1636      <varlistentry>
1637       <term>sort <emphasis>field code type</emphasis></term>
1638       <listitem>
1639        <para>
1640         This directive introduces a 
1641         sort index. The argument is a one-character code to be used in the
1642         .abs fie to select this particular index type. The corresponding
1643         use attribute must be used in the sort request to refer to this
1644         particular sort index. The corresponding character map (see below)
1645         is used in the sort process.
1646        </para>
1647       </listitem></varlistentry>
1648      <varlistentry>
1649       <term>completeness <emphasis>boolean</emphasis></term>
1650       <listitem>
1651        <para>
1652         This directive enables or disables complete field indexing.
1653         The value of the <emphasis>boolean</emphasis> should be 0
1654         (disable) or 1. If completeness is enabled, the index entry will
1655         contain the complete contents of the field (up to a limit), with words
1656         (non-space characters) separated by single space characters
1657         (normalized to " " on display). When completeness is
1658         disabled, each word is indexed as a separate entry. Complete subfield
1659         indexing is most useful for fields which are typically browsed (eg.
1660         titles, authors, or subjects), or instances where a match on a
1661         complete subfield is essential (eg. exact title searching). For fields
1662         where completeness is disabled, the search engine will interpret a
1663         search containing space characters as a word proximity search.
1664        </para>
1665       </listitem></varlistentry>
1666      <varlistentry>
1667       <term>charmap <emphasis>filename</emphasis></term>
1668       <listitem>
1669        <para>
1670         This is the filename of the character
1671         map to be used for this index for field type.
1672        </para>
1673       </listitem></varlistentry>
1674     </variablelist>
1675    </para>
1676
1677    <para>
1678     The contents of the character map files are structured as follows:
1679    </para>
1680
1681    <para>
1682     <variablelist>
1683
1684      <varlistentry>
1685       <term>lowercase <emphasis>value-set</emphasis></term>
1686       <listitem>
1687        <para>
1688         This directive introduces the basic value set of the field type.
1689         The format is an ordered list (without spaces) of the
1690         characters which may occur in "words" of the given type.
1691         The order of the entries in the list determines the
1692         sort order of the index. In addition to single characters, the
1693         following combinations are legal:
1694        </para>
1695
1696        <para>
1697
1698         <itemizedlist>
1699          <listitem>
1700           <para>
1701            Backslashes may be used to introduce three-digit octal, or
1702            two-digit hex representations of single characters
1703            (preceded by <literal>x</literal>).
1704            In addition, the combinations
1705            \\, \\r, \\n, \\t, \\s (space &mdash; remember that real
1706            space-characters may not occur in the value definition), and
1707            \\ are recognized, with their usual interpretation.
1708           </para>
1709          </listitem>
1710
1711          <listitem>
1712           <para>
1713            Curly braces &lcub;&rcub; may be used to enclose ranges of single
1714            characters (possibly using the escape convention described in the
1715            preceding point), eg. &lcub;a-z&rcub; to introduce the
1716            standard range of ASCII characters.
1717            Note that the interpretation of such a range depends on
1718            the concrete representation in your local, physical character set.
1719           </para>
1720          </listitem>
1721
1722          <listitem>
1723           <para>
1724            paranthesises () may be used to enclose multi-byte characters -
1725            eg. diacritics or special national combinations (eg. Spanish
1726            "ll"). When found in the input stream (or a search term),
1727            these characters are viewed and sorted as a single character, with a
1728            sorting value depending on the position of the group in the value
1729            statement.
1730           </para>
1731          </listitem>
1732
1733         </itemizedlist>
1734
1735        </para>
1736       </listitem></varlistentry>
1737      <varlistentry>
1738       <term>uppercase <emphasis>value-set</emphasis></term>
1739       <listitem>
1740        <para>
1741         This directive introduces the
1742         upper-case equivalencis to the value set (if any). The number and
1743         order of the entries in the list should be the same as in the
1744         <literal>lowercase</literal> directive.
1745        </para>
1746       </listitem></varlistentry>
1747      <varlistentry>
1748       <term>space <emphasis>value-set</emphasis></term>
1749       <listitem>
1750        <para>
1751         This directive introduces the character
1752         which separate words in the input stream. Depending on the
1753         completeness mode of the field in question, these characters either
1754         terminate an index entry, or delimit individual "words" in
1755         the input stream. The order of the elements is not significant &mdash;
1756         otherwise the representation is the same as for the
1757         <literal>uppercase</literal> and <literal>lowercase</literal>
1758         directives.
1759        </para>
1760       </listitem></varlistentry>
1761      <varlistentry>
1762       <term>map <emphasis>value-set</emphasis>
1763        <emphasis>target</emphasis></term>
1764       <listitem>
1765        <para>
1766         This directive introduces a
1767         mapping between each of the members of the value-set on the left to
1768         the character on the right. The character on the right must occur in
1769         the value set (the <literal>lowercase</literal> directive) of
1770         the character set, but
1771         it may be a paranthesis-enclosed multi-octet character. This directive
1772         may be used to map diacritics to their base characters, or to map
1773         HTML-style character-representations to their natural form, etc.
1774        </para>
1775       </listitem></varlistentry>
1776     </variablelist>
1777    </para>
1778
1779   </sect2>
1780
1781  </sect1>
1782
1783  <sect1 id="formats">
1784   <title>Exchange Formats</title>
1785
1786   <para>
1787    Converting records from the internal structure to en exchange format
1788    is largely an automatic process. Currently, the following exchange
1789    formats are supported:
1790   </para>
1791
1792   <para>
1793    <itemizedlist>
1794     <listitem>
1795      <para>
1796       GRS-1. The internal representation is based on GRS-1/XML, so the
1797       conversion here is straightforward. The system will create
1798       applied variant and supported variant lists as required, if a record
1799       contains variant information.
1800      </para>
1801     </listitem>
1802
1803     <listitem>
1804      <para>
1805       XML. The internal representation is based on GRS-1/XML so
1806       the mapping is trivial. Note that XML schemas, preprocessing
1807       instructions and comments are not part of the internal representation
1808       and therefore will never be part of a generated XML record.
1809       Future versions of the Zebra will support that.
1810      </para>
1811     </listitem>
1812
1813     <listitem>
1814      <para>
1815       SUTRS. Again, the mapping is fairly straightforward. Indentation
1816       is used to show the hierarchical structure of the record. All
1817       "GRS" type records support both the GRS-1 and SUTRS
1818       representations.
1819       FIXME - What is SUTRS - should be expanded here
1820      </para>
1821     </listitem>
1822
1823     <listitem>
1824      <para>
1825       ISO2709-based formats (USMARC, etc.). Only records with a
1826       two-level structure (corresponding to fields and subfields) can be
1827       directly mapped to ISO2709. For records with a different structuring
1828       (eg., GILS), the representation in a structure like USMARC involves a
1829       schema-mapping (see <xref linkend="schema-mapping"/>), to an
1830        "implied" USMARC schema (implied,
1831        because there is no formal schema which specifies the use of the
1832        USMARC fields outside of ISO2709). The resultant, two-level record is
1833        then mapped directly from the internal representation to ISO2709. See
1834        the GILS schema definition files for a detailed example of this
1835        approach.
1836      </para>
1837     </listitem>
1838
1839     <listitem>
1840      <para>
1841       Explain. This representation is only available for records
1842       belonging to the Explain schema.
1843      </para>
1844     </listitem>
1845
1846     <listitem>
1847      <para>
1848       Summary. This ASN-1 based structure is only available for records
1849       belonging to the Summary schema - or schema which provide a mapping
1850       to this schema (see the description of the schema mapping facility
1851       above).
1852      </para>
1853     </listitem>
1854
1855     <listitem>
1856      <para>
1857       SOIF. Support for this syntax is experimental, and is currently
1858       keyed to a private Index Data OID (1.2.840.10003.5.1000.81.2). All
1859       abstract syntaxes can be mapped to the SOIF format, although nested
1860       elements are represented by concatenation of the tag names at each
1861       level.
1862       FIXME - Is this used anywhere ? What is SOIF anyway? -H
1863      </para>
1864     </listitem>
1865
1866    </itemizedlist>
1867   </para>
1868  </sect1>
1869
1870 </chapter>
1871  <!-- Keep this comment at the end of the file
1872  Local variables:
1873  mode: sgml
1874  sgml-omittag:t
1875  sgml-shorttag:t
1876  sgml-minimize-attributes:nil
1877  sgml-always-quote-attributes:t
1878  sgml-indent-step:1
1879  sgml-indent-data:t
1880  sgml-parent-document: "zebra.xml"
1881  sgml-local-catalogs: nil
1882  sgml-namecase-general:t
1883  End:
1884  -->