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