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