Wrote some doc about Search.
[idzebra-moved-to-github.git] / doc / zebra.sgml
1 <!doctype linuxdoc system>
2
3 <!--
4   $Id: zebra.sgml,v 1.30 1996-11-08 11:07:33 adam Exp $
5 -->
6
7 <article>
8 <title>Zebra Server - Administrators's Guide and Reference
9 <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">, <tt><htmlurl url="mailto:info@index.ping.dk" name="info@index.ping.dk"></>
10 <date>$Revision: 1.30 $
11 <abstract>
12 The Zebra information server combines a versatile fielded/free-text
13 search engine with a Z39.50-1995 frontend to provide a powerful and flexible
14 information management system. This document explains the procedure for
15 installing and configuring the system, and outlines the possibilities
16 for managing data and providing Z39.50
17 services with the software.
18 </abstract>
19
20 <toc>
21
22 <sect>Introduction
23
24 <sect1>Overview
25
26 <p>
27 The Zebra system is a fielded free-text indexing and retrieval engine with a
28 Z39.50 frontend. You can use any commercial or freeware Z39.50 client
29 to access data stored in Zebra.
30
31 The Zebra server is our first step towards the development of a fully
32 configurable, open information system. Eventually, it will be paired
33 off with a powerful Z39.50 client to support complex information
34 management tasks within almost any application domain. We're making
35 the server available now because it's no fun to be in the open
36 information retrieval business all by yourself. We want to allow
37 people with interesting data to make their things
38 available in interesting ways, without having to start out
39 by implementing yet another protocol stack from scratch.
40
41 This document is an introduction to the Zebra system. It will tell you
42 how to compile the software, and how to prepare your first database.
43 It also explains how the server can be configured to give you the
44 functionality that you need.
45
46 If you find the software interesting, you should join the support
47 mailing-list by sending Email to <tt/zebra-request@index.ping.dk/.
48
49 <sect1>Features
50
51 <p>
52 This is a list of some of the most important features of the
53 system.
54
55 <itemize>
56
57 <item>
58 Supports updating - records can be added and deleted without
59 rebuilding the index from scratch.
60 The update procedure is tolerant to crashes or hard interrupts
61 during register updating - registers can be reconstructed following a crash.
62 Registers can be safely updated even while users are accessing the server.
63
64 <item>
65 Supports large databases - files for indices, etc. can be
66 automatically partitioned over multiple disks.
67
68 <item>
69 Supports arbitrarily complex records - base input format is an
70 SGML-like syntax which allows nested (structured) data elements, as
71 well as variant forms of data.
72
73 <item>
74 Supports random storage formats. A system of input filters driven by
75 regular expressions allows you to easily process most ASCII-based
76 data formats.
77
78 <item>
79 Supports boolean queries as well as relevance-ranking (free-text)
80 searching. Right truncation and masking in terms are supported, as
81 well as full regular expressions.
82
83 <item>
84 Supports multiple concrete syntaxes
85 for record exchange (depending on the configuration): GRS-1, SUTRS,
86 ISO2709 (*MARC). Records can be mapped between record syntaxes and
87 schema on the fly.
88
89 <item>
90 Supports approximate matching in registers (ie. spelling mistakes,
91 etc).
92
93 <item>
94 Protocol support:
95
96 <itemize>
97
98 <item>
99 Protocol facilities: Init, Search, Retrieve, Browse.
100
101 <item>
102 Piggy-backed presents are honored in the search-request.
103
104 <item>
105 Named result sets are supported.
106
107 <item>
108 Easily configured to support different application profiles, with
109 tables for attribute sets, tag sets, and abstract syntaxes.
110 Additional tables control facilities such as element mappings to
111 different schema (eg., GILS-to-USMARC).
112
113 <item>
114 Complex composition specifications using Espec-1 are partially
115 supported (simple element requests only).
116
117 <item>
118 Element Set Names are defined using the Espec-1 capability of the
119 system, and are given in configuration files as simple element
120 requests (and possibly variant requests).
121
122 <item>
123 Some variant support (not fully implemented yet).
124
125 <item>
126 Using the YAZ toolkit for the protocol implementation, the
127 server can utilise a plug-in XTI/mOSI implementation (not included) to
128 provide SR services over an OSI stack, as well as Z39.50 over TCP/IP.
129
130 </itemize>
131
132 </itemize>
133
134 <sect1>Future Work
135
136 <p>
137 This is an alfa-release of the software, to allow you to look at
138 it - try it out, and assess whether it can be of use to you. We expect
139 this version to be followed by a succession of beta-releases until we
140 arrive at a stable first version.
141
142 These are some of the plans that we have for the software in the near
143 and far future, approximately ordered after their relative importance.
144 Items marked with an
145 asterisk will be implemented before the
146 last beta release.
147
148 <itemize>
149
150 <item>
151 *Complete the support for variants. Finalize support for the WAIS
152 retrieval methodology.
153
154 <item>
155 *Finalize the data element <it/include/ facility to support multimedia
156 data elements in records.
157
158 <item>
159 *Port the system to Windows NT.
160
161 <item>
162 Add index and data compression to save disk space.
163
164 <item>
165 Add more sophisticated relevance ranking mechanisms. Add support for soundex
166 and stemming. Add relevance <it/feedback/ support.
167
168 <item>
169 Add Explain support.
170
171 <item>
172 Add support for very large records by implementing segmentation and/or
173 variant pieces.
174
175 <item>
176 Support the Item Update extended service of the protocol.
177
178 <item>
179 We want to add a management system that allows you to
180 control your databases and configuration tables from a graphical
181 interface. We'll probably use Tcl/Tk to stay platform-independent.
182
183 </itemize>
184
185 Programmers thrive on user feedback. If you are interested in a facility that
186 you don't see mentioned here, or if there's something you think we
187 could do better, please drop us a mail. If you think it's all really
188 neat, you're welcome to drop us a line saying that, too. You'll find
189 contact info at the end of this file.
190
191 <sect>Compiling the software
192
193 <p>
194 An ANSI C compiler is required to compile the Zebra
195 server system &mdash; <tt/gcc/ works fine if your own system doesn't
196 provide an adequate compiler.
197
198 Unpack the distribution archive. In some cases, you may want to edit
199 the top-level <tt/Makefile/, eg. to select a different C compiler, or
200 to specify machine-specific libraries in the <bf/NETLIB/ variable.
201
202 When you are done editing the <tt>Makefile</tt> type:
203 <tscreen><verb>
204 $ make
205 </verb></tscreen>
206
207 If successful, two executables have been created in the sub-directory
208 <tt/index/.
209 <descrip>
210 <tag><tt>zebrasrv</tt></tag> The Z39.50 server and search engine.
211 <tag><tt>zebraidx</tt></tag> The administrative tool for the search index.
212 </descrip>
213
214 <sect>Quick Start 
215 <p>
216 In this section, we will test the system by indexing a small set of sample
217 GILS records that are included with the software distribution. Go to the
218 <tt>test</tt> subdirectory of the distribution archive. There you will
219 find a configuration
220 file named <tt>zebra.cfg</tt> with the following contents:
221 <tscreen><verb>
222 # Where are the YAZ tables located.
223 profilePath: ../../yaz/tab ../tab
224
225 # Files that describe the attribute sets supported.
226 attset: bib1.att
227 attset: gils.att
228
229 # Name of character map file.
230 charMap: scan.chr
231 </verb></tscreen>
232
233 Now, edit the file and set <tt>profilePath</tt> to the path of the
234 YAZ profile tables (sub directory <tt>tab</tt> of the YAZ distribution
235 archive).
236
237 The 48 test records are located in the sub directory <tt>records</tt>.
238 To index these, type:
239 <tscreen><verb>
240 $ ../index/zebraidx -t grs.sgml update records
241 </verb></tscreen>
242
243 In the command above the option <tt>-t</tt> specified the record
244 type &mdash; in this case <tt>grs.sgml</tt>. The word <tt>update</tt> followed
245 by a directory root updates all files below that directory node.
246
247 If your indexing command was successful, you are now ready to
248 fire up a server. To start a server on port 2100, type:
249 <tscreen><verb>
250 $ ../index/zebrasrv tcp:@:2100
251 </verb></tscreen>
252
253 The Zebra index that you have just created has a single database
254 named <tt/Default/. The database contains records structured according to
255 the GILS profile, and the server will
256 return records in either either USMARC, GRS-1, or SUTRS depending
257 on what your client asks
258 for.
259
260 To test the server, you can use any Z39.50 client (1992 or later). For
261 instance, you can use the demo client that comes with YAZ: Just cd to
262 the <tt/client/ subdirectory of the YAZ distribution and type:
263
264 <tscreen><verb>
265 $ client tcp:localhost:2100
266 </verb></tscreen>
267
268 When the client has connected, you can type:
269
270 <tscreen><verb>
271 Z> find surficial
272 Z> show 1
273 </verb></tscreen>
274
275 The default retrieval syntax for the client is USMARC. To try other
276 formats for the same record, try:
277
278 <tscreen><verb>
279 Z>format sutrs
280 Z>show 1
281 Z>format grs-1
282 Z>show 1
283 Z>elements B
284 Z>show 1
285 </verb></tscreen>
286
287 <it>NOTE: You may notice that more fields are returned when your
288 client requests SUTRS or GRS-1 records. When retrieving GILS records,
289 this is normal - not all of the GILS data elements have mappings in
290 the USMARC record format.</it>
291
292 If you've made it this far, there's a good chance that
293 you've got through the compilation OK.
294
295 <sect>Administrating Zebra<label id="administrating">
296
297 <p>
298 Unlike many simpler retrieval systems, Zebra supports safe, incremental
299 updates to an existing index.
300
301 Normally, when Zebra modifies the index it reads a number of records
302 that you specify.
303 Depending on your specifications and on the contents of each record
304 one the following events take place for each record:
305 <descrip>
306 <tag>Insert</tag> The record is indexed as if it never occurred
307 before. Either the Zebra system doesn't know how to identify the record or
308 Zebra can identify the record but didn't find it to be already indexed.
309 <tag>Modify</tag> The record has already been indexed. In this case
310 either the contents of the record or the location (file) of the record
311 indicates that it has been indexed before.
312 <tag>Delete</tag> The record is deleted from the index. As in the
313 update-case it must be able to identify the record.
314 </descrip>
315
316 Please note that in both the modify- and delete- case the Zebra
317 indexer must be able to generate a unique key that identifies the record in
318 question (more on this below).
319
320 To administrate the Zebra retrieval system, you run the
321 <tt>zebraidx</tt> program. This program supports a number of options
322 which are preceded by a minus, and a few commands (not preceded by
323 minus).
324
325 Both the Zebra administrative tool and the Z39.50 server share a
326 set of index files and a global configuration file. The
327 name of the configuration file defaults to <tt>zebra.cfg</tt>.
328 The configuration file includes specifications on how to index
329 various kinds of records and where the other configuration files
330 are located. <tt>zebrasrv</tt> and <tt>zebraidx</tt> <em>must</em>
331 be run in the directory where the configuration file lives unless you
332 indicate the location of the configuration file by option
333 <tt>-c</tt>.
334
335 <sect1>Record Types<label id="record-types">
336 <p>
337 Indexing is a per-record process, in which
338 either insert/modify/delete will occur. Before a record is indexed
339 search keys are extracted from whatever might be the layout the
340 original record (sgml,html,text, etc..). The Zebra system 
341 currently only supports SGML-like, structured records and unstructured text
342 records.
343 To specify a particular extraction process, use either the
344 command line option <tt>-t</tt> or specify a
345 <tt>recordType</tt> setting in the configuration file.
346
347 <sect1>The Zebra Configuration File<label id="configuration-file">
348 <p>
349 The Zebra configuration file, read by <tt>zebraidx</tt> and
350 <tt>zebrasrv</tt> defaults to <tt>zebra.cfg</tt> unless specified
351 by <tt>-c</tt> option.
352
353 You can edit the configuration file with a normal text editor.
354 Parameter names and values are seperated by colons in the file. Lines
355 starting with a hash sign (<tt/&num;/) are treated as comments.
356
357 If you manage different sets of records that share common
358 characteristics, you can organize the configuration settings for each
359 type into &dquot;groups&dquot;.
360 When <tt>zebraidx</tt> is run and you wish to address a given group
361 you specify the group name with the <tt>-g</tt> option. In this case
362 settings that have the group name as their prefix will be used
363 by <tt>zebraidx</tt>. If no <tt/-g/ option is specified, the settings
364 with no prefix are used.
365
366 In the configuration file, the group name is placed before the option
367 name itself, separated by a dot (.). For instance, to set the record type
368 for group <tt/public/ to <tt/grs.sgml/ (the SGML-like format for structured
369 records) you would write:
370
371 <tscreen><verb>
372 public.recordType: grs.sgml
373 </verb></tscreen>
374
375 To set the default value of the record type to <tt/text/ write:
376
377 <tscreen><verb>
378 recordType: text
379 </verb></tscreen>
380
381 The available configuration settings are summarized below. They will be
382 explained further in the following sections.
383
384 <descrip>
385 <tag><it>group</it>.recordType&lsqb;<it>.name</it>&rsqb;</tag>
386  Specifies how records with the file extension <it>name</it> should
387  be handled by the indexer. This option may also be specified
388  as a command line option (<tt>-t</tt>). Note that if you do not
389  specify a <it/name/, the setting applies to all files. In general,
390  the record type specifier consists of the elements (each
391  element separated by dot), <it>fundamental-type</it>,
392  <it>file-read-type</it> and arguments. Currently, two
393  fundamental types exist, <tt>text</tt> and <tt>grs</tt>.
394  <tag><it>group</it>.recordId</tag>
395  Specifies how the records are to be identified when updated. See
396 section <ref id="locating-records" name="Locating Records">.
397 <tag><it>group</it>.database</tag>
398  Specifies the Z39.50 database name.
399 <tag><it>group</it>.storeKeys</tag>
400  Specifies whether key information should be saved for a given
401  group of records. If you plan to update/delete this type of
402  records later this should be specified as 1; otherwise it
403  should be 0 (default), to save register space. See section
404 <ref id="file-ids" name="Indexing With File Record IDs">.
405 <tag><it>group</it>.storeData</tag>
406  Specifies whether the records should be stored internally
407  in the Zebra system files. If you want to maintain the raw records yourself,
408  this option should be false (0). If you want Zebra to take care of the records
409  for you, it should be true(1).
410 <tag>register</tag> 
411  Specifies the location of the various register files that Zebra uses
412  to represent your databases. See section
413 <ref id="register-location" name="Register Location">.
414 <tag>shadow</tag>
415  Enables the <it/safe update/ facility of Zebra, and tells the system
416  where to place the required, temporary files. See section
417 <ref id="shadow-registers" name="Safe Updating - Using Shadow Registers">.
418 <tag>lockDir</tag>
419  Directory in which various lock files are stored.
420 <tag>keyTmpDir</tag>
421  Directory in which temporary files used during zebraidx' update
422  phase are stored. 
423 <tag>setTmpDir</tag>
424  Specifies the directory that the server uses for temporary result sets.
425  If not specified <tt>/tmp</tt> will be used.
426 <tag>profilePath</tag>
427  Specifies the location of profile specification files.
428 <tag>attset</tag> 
429  Specifies the filename(s) of attribute set files for use in
430  searching. At least the Bib-1 set should be loaded (<tt/bib1.att/).
431  The <tt/profilePath/ setting is used to look for the specified files.
432  See section <ref id="attset-files" name="The Attribute Set Files">
433 <tag>charMap</tag>
434  Specifies the filename of a character mapping. Zebra uses the path,
435  <tt>profilePath</tt>, to locate this file.
436 <tag>memMax</tag>
437  Specifies size of internal memory to use for the zebraidx program. The
438  amount is given in megabytes - default is 4 (4 MB).
439 </descrip>
440 <sect1>Locating Records<label id="locating-records">
441 <p>
442 The default behaviour of the Zebra system is to reference the
443 records from their original location, i.e. where they were found when you
444 ran <tt/zebraidx/. That is, when a client wishes to retrieve a record
445 following a search operation, the files are accessed from the place
446 where you originally put them - if you remove the files (without
447 running <tt/zebraidx/ again, the client will receive a diagnostic
448 message.
449
450 If your input files are not permanent - for example if you retrieve
451 your records from an outside source, or if they were temporarily
452 mounted on a CD-ROM drive,
453 you may want Zebra to make an internal copy of them. To do this,
454 you specify 1 (true) in the <tt>storeData</tt> setting. When
455 the Z39.50 server retrieves the records they will be read from the
456 internal file structures of the system.
457
458 <sect1>Indexing with no Record IDs (Simple Indexing)
459
460 <p>
461 If you have a set of records that is not expected to change over time
462 you may can build your database without record IDs.
463 This indexing method uses less space than the other methods and
464 is simple to use. 
465
466 To use this method, you simply don't provide the <tt>recordId</tt> entry
467 for the group of files that you index. To add a set of records you use
468 <tt>zebraidx</tt> with the <tt>update</tt> command. The
469 <tt>update</tt> command will always add all of the records that it
470 encounters to the index - whether they have already been indexed or
471 not. If the set of indexed files change, you should delete all of the
472 index files, and build a new index from scratch.
473
474 Consider a system in which you have a group of text files called
475 <tt>simple</tt>. That group of records should belong to a Z39.50 database
476 called <tt>textbase</tt>. The following <tt/zebra.cfg/ file will suffice:
477
478 <tscreen><verb>
479 profilePath: /usr/local/yaz
480 attset: bib1.att
481 simple.recordType: text
482 simple.database: textbase
483 </verb></tscreen>
484
485 Since the existing records in an index can not be addressed by their
486 IDs, it is impossible to delete or modify records when using this method.
487
488 <sect1>Indexing with File Record IDs<label id="file-ids">
489
490 <p>
491 If you have a set of files that regularly change over time: Old files
492 are deleted, new ones are added, or existing files are modified, you
493 can benefit from using the <it/file ID/ indexing methodology. Examples
494 of this type of database might include an index of WWW resources, or a
495 USENET news spool area. Briefly speaking, the file key methodology
496 uses the directory paths of the individual records as a unique
497 identifier for each record. To perform indexing of a directory with
498 file keys, again, you specify the top-level directory after the
499 <tt>update</tt> command. The command will recursively traverse the
500 directories and compare each one with whatever have been indexed before in
501 that same directory. If a file is new (not in the previous version of
502 the directory) it is inserted into the registers; if a file was
503 already indexed and it has been modified since the last update,
504 the index is also modified; if a file has been removed since the last
505 visit, it is deleted from the index.
506
507 The resulting system is easy to administrate. To delete a record you
508 simply have to delete the corresponding file (say, with the <tt/rm/
509 command). And to add records you create new files (or directories with
510 files). For your changes to take effect in the register you must run
511 <tt>zebraidx update</tt> with the same directory root again. This mode
512 of operation requires more disk space than simpler indexing methods,
513 but it makes it easier for you to keep the index in sync with a
514 frequently changing set of data. If you combine this system with the
515 <it/safe update/ facility (see below), you never have to take your
516 server offline for maintenance or register updating purposes.
517
518 To enable indexing with pathname IDs, you must specify <tt>file</tt> as
519 the value of <tt>recordId</tt> in the configuration file. In addition,
520 you should set <tt>storeKeys</tt> to <tt>1</tt>, since the Zebra
521 indexer must save additional information about the contents of each record
522 in order to modify the indices correctly at a later time.
523
524 For example, to update records of group <tt>esdd</tt> located below
525 <tt>/data1/records/</tt> you should type:
526 <tscreen><verb>
527 $ zebraidx -g esdd update /data1/records
528 </verb></tscreen>
529
530 The corresponding configuration file includes:
531 <tscreen><verb>
532 esdd.recordId: file
533 esdd.recordType: grs
534 esdd.storeKeys: 1
535 </verb></tscreen>
536
537 <em>Important note: You cannot start out with a group of records with simple
538 indexing (no record IDs as in the previous section) and then later
539 enable file record Ids. Zebra must know from the first time that you
540 index the group that
541 the files should be indexed with file record IDs.
542 </em>
543
544 You cannot explicitly delete records when using this method (using the
545 <bf/delete/ command to <tt/zebraidx/. Instead
546 you have to delete the files from the file system (or move them to a
547 different location)
548 and then run <tt>zebraidx</tt> with the <bf/update/ command.
549
550 <sect1>Indexing with General Record IDs
551 <p>
552 When using this method you construct an (almost) arbritrary, internal
553 record key based on the contents of the record itself and other system
554 information. If you have a group of records that explicitly associates
555 an ID with each record, this method is convenient. For example, the
556 record format may contain a title or a ID-number - unique within the group.
557 In either case you specify the Z39.50 attribute set and use-attribute
558 location in which this information is stored, and the system looks at
559 that field to determine the identity of the record.
560
561 As before, the record ID is defined by the <tt>recordId</tt> setting
562 in the configuration file. The value of the record ID specification
563 consists of one or more tokens separated by whitespace. The resulting
564 ID is
565 represented in the index by concatenating the tokens and separating them by
566 ASCII value (1).
567
568 There are three kinds of tokens:
569 <descrip>
570 <tag>Internal record info</tag> The token refers to a key that is
571 extracted from the record. The syntax of this token is
572  <tt/(/ <em/set/ <tt/,/ <em/use/ <tt/)/, where <em/set/ is the
573 attribute set ordinal number and <em/use/ is the use value of the attribute.
574 <tag>System variable</tag> The system variables are preceded by
575 <verb>$</verb> and immediately followed by the system variable name, which
576 may one of
577  <descrip>
578  <tag>group</tag> Group name.
579  <tag>database</tag> Current database specified.
580  <tag>type</tag> Record type.
581  </descrip>
582 <tag>Constant string</tag> A string used as part of the ID &mdash; surrounded
583  by single- or double quotes.
584 </descrip>
585
586 For instance, the sample GILS records that come with the Zebra
587 distribution contain a
588 unique ID
589 in the Control-Identifier field. This field is mapped to the Bib-1
590 use attribute 1007. To use this field as a record id, specify
591 <tt>(1,1007)</tt> as the value of the <tt>recordId</tt> in the
592 configuration file. If you have other record types that uses
593 the same field for a different purpose, you might add the record type (or group or database name)
594 to the record id of the gils records as well, to prevent matches
595 with other types of records. In this case the recordId might be
596 set like this:
597 <tscreen><verb>
598 gils.recordId: $type (1,1007)
599 </verb></tscreen>
600
601 (see section <ref id="data-model" name="Configuring Your Data Model">
602 for details of how the mapping between elements of your records and
603 searchable attributes is established).
604
605 As for the file record ID case described in the previous section,
606 updating your system is simply a matter of running <tt>zebraidx</tt>
607 with the <tt>update</tt> command. However, the update with general
608 keys is considerably slower than with file record IDs, since all files
609 visited must be (re)read to discover their IDs. 
610
611 As you might expect, when using the general record IDs
612 method, you can only add or modify existing records with the <tt>update</tt>
613 command. If you wish to delete records, you must use the,
614 <tt>delete</tt> command, with a directory as a parameter.
615 This will remove all records that match the files below that root
616 directory.
617
618 <sect1>Register Location<label id="register-location">
619
620 <p>
621 Normally, the index files that form dictionaries, inverted
622 files, record info, etc., are stored in the directory where you run
623 <tt>zebraidx</tt>. If you wish to store these, possibly large, files
624 somewhere else, you must add the <tt>register</tt> entry to the
625 <tt/zebra.cfg/ file. Furthermore, the Zebra system allows its file
626 structures to
627 span multiple file systems, which is useful for managing very large
628 databases. 
629
630 The value of the <tt>register</tt> setting is a sequence of tokens.
631 Each token takes the form:
632 <tscreen>
633 <em>dir</em><tt>:</tt><em>size</em>. 
634 </tscreen>
635 The <em>dir</em> specifies a directory in which index files will be
636 stored and the <em>size</em> specifies the maximum size of all
637 files in that directory. The Zebra indexer system fills each directory
638 in the order specified and use the next specified directories as needed.
639 The <em>size</em> is an integer followed by a qualifier
640 code, <tt>M</tt> for megabytes, <tt>k</tt> for kilobytes.
641
642 For instance, if you have allocated two disks for your register, and
643 the first disk is mounted
644 on <tt>/d1</tt> and has 200 Mb of free space and the
645 second, mounted on <tt>/d2</tt> has 300 Mb, you could
646 put this entry in your configuration file:
647 <tscreen><verb>
648 register: /d1:200M /d2:300M
649 </verb></tscreen>
650
651 Note that Zebra does not verify that the amount of space specified is
652 actually available on the directory (file system) specified - it is
653 your responsibility to ensure that enough space is available, and that
654 other applications do not attempt to use the free space. In a large production system,
655 it is recommended that you allocate one or more filesystem exclusively
656 to the Zebra register files.
657
658 <sect1>Safe Updating - Using Shadow Registers<label id="shadow-registers">
659
660 <sect2>Description
661
662 <p>
663 The Zebra server supports <it/updating/ of the index structures. That is,
664 you can add, modify, or remove records from databases managed by Zebra
665 without rebuilding the entire index. Since this process involves
666 modifying structured files with various references between blocks of
667 data in the files, the update process is inherently sensitive to
668 system crashes, or to process interruptions: Anything but a
669 successfully completed update process will leave the register files in
670 an unknown state, and you will essentially have no recourse but to
671 re-index everything, or to restore the register files from a backup
672 medium. Further, while the update process is active, users cannot be
673 allowed to access the system, as the contents of the register files
674 may change unpredictably.
675
676 You can solve these problems by enabling the shadow register system in
677 Zebra. During the updating procedure, <tt/zebraidx/ will temporarily
678 write changes to the involved files in a set of &dquot;shadow
679 files&dquot;, without modifying the files that are accessed by the
680 active server processes. If the update procedure is interrupted by a
681 system crash or a signal, you simply repeat the procedure - the
682 register files have not been changed or damaged, and the partially
683 written shadow files are automatically deleted before the new updating
684 procedure commences.
685
686 At the end of the updating procedure (or in a separate operation, if
687 you so desire), the system enters a &dquot;commit mode&dquot;. First,
688 any active server processes are forced to access those blocks that
689 have been changed from the shadow files rather than from the main
690 register files; the unmodified blocks are still accessed at their
691 normal location (the shadow files are not a complete copy of the
692 register files - they only contain those parts that have actually been
693 modified). If the commit process is interrupted at any point during the
694 commit process, the server processes will continue to access the
695 shadow files until you can repeat the commit procedure and complete
696 the writing of data to the main register files. You can perform
697 multiple update operations to the registers before you commit the
698 changes to the system files, or you can execute the commit operation
699 at the end of each update operation. When the commit phase has
700 completed successfully, any running server processes are instructed to
701 switch their operations to the new, operational register, and the
702 temporary shadow files are deleted.
703
704 <sect2>How to Use Shadow Register Files
705
706 <p>
707 The first step is to allocate space on your system for the shadow
708 files. You do this by adding a <tt/shadow/ entry to the <tt/zebra.cfg/
709 file. The syntax of the <tt/shadow/ entry is exactly the same as for
710 the <tt/register/ entry (see section <ref name="Register Location"
711 id="register-location">). The location of the shadow area should be
712 <it/different/ from the location of the main register area (if you
713 have specified one - remember that if you provide no <tt/register/
714 setting, the default register area is the
715 working directory of the server and indexing processes).
716
717 The following excerpt from a <tt/zebra.cfg/ file shows one example of
718 a setup that configures both the main register location and the shadow
719 file area. Note that two directories or partitions have been set aside
720 for the shadow file area. You can specify any number of directories
721 for each of the file areas, but remember that there should be no
722 overlaps between the directories used for the main registers and the
723 shadow files, respectively.
724
725 <tscreen><verb>
726 register: /d1:500M
727
728 shadow: /scratch1:100M /scratch2:200M
729 </verb></tscreen>
730
731 When shadow files are enabled, an extra command is available at the
732 <tt/zebraidx/ command line. In order to make changes to the system
733 take effect for the users, you'll have to submit a
734 &dquot;commit&dquot; command after a (sequence of) update
735 operation(s). You can ask the indexer to commit the changes
736 immediately after the update operation:
737
738 <tscreen><verb>
739 $ zebraidx update /d1/records update /d2/more-records commit
740 </verb></tscreen>
741
742 Or you can execute multiple updates before committing the changes:
743
744 <tscreen><verb>
745 $ zebraidx -g books update /d1/records update /d2/more-records
746 $ zebraidx -g fun update /d3/fun-records
747 $ zebraidx commit
748 </verb></tscreen>
749
750 If one of the update operations above had been interrupted, the commit
751 operation on the last line would fail: <tt/zebraidx/ will not let you
752 commit changes that would destroy the running register. You'll have to
753 rerun all of the update operations since your last commit operation,
754 before you can commit the new changes.
755
756 Similarly, if the commit operation fails, <tt/zebraidx/ will not let
757 you start a new update operation before you have successfully repeated
758 the commit operation. The server processes will keep accessing the
759 shadow files rather than the (possibly damaged) blocks of the main
760 register files until the commit operation has successfully completed.
761
762 You should be aware that update operations may take slightly longer
763 when the shadow register system is enabled, since more file access
764 operations are involved. Further, while the disk space required for
765 the shadow register data is modest for a small update operation, you
766 may prefer to disable the system if you are adding a very large number
767 of records to an already very large database (we use the terms
768 <it/large/ and <it/modest/ very loosely here, since every
769 application will have a different perception of size). To update the system
770 without the use of the the shadow files, simply run <tt/zebraidx/ with
771 the <tt/-n/ option (note that you do not have to execute the
772 <bf/commit/ command of <tt/zebraidx/ when you temporarily disable the
773 use of the shadow registers in this fashion. Note also that, just as
774 when the shadow registers are not enabled, server processes will be
775 barred from accessing the main register while the update procedure
776 takes place.
777
778 <sect>Running the Maintenance Interface (zebraidx)
779
780 <p>
781 The following is a complete reference to the command line interface to
782 the <tt/zebraidx/ application.
783
784 <bf/Syntax/
785 <tscreen><verb>
786 $ zebraidx &lsqb;options&rsqb; command &lsqb;directory&rsqb; ...
787 </verb></tscreen>
788 <bf/Options/
789 <descrip>
790 <tag>-t <it/type/</tag>Update all files as <it/type/. Currently, the
791 types supported are <tt/text/ and <tt/grs/<it/.filter/. If no
792 <it/filter/ is provided for the GRS (General Record Structure) type,
793 the canonical input format is assumed (see section <ref
794 id="local-representation" name="Local Representation">). Generally, it
795 is probably advisable to specify the record types in the
796 <tt/zebra.cfg/ file (see section <ref id="record-types" name="Record Types">).
797
798 <tag>-c <it/config-file/</tag>Read the configuration file
799 <it/config-file/ instead of <tt/zebra.cfg/.
800
801 <tag>-g <it/group/</tag>Update the files according to the group
802 settings for <it/group/ (see section <ref id="configuration-file"
803 name="The Zebra Configuration File">).
804
805 <tag>-d <it/database/</tag>The records located should be associated
806 with the database name <it/database/ for access through the Z39.50
807 server.
808
809 <tag>-d <it/mbytes/</tag>Use <it/mbytes/ of megabytes before flushing
810 keys to background storage. This setting affects performance when
811 updating large databases.
812
813 <tag>-n</tag>Disable the use of shadow registers for this operation
814 (see section <ref id="shadow-registers" name="Robust Updating - Using
815 Shadow Registers">).
816
817 <tag>-v <it/level/</tag>Set the log level to <it/level/. <it/level/
818 should be one of <tt/none/, <tt/debug/, and <tt/all/.
819
820 </descrip>
821
822 <bf/Commands/
823 <descrip>
824 <tag>Update <it/directory/</tag>Update the register with the files
825 contained in <it/directory/. If no directory is provided, a list of
826 files is read from <tt/stdin/. See section <ref
827 id="administrating" name="Administrating Zebra">.
828
829 <tag>Delete <it/directory/</tag>Remove the records corresponding to
830 the files found under <it/directory/ from the register.
831
832 <tag/Commit/Write the changes resulting from the last <bf/update/
833 commands to the register. This command is only available if the use of
834 shadow register files is enabled (see section <ref
835 id="shadow-registers" name="Robust Updating - Using Shadow
836 Registers">).
837
838 </descrip>
839
840 <sect>The Z39.50 Server
841
842 <sect1>Running the Z39.50 Server (zebrasrv)
843
844 <p>
845 <bf/Syntax/
846 <tscreen><verb>
847 zebrasrv &lsqb;options&rsqb; &lsqb;listener-address ...&rsqb;
848 </verb></tscreen>
849
850 <bf/Options/
851 <descrip>
852 <tag>-a <it/APDU file/</tag> Specify a file for dumping PDUs (for diagnostic purposes).
853 The special name &dquot;-&dquot; sends output to <tt/stderr/.
854
855 <tag>-c <it/config-file/</tag> Read configuration information from <it/config-file/. The default configuration is <tt>./zebra.cfg</tt>.
856
857 <tag/-S/Don't fork on connection requests. This can be useful for
858 symbolic-level debugging. The server can only accept a single
859 connection in this mode.
860
861 <tag/-s/Use the SR protocol.
862
863 <tag/-z/Use the Z39.50 protocol (default). These two options complement
864 eachother. You can use both multiple times on the same command
865 line, between listener-specifications (see below). This way, you
866 can set up the server to listen for connections in both protocols
867 concurrently, on different local ports.
868
869 <tag>-l <it/logfile/</tag>Specify an output file for the diagnostic
870 messages. The default is to write this information to <tt/stderr/.
871
872 <tag>-v <it/log-level/</tag>The log level. Use a comma-separated list of members of the set
873 {fatal,debug,warn,log,all,none}.
874
875 <tag>-u <it/username/</tag>Set user ID. Sets the real UID of the server process to that of the
876 given <it/username/. It's useful if you aren't comfortable with having the
877 server run as root, but you need to start it as such to bind a
878 privileged port.
879
880 <tag>-w <it/working-directory/</tag>Change working directory.
881
882 <tag>-i <it/minutes/</tag>Run under the Internet superserver, <tt/inetd/.
883
884 <tag>-t <it/timeout/</tag>Set the idle session timeout (default 60 minutes).
885
886 <tag>-k <it/kilobytes/</tag>Set the (approximate) maximum size of
887 present response messages. Default is 1024 Kb (1 Mb).
888 </descrip>
889
890 A <it/listener-address/ consists of a transport mode followed by a
891 colon (:) followed by a listener address. The transport mode is
892 either <tt/osi/ or <tt/tcp/.
893
894 For TCP, an address has the form
895
896 <tscreen><verb>
897 hostname | IP-number &lsqb;: portnumber&rsqb;
898 </verb></tscreen>
899
900 The port number defaults to 210 (standard Z39.50 port).
901
902 For OSI (only available if the server is compiled with XTI/mOSI
903 support enabled), the address form is
904
905 <tscreen><verb>
906 &lsqb;t-selector /&rsqb; hostname | IP-number &lsqb;: portnumber&rsqb;
907 </verb></tscreen>
908
909 The transport selector is given as a string of hex digits (with an even
910 number of digits). The default port number is 102 (RFC1006 port).
911
912 Examples
913
914 <tscreen>
915 <verb>
916 tcp:dranet.dra.com
917
918 osi:0402/dbserver.osiworld.com:3000
919 </verb>
920 </tscreen>
921
922 In both cases, the special hostname &dquot;@&dquot; is mapped to
923 the address INADDR_ANY, which causes the server to listen on any local
924 interface. To start the server listening on the registered ports for
925 Z39.50 and SR over OSI/RFC1006, and to drop root privileges once the
926 ports are bound, execute the server like this (from a root shell):
927
928 <tscreen><verb>
929 zebrasrv -u daemon tcp:@ -s osi:@
930 </verb></tscreen>
931
932 You can replace <tt/daemon/ with another user, eg. your own account, or
933 a dedicated IR server account.
934
935 The default behavior for <tt/zebrasrv/ is to establish a single TCP/IP
936 listener, for the Z39.50 protocol, on port 9999.
937
938 <sect1>Z39.50 Protocol Support and Behavior
939
940 <sect2>Initialization
941
942 <p>
943 During initialization, the server will negotiate to version 3 of the
944 Z39.50 protocol, and the option bits for Search, Present, Scan,
945 NamedResultSets, and concurrentOperations will be set, if requested by
946 the client. The maximum PDU size is negotiated down to a maximum of
947 1Mb by default.
948
949 <sect2>Search
950
951 <p>
952 The supported query type are 1 and 101 All operators except PROXIMITY
953 are currently supported. Queries can be arbitrarily complex. Named
954 result sets are supported, and result sets can be used as operands
955 with no limitations. Searches may span multiple databases.
956
957 The server has full support for piggy-backed present requests (see
958 also the following section).
959
960 <bf/Use/ attributes are interpreted according to the attribute sets which
961 have been loaded in the <tt/zebra.cfg/ file, and are matched against
962 specific fields as specified in the <tt/.abs/ file which describes the
963 profile of the records which have been loaded. If no <bf/Use/
964 attribute is provided, a default of <bf/Any/ is assumed.
965
966 If a <bf/Structure/ attribute of <bf/Phrase/ is used in conjunction with a
967 <bf/Completeness/ attribute of <bf/Complete (Sub)field/, the term is
968 matched against the contents of a phrase (long word) register, if one
969 exists for the given <bf/Use/ attribute. If <bf/Structure/=<bf/Phrase/
970 is used in conjunction with <bf/Incomplete Field/ - the default value
971 for <bf/Completeness/, the search is directed against the normal word
972 registers, but if the term contains multiple words, the term will only
973 match if all of the words are found immediately adjacent, and in the
974 given order. If the <bf/Structure/ attribute is <bf/Word List/,
975 <bf/Free-form Text/, or <bf/Document Text/, the term is treated as a
976 natural-language, relevance-ranked query.
977
978 If the <bf/Relation/ attribute is <bf/Equals/ (default), the term is
979 matched in a normal fashion (modulo truncation and processing of
980 individual words, if required). If <bf/Relation/ is <bf/Less Than/,
981 <bf/Less Than or Equal/, <bf/Greater than/, or <bf/Greater than or
982 Equal/, the term is assumed to be numerical, and a standard regular
983 expression is constructed to match the given expression. If
984 <bf/Relation/ is <bf/Relevance/, the standard natural-language query
985 processor is invoked.
986
987 For the <bf/Truncation/ attribute, <bf/No Truncation/ is the default.
988 <bf/Left Truncation/ is not supported. <bf/Process &num;/ is supported, as
989 is <bf/Regxp-1/. <bf/Regxp-2/ enables the fault-tolerant (fuzzy)
990 search. As a default, a single error (deletion, insertion,
991 replacement) is accepted when terms are matched against the register
992 contents. The <bf/Regxp-1/ and <bf/Regxp-2/ both follow the same syntax
993 with the operands:
994 <descrip>
995 <tag/x/ Matches the character <it/x/.
996 <tag/./ Matches any character.
997 <tag><tt/[/..<tt/]/</tag> Matches the set of characters specified;
998  such as <tt/[abc]/ or <tt/[a-c]/.
999 </descrip>
1000 and the operators:
1001 <descrip>
1002 <tag/x*/ Matches <it/x/ zero or more times. Priority: high.
1003 <tag/x+/ Matches <it/x/ one or more times. Priority: high.
1004 <tag/x?/ Matches <it/x/ once or twice. Priority: high.
1005 <tag/xy/ Matches <it/x/, then <it/y/. Priority: medium.
1006 <tag/x|y/ Matches either <it/x/ or <it/y/. Priority: low.
1007 </descrip>
1008 The order of evaluation may be changed by using parentheses.
1009
1010 If the <bf/Regxp-2/ query begins with a plus sign (<tt/+/) it marks the
1011 beginning of a section with non-standard specifiers. The next minus sign
1012 marks the end of the section. Currently Zebra only supports one
1013 specifier, the error tolerance, which consists one digit. 
1014
1015 Since the plus operator is normally a suffix operator the addition to
1016 the query syntax doesn't violate the syntax for standard regular
1017 expressions.
1018
1019 <sect2>Present
1020
1021 <p>
1022 The present facility is supported in a standard fashion. The requested
1023 record syntax is matched against the ones supported by the profile of
1024 each record retrieved. If no record syntax is given, SUTRS is the
1025 default. The requested element set name, again, is matched against any
1026 provided by the relevant record profiles.
1027
1028 <sect2>Scan
1029
1030 <p>
1031 The attribute combinations provided with the TermListAndStartPoint are
1032 processed in the same way as operands in a query (see above).
1033 Currently, only the term and the globalOccurrences are returned with
1034 the TermInfo structure.
1035
1036 <sect2>Close
1037
1038 <p>
1039 If a Close PDU is received, the server will respond with a Close PDU
1040 with reason=FINISHED, no matter which protocol version was negotiated
1041 during initialization. If the protocol version is 3 or more, the
1042 server will generate a Close PDU under certain circumstances,
1043 including a session timeout (60 minutes by default), and certain kinds of
1044 protocol errors. Once a Close PDU has been sent, the protocol
1045 association is considered broken, and the transport connection will be
1046 closed immediately upon receipt of further data, or following a short
1047 timeout.
1048
1049 <sect>The Record Model
1050
1051 <p>
1052 The Zebra system is designed to support a wide range of data management
1053 applications. The system can be configured to handle virtually any
1054 kind of structured data. Each record in the system is associated with
1055 a <it/record schema/ which lends context to the data elements of the
1056 record. Any number of record schema can coexist in the system.
1057 Although it may be wise to use only a single schema within
1058 one database, the system poses no such restrictions.
1059
1060 The record model described in this chapter applies to the fundamental
1061 record type <tt>grs</tt> as introduced in
1062 section <ref id="record-types" name="Record Types">.
1063
1064 Records pass through three different states during processing in the
1065 system.
1066
1067 <itemize>
1068 <item>When records are accessed by the system, they are represented
1069 in their local, or native format. This might be SGML or HTML files,
1070 News or Mail archives, MARC records. If the system doesn't already
1071 know how to read the type of data you need to store, you can set up an
1072 input filter by preparing conversion rules based on regular
1073 expressions and a flexible scripting language (Tcl). The input filter
1074 produces as output an internal representation:
1075
1076 <item>When records are processed by the system, they are represented
1077 in a tree-structure, constructed by tagged data elements hanging off a
1078 root node. The tagged elements may contain data or yet more tagged
1079 elements in a recursive structure. The system performs various
1080 actions on this tree structure (indexing, element selection, schema
1081 mapping, etc.),
1082
1083 <item>Before transmitting records to the client, they are first
1084 converted from the internal structure to a form suitable for exchange
1085 over the network - according to the Z39.50 standard.
1086 </itemize>
1087
1088 <sect1>Local Representation<label id="local-representation">
1089
1090 <p>
1091 As mentioned earlier, Zebra places few restrictions on the type of
1092 data that you can index and manage. Generally, whatever the form of
1093 the data, it is parsed by an input filter specific to that format, and
1094 turned into an internal structure that Zebra knows how to handle. This
1095 process takes place whenever the record is accessed - for indexing and
1096 retrieval.
1097
1098 <sect2>Canonical Input Format
1099
1100 <p>
1101 Although input data can take any form, it is sometimes useful to
1102 describe the record processing capabilities of the system in terms of
1103 a single, canonical input format that gives access to the full
1104 spectrum of structure and flexibility in the system. In Zebra, this
1105 canonical format is an &dquot;SGML-like&dquot; syntax.
1106
1107 To use the canonical format specify <tt>grs.sgml</tt> as the record
1108 type,
1109
1110 Consider a record describing an information resource (such a record is
1111 sometimes known as a <it/locator record/). It might contain a field
1112 describing the distributor of the information resource, which might in
1113 turn be partitioned into various fields providing details about the
1114 distributor, like this:
1115
1116 <tscreen><verb>
1117 <Distributor>
1118     <Name> USGS/WRD &etago;Name>
1119     <Organization> USGS/WRD &etago;Organization>
1120     <Street-Address>
1121         U.S. GEOLOGICAL SURVEY, 505 MARQUETTE, NW
1122     &etago;Street-Address>
1123     <City> ALBUQUERQUE &etago;City>
1124     <State> NM &etago;State>
1125     <Zip-Code> 87102 &etago;Zip-Code>
1126     <Country> USA &etago;Country>
1127     <Telephone> (505) 766-5560 &etago;Telephone>
1128 &etago;Distributor>
1129 </verb></tscreen>
1130
1131 <it>NOTE: The indentation used above is used to illustrate how Zebra
1132 interprets the markup. The indentation, in itself, has no
1133 significance to the parser for the canonical input format, which
1134 discards superfluous whitespace.</it>
1135
1136 The keywords surrounded by &lt;...&gt; are <it/tags/, while the
1137 sections of text in between are the <it/data elements/. A data element
1138 is characterized by its location in the tree that is made up by the
1139 nested elements. Each element is terminated by a closing tag -
1140 beginning with &etago;, and containing the same symbolic tag-name as
1141 the corresponding opening tag. The general closing tag - &etago;&gt; -
1142 terminates the element started by the last opening tag. The
1143 structuring of elements is significant. The element <bf/Telephone/,
1144 for instance, may be indexed and presented to the client differently,
1145 depending on whether it appears inside the <bf/Distributor/ element,
1146 or some other, structured data element such a <bf/Supplier/ element.
1147
1148 <sect3>Record Root
1149
1150 <p>
1151 The first tag in a record describes the root node of the tree that
1152 makes up the total record. In the canonical input format, the root tag
1153 should contain the name of the schema that lends context to the
1154 elements of the record (see section <ref id="internal-representation"
1155 name="Internal Representation">). The following is a GILS record that
1156 contains only a single element (strictly speaking, that makes it an
1157 illegal GILS record, since the GILS profile includes several mandatory
1158 elements - Zebra does not validate the contents of a record against
1159 the Z39.50 profile, however - it merely attempts to match up elements
1160 of a local representation with the given schema):
1161
1162 <tscreen><verb>
1163 <gils>
1164     <title>Zen and the Art of Motorcycle Maintenance&etago;title>
1165 &etago;gils>
1166 </verb></tscreen>
1167
1168 <sect3>Variants
1169
1170 <p>
1171 Zebra allows you to provide individual data elements in a number of
1172 <it/variant forms/. Examples of variant forms are textual data
1173 elements which might appear in different languages, and images which
1174 may appear in different formats or layouts. The variant system in
1175 Zebra is
1176 essentially a representation of the variant mechanism of
1177 Z39.50-1995.
1178
1179 The following is an example of a title element which occurs in two
1180 different languages.
1181
1182 <tscreen><verb>
1183 <title>
1184   <var lang lang "eng">
1185     Zen and the Art of Motorcycle Maintenance&etago;>
1186   <var lang lang "dan">
1187     Zen og Kunsten at Vedligeholde en Motorcykel&etago;>
1188 &etago;title>
1189 </verb></tscreen>
1190
1191 The syntax of the <it/variant element/ is <tt>&lt;<bf/var/ <it/class
1192 type value/&gt;</tt>. The available values for the <it/class/ and
1193 <it/type/ fields are given by the variant set that is associated with the
1194 current schema (see section <ref id="variant-set" name="Variant Set
1195 File">).
1196
1197 Variant elements are terminated by the general end-tag &etago;>, by
1198 the variant end-tag &etago;var>, by the appearance of another variant
1199 tag with the same <it/class/ and <it/value/ settings, or by the
1200 appearance of another, normal tag. In other words, the end-tags for
1201 the variants used in the example above could have been saved.
1202
1203 Variant elements can be nested. The element
1204
1205 <tscreen><verb>
1206 <title>
1207   <var lang lang "eng"><var body iana "text/plain">
1208     Zen and the Art of Motorcycle Maintenance
1209 &etago;title>
1210 </verb></tscreen>
1211
1212 Associates two variant components to the variant list for the title
1213 element.
1214
1215 Given the nesting rules described above, we could write
1216
1217 <tscreen><verb>
1218 <title>
1219   <var body iana "text/plain>
1220     <var lang lang "eng">
1221       Zen and the Art of Motorcycle Maintenance
1222     <var lang lang "dan">
1223       Zen og Kunsten at Vedligeholde en Motorcykel
1224 &etago;title>
1225 </verb></tscreen>
1226
1227 The title element above comes in two variants. Both have the IANA body
1228 type &dquot;text/plain&dquot;, but one is in English, and the other in
1229 Danish. The client, using the element selection mechanism of Z39.50,
1230 can retrieve information about the available variant forms of data
1231 elements, or it can select specific variants based on the requirements
1232 of the end-user.
1233
1234 <sect2>Input Filters
1235
1236 <p>
1237 In order to handle general input formats, Zebra allows the
1238 operator to define filters which read individual records in their native format
1239 and produce an internal representation that the system can
1240 work with.
1241
1242 Input filters are ASCII files, generally with the suffix <tt/.flt/.
1243 The system looks for the files in the directories given in the
1244 <bf/profilePath/ setting in the <tt/zebra.cfg/ files. The record type
1245 for the filter is <tt>grs.regx.</tt><it>filter-filename</it>
1246 (fundamental type <tt>grs</tt>, file read type <tt>regx</tt>, argument
1247 <it>filter-filename</it>).
1248
1249 Generally, an input filter consists of a sequence of rules, where each
1250 rule consists of a sequence of expressions, followed by an action. The
1251 expressions are evaluated against the contents of the input record,
1252 and the actions normally contribute to the generation of an internal
1253 representation of the record.
1254
1255 An expression can be either of the following:
1256
1257 <descrip>
1258 <tag/INIT/The action associated with this expression is evaluated
1259 exactly once in the lifetime of the application, before any records
1260 are read. It can be used in conjunction with an action that
1261 initializes tables or other resources that are used in the processing
1262 of input records.
1263
1264 <tag/BEGIN/Matches the beginning of the record. It can be used to
1265 initialize variables, etc. Typically, the <bf/BEGIN/ rule is also used
1266 to establish the root node of the record.
1267
1268 <tag/END/Matches the end of the record - when all of the contents
1269 of the record has been processed.
1270
1271 <tag>/pattern/</tag>Matches a string of characters from the input
1272 record.
1273
1274 <tag/BODY/This keyword may only be used between two patterns. It
1275 matches everything between (not including) those patterns.
1276
1277 <tag/FINISH/THe expression asssociated with this pattern is evaluated
1278 once, before the application terminates. It can be used to release
1279 system resources - typically ones allocated in the <bf/INIT/ step.
1280
1281 </descrip>
1282
1283 An action is surrounded by curly braces ({...}), and consists of a
1284 sequence of statements. Statements may be separated by newlines or
1285 semicolons (;). Within actions, the strings that matched the
1286 expressions immediately preceding the action can be referred to as
1287 &dollar;0, &dollar;1, &dollar;2, etc.
1288
1289 The available statements are:
1290
1291 <descrip>
1292
1293 <tag>begin <it/type &lsqb;parameter ... &rsqb;/</tag>Begin a new
1294 data element. The type is one of the following:
1295 <descrip>
1296 <tag/record/Begin a new record. The followingparameter should be the
1297 name of the schema that describes the structure of the record, eg.
1298 <tt/gils/ or <tt/wais/ (see below). The <tt/begin record/ call should
1299 precede
1300 any other use of the <bf/begin/ statement.
1301
1302 <tag/element/Begin a new tagged element. The parameter is the
1303 name of the tag. If the tag is not matched anywhere in the tagsets
1304 referenced by the current schema, it is treated as a local string
1305 tag.
1306
1307 <tag/variant/Begin a new node in a variant tree. The parameters are
1308 <it/class type value/.
1309
1310 </descrip>
1311
1312 <tag/data/Create a data element. The concatenated arguments make
1313 up the value of the data element. The option <tt/-text/ signals that
1314 the layout (whitespace) of the data should be retained for
1315 transmission. The option <tt/-element/ <it/tag/ wraps the data up in
1316 the <it/tag/. The use of the <tt/-element/ option is equivalent to
1317 preceding the command with a <bf/begin element/ command, and following
1318 it with the <bf/end/ command.
1319
1320 <tag>end <it/&lsqb;type&rsqb;/</tag>Close a tagged element. If no parameter is given,
1321 the last element on the stack is terminated. The first parameter, if
1322 any, is a type name, similar to the <bf/begin/ statement. For the
1323 <bf/element/ type, a tag name can be provided to terminate a specific tag.
1324
1325 </descrip>
1326
1327 The following input filter reads a Usenet news file, producing a
1328 record in the WAIS schema. Note that the body of a news posting is
1329 separated from the list of headers by a blank line (or rather a
1330 sequence of two newline characters.
1331
1332 <tscreen><verb>
1333 BEGIN                { begin record wais }
1334
1335 /^From:/ BODY /$/    { data -element name $1 }
1336 /^Subject:/ BODY /$/ { data -element title $1 }
1337 /^Date:/ BODY /$/    { data -element lastModified $1 }
1338 /\n\n/ BODY END      {
1339                         begin element bodyOfDisplay
1340                         begin variant body iana "text/plain"
1341                         data -text $1
1342                         end record
1343                      }
1344 </verb></tscreen>
1345
1346 If Zebra is compiled with support for Tcl (Tool Command Language)
1347 enabled, the statements described above are supplemented with a complete
1348 scripting environment, including control structures (conditional
1349 expressions and loop constructs), and powerful string manipulation
1350 mechanisms for modifying the elements of a record. Tcl is a popular
1351 scripting environment, with several tutorials available both online
1352 and in hardcopy.
1353
1354 <it>NOTE: Tcl support is not currently available, but will be
1355 included with one of the next alpha or beta releases.</it>
1356
1357 <it>NOTE: Variant support is not currently available in the input
1358 filter, but will be included with one of the next alpha or beta
1359 releases.</it>
1360
1361 <sect1>Internal Representation<label id="internal-representation">
1362
1363 <p>
1364 When records are manipulated by the system, they're represented in a
1365 tree-structure, with data elements at the leaf nodes, and tags or
1366 variant components at the non-leaf nodes. The root-node identifies the
1367 schema that lends context to the tagging and structuring of the
1368 record. Imagine a simple record, consisting of a 'title' element and
1369 an 'author' element:
1370
1371 <tscreen><verb>
1372         TITLE     "Zen and the Art of Motorcycle Maintenance"
1373 ROOT 
1374         AUTHOR    "Robert Pirsig"
1375 </verb></tscreen>
1376
1377 A slightly more complex record would have the author element consist
1378 of two elements, a surname and a first name:
1379
1380 <tscreen><verb>
1381         TITLE     "Zen and the Art of Motorcycle Maintenance"
1382 ROOT  
1383                   FIRST-NAME "Robert"
1384         AUTHOR
1385                   SURNAME    "Pirsig"
1386 </verb></tscreen>
1387
1388 The root of the record will refer to the record schema that describes
1389 the structuring of this particular record. The schema defines the
1390 element tags (TITLE, FIRST-NAME, etc.) that may occur in the record, as
1391 well as the structuring (SURNAME should appear below AUTHOR, etc.). In
1392 addition, the schema establishes element set names that are used by
1393 the client to request a subset of the elements of a given record. The
1394 schema may also establish rules for converting the record to a
1395 different schema, by stating, for each element, a mapping to a
1396 different tag path.
1397
1398 <sect2>Tagged Elements
1399
1400 <p>
1401 A data element is characterized by its tag, and its position in the
1402 structure of the record. For instance, while the tag &dquot;telephone
1403 number&dquot; may be used different places in a record, we may need to
1404 distinguish between these occurrences, both for searching and
1405 presentation purposes. For instance, while the phone numbers for the
1406 &dquot;customer&dquot; and the &dquot;service provider&dquot; are both
1407 representatives for the same type of resource (a telephone number), it
1408 is essential that they be kept separate. The record schema provides
1409 the structure of the record, and names each data element (defined by
1410 the sequence of tags - the tag path - by which the element can be
1411 reached from the root of the record).
1412
1413 <sect2>Variants
1414
1415 <p>
1416 The children of a tag node may be either more tag nodes, a data node
1417 (possibly accompanied by tag nodes),
1418 or a tree of variant nodes. The children of  variant nodes are either
1419 more variant nodes or a data node (possibly accompanied by more
1420 variant nodes). Each leaf node, which is normally a
1421 data node, corresponds to a <it/variant form/ of the tagged element
1422 identified by the tag which parents the variant tree. The following
1423 title element occurs in two different languages:
1424
1425 <tscreen><verb>
1426       VARIANT LANG=ENG  "War and Peace"
1427 TITLE
1428       VARIANT LANG=DAN  "Krig og Fred"
1429 </verb></tscreen>
1430
1431 Which of the two elements are transmitted to the client by the server
1432 depends on the specifications provided by the client, if any.
1433
1434 In practice, each variant node is associated with a triple of class,
1435 type, value, corresponding to the variant mechanism of Z39.50.
1436
1437 <sect2>Data Elements
1438
1439 <p>
1440 Data nodes have no children (they are always leaf nodes in the record
1441 tree).
1442
1443 <it>NOTE: Documentation needs extension here about types of nodes - numerical,
1444 textual, etc., plus the various types of inclusion notes.</it>
1445
1446 <sect1>Configuring Your Data Model<label id="data-model">
1447
1448 <p>
1449 The following sections describe the configuration files that govern
1450 the internal management of data records. The system searches for the files
1451 in the directories specified by the <bf/profilePath/ setting in the
1452 <tt/zebra.cfg/ file.
1453
1454 <sect2>The Abstract Syntax
1455
1456 <p>
1457 The abstract syntax definition (also known as an Abstract Record
1458 Structure, or ARS) is the focal point of the
1459 record schema description. For a given schema, the ABS file may state any
1460 or all of the following:
1461
1462 <itemize>
1463 <item>The object identifier of the Z39.50 schema associated
1464 with the ARS, so that it can be referred to by the client.
1465
1466 <item>The attribute set (which can possibly be a compound of multiple
1467 sets) which applies in the profile. This is used when indexing and
1468 searching the records belonging to the given profile.
1469
1470 <item>The Tag set (again, this can consist of several different sets).
1471 This is used when reading the records from a file, to recognize the
1472 different tags, and when transmitting the record to the client -
1473 mapping the tags to their numerical representation, if they are
1474 known.
1475
1476 <item>The variant set which is used in the profile. This provides a
1477 vocabulary for specifying the <it/forms/ of data that appear inside
1478 the records.
1479
1480 <item>Element set names, which are a shorthand way for the client to
1481 ask for a subset of the data elements contained in a record. Element
1482 set names, in the retrieval module, are mapped to <it/element
1483 specifications/, which contain information equivalent to the
1484 <it/Espec-1/ syntax of Z39.50.
1485
1486 <item>Map tables, which may specify mappings to <it/other/ database
1487 profiles, if desired.
1488
1489 <item>Possibly, a set of rules describing the mapping of elements to a
1490 MARC representation.
1491
1492 <item>A list of element descriptions (this is the actual ARS of the
1493 schema, in Z39.50 terms), which lists the ways in which the various
1494 tags can be used and organized hierarchically.
1495 </itemize>
1496
1497 Several of the entries above simply refer to other files, which
1498 describe the given objects.
1499
1500 <sect2>The Configuration Files
1501
1502 <p>
1503 This section describes the syntax and use of the various tables which
1504 are used by the retrieval module.
1505
1506 The number of different file types may appear daunting at first, but
1507 each type corresponds fairly clearly to a single aspect of the Z39.50
1508 retrieval facilities. Further, the average database administrator,
1509 who is simply reusing an existing profile for which tables already
1510 exist, shouldn't have to worry too much about the contents of these tables.
1511
1512 Generally, the files are simple ASCII files, which can be maintained
1513 using any text editor. Blank lines, and lines beginning with a (&num;) are
1514 ignored. Any characters on a line followed by a (&num;) are also ignored.
1515 All other
1516 lines contain <it/directives/, which provide some setting or value
1517 to the system. Generally, settings are characterized by a single
1518 keyword, identifying the setting, followed by a number of parameters.
1519 Some settings are repeatable (r), while others may occur only once in a
1520 file. Some settings are optional (o), whicle others again are
1521 mandatory (m).
1522
1523 <sect2>The Abstract Syntax (.abs) Files
1524
1525 <p>
1526 The name of this file type is slightly misleading in Z39.50 terms,
1527 since, apart from the actual abstract syntax of the profile, it also
1528 includes most of the other definitions that go into a database
1529 profile.
1530
1531 When a record in the canonical, SGML-like format is read from a file
1532 or from the database, the first tag of the file should reference the
1533 profile that governs the layout of the record. If the first tag of the
1534 record is, say, <tt>&lt;gils&gt;</tt>, the system will look for the profile
1535 definition in the file <tt/gils.abs/. Profile definitions are cached,
1536 so they only have to be read once during the lifespan of the current
1537 process. 
1538
1539 When writing your own input filters, the <bf/record-begin/ command
1540 introduces the profile, and should always be called first thing when
1541 introducing a new record.
1542
1543 The file may contain the following directives:
1544
1545 <descrip>
1546 <tag>name <it/symbolic-name/</tag> (m) This provides a shorthand name or
1547 description for the profile. Mostly useful for diagnostic purposes.
1548
1549 <tag>reference <it/OID-name/</tag> (m) The reference name of the OID for
1550 the profile. The reference names can be found in the <bf/util/
1551 module of <bf/YAZ/.
1552
1553 <tag>attset <it/filename/</tag> (m) The attribute set that is used for
1554 indexing and searching records belonging to this profile.
1555
1556 <tag>tagset <it/filename/</tag> (o) The tag set (if any) that describe
1557 that fields of the records.
1558
1559 <tag>varset <it/filename/</tag> (o) The variant set used in the profile.
1560
1561 <tag>maptab <it/filename/</tag> (o,r) This points to a
1562 conversion table that might be used if the client asks for the record
1563 in a different schema from the native one.
1564
1565 <tag>marc <it/filename/</tag> (o) Points to a file containing parameters
1566 for representing the record contents in the ISO2709 syntax. Read the
1567 description of the MARC representation facility below.
1568
1569 <tag>esetname <it/name filename/</tag> (o,r) Associates the
1570 given element set name with an element selection file. If an (@) is
1571 given in place of the filename, this corresponds to a null mapping for
1572 the given element set name.
1573
1574 <tag>elm <it/path name attribute/</tag> (o,r) Adds an element
1575 to the abstract record syntax of the schema. The <it/path/ follows the
1576 syntax which is suggested by the Z39.50 document - that is, a sequence
1577 of tags separated by slashes (/). Each tag is given as a
1578 comma-separated pair of tag type and -value surrounded by parenthesis.
1579 The <it/name/ is the name of the element, and the <it/attribute/
1580 specifies what attribute to use when indexing the element. A ! in
1581 place of the attribute name is equivalent to specifying an attribute
1582 name identical to the element name. A - in place of the attribute name
1583 specifies that no indexing is to take place for the given element.
1584 </descrip>
1585
1586 <it>
1587 NOTE: The mechanism for controlling indexing is not adequate for
1588 complex databases, and will probably be moved into a separate
1589 configuration table eventually.
1590 </it>
1591
1592 The following is an excerpt from the abstract syntax file for the GILS
1593 profile.
1594
1595 <tscreen><verb>
1596 name gils
1597 reference GILS-schema
1598 attset gils.att
1599 tagset gils.tag
1600 varset var1.var
1601
1602 maptab gils-usmarc.map
1603
1604 # Element set names
1605
1606 esetname VARIANT gils-variant.est  # for WAIS-compliance
1607 esetname B gils-b.est
1608 esetname G gils-g.est
1609 esetname F @
1610
1611 elm (1,10)              rank                        -
1612 elm (1,12)              url                         -
1613 elm (1,14)              localControlNumber     Local-number
1614 elm (1,16)              dateOfLastModification Date/time-last-modified
1615 elm (2,1)               Title                       !
1616 elm (4,1)               controlIdentifier      Identifier-standard
1617 elm (2,6)               abstract               Abstract
1618 elm (4,51)              purpose                     !
1619 elm (4,52)              originator                  - 
1620 elm (4,53)              accessConstraints           !
1621 elm (4,54)              useConstraints              !
1622 elm (4,70)              availability                -
1623 elm (4,70)/(4,90)       distributor                 -
1624 elm (4,70)/(4,90)/(2,7) distributorName             !
1625 elm (4,70)/(4,90)/(2,10 distributorOrganization     !
1626 elm (4,70)/(4,90)/(4,2) distributorStreetAddress    !
1627 elm (4,70)/(4,90)/(4,3) distributorCity             !
1628 </verb></tscreen>
1629
1630 <sect2>The Attribute Set (.att) Files<label id="attset-files">
1631
1632 <p>
1633 This file type describes the <bf/Use/ elements of an attribute set.
1634 It contains the following directives. 
1635
1636 <descrip>
1637
1638 <tag>name <it/symbolic-name/</tag> (m) This provides a shorthand name or
1639 description for the attribute set. Mostly useful for diagnostic purposes.
1640
1641 <tag>reference <it/OID-name/</tag> (m) The reference name of the OID for
1642 the attribute set. The reference names can be found in the <bf/util/
1643 module of <bf/YAZ/.
1644
1645 <tag>ordinal <it/integer/</tag> (m) This value will be used to represent the
1646 attribute set in the index. Care should be taken that each attribute
1647 set has a unique ordinal value.
1648
1649 <tag>include <it/filename/</tag> (o,r) This directive is used to
1650 include another attribute set as a part of the current one. This is
1651 used when a new attribute set is defined as an extension to another
1652 set. For instance, many new attribute sets are defined as extensions
1653 to the <bf/bib-1/ set. This is an important feature of the retrieval
1654 system of Z39.50, as it ensures the highest possible level of
1655 interoperability, as those access points of your database which are
1656 derived from the external set (say, bib-1) can be used even by clients
1657 who are unaware of the new set.
1658
1659 <tag>att <it/att-value att-name &lsqb;local-value&rsqb;/</tag> (o,r) This
1660 repeatable directive introduces a new attribute to the set. The
1661 attribute value is stored in the index (unless a <it/local-value/ is
1662 given, in which case this is stored). The name is used to refer to the
1663 attribute from the <it/abstract syntax/. </descrip>
1664
1665 This is an excerpt from the GILS attribute set definition. Notice how
1666 the file describing the <it/bib-1/ attribute set is referenced.
1667
1668 <tscreen><verb>
1669 name gils
1670 reference GILS-attset
1671 include bib1.att
1672 ordinal 2
1673
1674 att 2001                distributorName
1675 att 2002                indexTermsControlled
1676 att 2003                purpose
1677 att 2004                accessConstraints
1678 att 2005                useConstraints
1679 </verb></tscreen>
1680
1681 <sect2>The Tag Set (.tag) Files
1682
1683 <p>
1684 This file type defines the tagset of the profile, possibly by
1685 referencing other tag sets (most tag sets, for instance, will include
1686 tagsetG and tagsetM from the Z39.50 specification. The file may
1687 contain the following directives.
1688
1689 <descrip>
1690 <tag>name <it/symbolic-name/</tag> (m) This provides a shorthand name or
1691 description for the tag set. Mostly useful for diagnostic purposes.
1692
1693 <tag>reference <it/OID-name/</tag> (o) The reference name of the OID for
1694 the tag set. The reference names can be found in the <bf/util/
1695 module of <bf/YAZ/. The directive is optional, since not all tag sets
1696 are registered outside of their schema.
1697
1698 <tag>type <it/integer/</tag> (m) The type number of the tag within the schema
1699 profile.
1700
1701 <tag>include <it/filename/</tag> (o,r) This directive is used
1702 to include the definitions of other tag sets into the current one.
1703
1704 <tag>tag <it/number names type/</tag> (o,r) Introduces a new
1705 tag to the set. The <it/number/ is the tag number as used in the protocol
1706 (there is currently no mechanism for specifying string tags at this
1707 point, but this would be quick work to add). The <it/names/ parameter
1708 is a list of names by which the tag should be recognized in the input
1709 file format. The names should be separated by slashes (/). The
1710 <it/type/ is th recommended datatype of the tag. It should be one of
1711 the following:
1712 <itemize>
1713 <item>structured
1714 <item>string
1715 <item>numeric
1716 <item>bool
1717 <item>oid
1718 <item>generalizedtime
1719 <item>intunit
1720 <item>int
1721 <item>octetstring
1722 <item>null
1723 </itemize>
1724 </descrip>
1725
1726 The following is an excerpt from the TagsetG definition file.
1727
1728 <tscreen><verb>
1729 name tagsetg
1730 reference TagsetG
1731 type 2
1732
1733 tag     1       title           string
1734 tag     2       author          string
1735 tag     3       publicationPlace string
1736 tag     4       publicationDate string
1737 tag     5       documentId      string
1738 tag     6       abstract        string
1739 tag     7       name            string
1740 tag     8       date            generalizedtime
1741 tag     9       bodyOfDisplay   string
1742 tag     10      organization    string
1743 </verb></tscreen>
1744
1745 <sect2>The Variant Set (.var) Files<label id="variant-set">
1746
1747 <p>
1748 The variant set file is a straightforward representation of the
1749 variant set definitions associated with the protocol. At present, only
1750 the <it/Variant-1/ set is known.
1751
1752 These are the directives allowed in the file.
1753
1754 <descrip>
1755 <tag>name <it/symbolic-name/</tag> (m) This provides a shorthand name or
1756 description for the variant set. Mostly useful for diagnostic purposes.
1757
1758 <tag>reference <it/OID-name/</tag> (o) The reference name of the OID for
1759 the variant set, if one is required. The reference names can be found
1760 in the <bf/util/ module of <bf/YAZ/.
1761
1762 <tag>class <it/integer class-name/</tag> (m,r) Introduces a new
1763 class to the variant set.
1764
1765 <tag>type <it/integer type-name datatype/</tag> (m,r) Addes a
1766 new type to the current class (the one introduced by the most recent
1767 <bf/class/ directive). The type names belong to the same name space as
1768 the one used in the tag set definition file.
1769 </descrip>
1770
1771 The following is an excerpt from the file describing the variant set
1772 <it/Variant-1/.
1773
1774 <tscreen><verb>
1775 name variant-1
1776 reference Variant-1
1777
1778 class 1 variantId
1779
1780   type  1       variantId               octetstring
1781
1782 class 2 body
1783
1784   type  1       iana                    string
1785   type  2       z39.50                  string
1786   type  3       other                   string
1787 </verb></tscreen>
1788
1789 <sect2>The Element Set (.est) Files
1790
1791 <p>
1792 The element set specification files describe a selection of a subset
1793 of the elements of a database record. The element selection mechanism
1794 is equivalent to the one supplied by the <it/Espec-1/ syntax of the
1795 Z39.50 specification. In fact, the internal representation of an
1796 element set specification is identical to the <it/Espec-1/ structure,
1797 and we'll refer you to the description of that structure for most of
1798 the detailed semantics of the directives below.
1799
1800 <it>
1801 NOTE: Not all of the Espec-1 functionality has been implemented yet.
1802 The fields that are mentioned below all work as expected, unless
1803 otherwise is noted.
1804 </it>
1805
1806 The directives available in the element set file are as follows:
1807
1808 <descrip>
1809 <tag>defaultVariantSetId <it/OID-name/</tag> (o) If variants are used in
1810 the following, this should provide the name of the variantset used
1811 (it's not currently possible to specify a different set in the
1812 individual variant request). In almost all cases (certainly all
1813 profiles known to us), the name <tt/Variant-1/ should be given here.
1814
1815 <tag>defaultVariantRequest <it/variant-request/</tag> (o) This directive
1816 provides a default variant request for
1817 use when the individual element requests (see below) do not contain a
1818 variant request. Variant requests consist of a blank-separated list of
1819 variant components. A variant compont is a comma-separated,
1820 parenthesized triple of variant class, type, and value (the two former
1821 values being represented as integers). The value can currently only be
1822 entered as a string (this will change to depend on the definition of
1823 the variant in question). The special value (@) is interpreted as a
1824 null value, however.
1825
1826 <tag>simpleElement <it/path &lsqb;'variant' variant-request&rsqb;/</tag>
1827 (o,r) This corresponds to a simple element request in <it/Espec-1/. The
1828 path consists of a sequence of tag-selectors, where each of these can
1829 consist of either:
1830
1831 <itemize>
1832 <item>A simple tag, consisting of a comma-separated type-value pair in
1833 parenthesis, possibly followed by a colon (:) followed by an
1834 occurrences-specification (see below). The tag-value can be a number
1835 or a string. If the first character is an apostrophe ('), this forces
1836 the value to be interpreted as a string, even if it appears to be numerical.
1837
1838 <item>A WildThing, represented as a question mark (?), possibly
1839 followed by a colon (:) followed by an occurrences specification (see
1840 below).
1841
1842 <item>A WildPath, represented as an asterisk (*). Note that the last
1843 element of the path should not be a wildPath (wildpaths don't work in
1844 this version).
1845 </itemize>
1846
1847 The occurrences-specification can be either the string <tt/all/, the
1848 string <tt/last/, or an explicit value-range. The value-range is
1849 represented as an integer (the starting point), possibly followed by a
1850 plus (+) and a second integer (the number of elements, default being
1851 one).
1852
1853 The variant-request has the same syntax as the defaultVariantRequest
1854 above. Note that it may sometimes be useful to give an empty variant
1855 request, simply to disable the default for a specific set of fields
1856 (we aren't certain if this is proper <it/Espec-1/, but it works in
1857 this implementation).
1858 </descrip>
1859
1860 The following is an example of an element specification belonging to
1861 the GILS profile.
1862
1863 <tscreen><verb>
1864 simpleelement (1,10)
1865 simpleelement (1,12)
1866 simpleelement (2,1)
1867 simpleelement (1,14)
1868 simpleelement (4,1)
1869 simpleelement (4,52)
1870 </verb></tscreen>
1871
1872 <sect2>The Schema Mapping (.map) Files<label id="schema-mapping">
1873
1874 <p>
1875 Sometimes, the client might want to receive a database record in
1876 a schema that differs from the native schema of the record. For
1877 instance, a client might only know how to process WAIS records, while
1878 the database record is represented in a more specific schema, such as
1879 GILS. In this module, a mapping of data to one of the MARC formats is
1880 also thought of as a schema mapping (mapping the elements of the
1881 record into fields consistent with the given MARC specification, prior
1882 to actually converting the data to the ISO2709). This use of the
1883 object identifier for USMARC as a schema identifier represents an
1884 overloading of the OID which might not be entirely proper. However,
1885 it represents the dual role of schema and record syntax which
1886 is assumed by the MARC family in Z39.50.
1887
1888 <it>
1889 NOTE: The schema-mapping functions are so far limited to a
1890 straightforward mapping of elements. This should be extended with
1891 mechanisms for conversions of the element contents, and conditional
1892 mappings of elements based on the record contents.
1893 </it>
1894
1895 These are the directives of the schema mapping file format:
1896
1897 <descrip>
1898 <tag>targetName <it/name/</tag> (m) A symbolic name for the target schema
1899 of the table. Useful mostly for diagnostic purposes.
1900
1901 <tag>targetRef <it/OID-name/</tag> (m) An OID name for the target schema.
1902 This is used, for instance, by a server receiving a request to present
1903 a record in a different schema from the native one. The name, again,
1904 is found in the <bf/oid/ module of <bf/YAZ/.
1905
1906 <tag>map <it/element-name target-path/</tag> (o,r) Adds
1907 an element mapping rule to the table.
1908 </descrip>
1909
1910 <sect2>The MARC (ISO2709) Representation (.mar) Files
1911
1912 <p>
1913 This file provides rules for representing a record in the ISO2709
1914 format. The rules pertain mostly to the values of the constant-length
1915 header of the record.
1916
1917 <it>NOTE: This will be described better. We're in the process of
1918 re-evaluating and most likely changing the way that MARC records are
1919 handled by the system.</it>
1920
1921 <sect1>Exchange Formats
1922
1923 <p>
1924 Converting records from the internal structure to en exchange format
1925 is largely an automatic process. Currently, the following exchange
1926 formats are supported:
1927
1928 <itemize>
1929 <item>GRS-1. The internal representation is based on GRS-1, so the
1930 conversion here is straightforward. The system will create
1931 applied variant and supported variant lists as required, if a record
1932 contains variant information.
1933
1934 <item>SUTRS. Again, the mapping is fairly straighforward. Indentation
1935 is used to show the hierarchical structure of the record.
1936
1937 <item>ISO2709-based formats (USMARC, etc.). Only records with a
1938 two-level structure (corresponding to fields and subfields) can be
1939 directly mapped to ISO2709. For records with a different structuring
1940 (eg., GILS), the representation in a structure like USMARC involves a
1941 schema-mapping (see section <ref id="schema-mapping" name="Schema
1942 Mapping">), to an &dquot;implied&dquot; USMARC schema (implied,
1943 because there is no formal schema which specifies the use of the
1944 USMARC fields outside of ISO2709). The resultant, two-level record is
1945 then mapped directly from the internal representation to ISO2709. See
1946 the GILS schema definition files for a detailed example of this
1947 approach.
1948
1949 <item>Explain. This representation is only available for records
1950 belonging to the Explain schema.
1951
1952 </itemize>
1953
1954 <sect>License
1955
1956 <p>
1957 Copyright &copy; 1995,1996 Index Data.
1958
1959 All rights reserved.
1960
1961 Use and redistribution in source or binary form, with or without
1962 modification, of any or all of this software and documentation is
1963 permitted, provided that the following conditions are met:
1964
1965 1. This copyright and permission notice appear with all copies of the
1966 software and its documentation. Notices of copyright or attribution
1967 which appear at the beginning of any file must remain unchanged.
1968
1969 2. The names of Index Data or the individual authors may not be used to
1970 endorse or promote products derived from this software without specific
1971 prior written permission.
1972
1973 3. Source code or binary versions of this software and its
1974 documentation may be used freely in not-for-profit applications. For
1975 profit applications - such as providing for-pay database services,
1976 marketing a product based in whole or in part on this software or its
1977 documentation, or generally distributing this software or its
1978 documentation under a different license - requires a commercial
1979 license from Index Data. The software may be installed and used for
1980 evaluation purposes in conjunction with a commercial application for a
1981 trial period of no more than 60 days.
1982
1983 THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
1984 EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
1985 WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1986 IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
1987 INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
1988 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
1989 NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
1990 LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
1991 OF THIS SOFTWARE.
1992
1993 <sect>About Index Data and the Zebra Server
1994
1995 <p>
1996 Index Data is a consulting and software-development enterprise that
1997 specialises in library and information management systems. Our
1998 interests and expertise span a broad range of related fields, and one
1999 of our primary, long-term objectives is the development of a powerful
2000 information management
2001 system with open network interfaces and hypermedia capabilities.
2002
2003 We make this software available free of charge for not-for-profit
2004 purposes, as a service to the networking community, and to further
2005 the development and use of quality software for open network
2006 communication.
2007
2008 If you like this software, and would like to use all or part of it in
2009 a commercial product, or to provide a commercial database service,
2010 please contact us to discuss the details. We'll be happy to answer
2011 questions about the software, and about our services in general. If
2012 you have specific requirements to the software, we'll be glad to offer
2013 our advice - and if you need to adapt the software to a special
2014 purpose, our consulting services and expert knowledge of the software
2015 is available to you at favorable rates.
2016
2017 <tscreen>
2018 Index Data&nl
2019 Ryesgade 3&nl
2020 DK-2200 K&oslash;benhavn N&nl
2021 </tscreen>
2022
2023 <p>
2024 <tscreen><verb>
2025 Phone: +45 3536 3672
2026 Fax  : +45 3536 0449
2027 Email: info@index.ping.dk
2028 </verb></tscreen>
2029
2030 The <it>Random House College Dictionary</it>, 1975 edition
2031 offers this definition of the 
2032 word &dquot;Zebra&dquot;:
2033
2034 <it>
2035 Zebra, n., any of several horselike, African mammals of the genus Equus,
2036 having a characteristic pattern of black or dark-brown stripes on
2037 a whitish background.
2038 </it>
2039
2040 </article>