Work.
[idzebra-moved-to-github.git] / doc / gils.sgml
1 <!doctype linuxdoc system>
2
3 <!--
4   $Id: gils.sgml,v 1.2 1996-05-07 12:29:36 quinn Exp $
5 -->
6
7 <article>
8 <title>Serving GILS Records with Zebra
9 <author><htmlurl url="http://www.indexdata.dk/" name="Index Data">, <tt><htmlurl url="mailto:info@index.ping.dk" name="info@index.ping.dk"></>
10 <date>$Revision: 1.2 $
11 <abstract>
12 This document explains how to set up a simple database of Government
13 Information Locator Records using the Zebra retrieval engine and
14 Z39.50 server (version 1.0b1 or later).
15 </abstract>
16
17 <sect>Introduction
18
19 <p>
20 Zebra is a powerful and versatile information management system,
21 allowing you to construct arbitrarily complex record structures and managing
22 efficient, robust databases.
23
24 Since the internal data modeling tools of Zebra are based on the
25 Z39.50-1995 standard, the system is well-suited to support a complex
26 database profile such as the one specified by the GILS profile.
27 Because GILS is expected by many to play an important role in the
28 evolving, global information society, and because the GILS profile has
29 proven useful to a number of different applications outside of its
30 dedicated domain, the public distribution of Zebra includes a
31 configuration set-up which makes it a simple matter to establish a new
32 GILS database.
33
34 This document, which is a supplement to the general documentation set
35 for Zebra, explains in simple terms how you can easily set up your own
36 GILS-compliant database service.
37
38 <sect>Retrieving and Unpacking Zebra
39
40 <p>
41 The first step is to download the software. If you are using a WWW
42 browser, you can point it at the Zebra distribution archive at
43 <htmlurl url="http://www.indexdata.dk/zebra.html"
44 name="http://www.indexdata.dk/zebra.html">, and follow the link named
45 <it/Download the latest version of the software (xxx)/, where <it/xxx/
46 is the current version of Zebra.
47
48 If you use an FTP client, you can use normal, anonymous FTP. Connect
49 to the host <tt/ftp.indexdata.dk/, log in as <tt/ftp/, and give your
50 Email-address as the password. Then type <tt>cd index/yaz</tt>, and
51 use the <tt/dir/ command to locate the current version of Zebra. The
52 file will be named <tt/zebra-xxx/, where <tt/xxx/ is the current
53 version of the software. Remember to use the <tt/bin/ command before
54 using <tt/get/ to download the software.
55
56 Once the distribution archive has been dowloaded, it must be
57 decompressed. To do this, use the command <tt/gunzip/ command (if your
58 system doesn't have the <tt/gunzip/ program, you will need to acquire
59 this separately). Finally, use the command <tt>tar xvf
60 &lt;file&gt;</tt> to unpack the archive.
61
62 If you downloaded the source version of the software (this is the only
63 option today, although we expect to release binary versions for Linux,
64 SunOS, and Digital Unix shortly), you will have to compile Zebra
65 before you can use it.
66
67 On many of the major version of the Unix operating system, compiling
68 Zebra is a simple matter of typing <tt/make/ in the top-level
69 distribution directory (this is the directory that was created when
70 you executed <tt/tar/). Normally, Zebra compiles cleanly at least on
71 Linux, Digital Unix (DEC OSF/1), and IBM AIX. On certain platforms
72 (such as SunOS), you will need to edit the top-level <tt/Makefile/ to
73 set the <tt/NETLIB/ variable to include the Berkeley Socket
74 Libraries. On other Unix platforms, you <it/may/ need to modify
75 Makefiles or header files, but in general, we have found Zebra to be
76 easily portable across modern Unix-versions. You do need an ANSI-C
77 compliant compiler (you'll see a long list of Syntax-errors during the
78 compile if your default compiler is not ANSI C), but again, this is
79 standard on most modern Unix-systems. If you don't have one, the
80 freely available GNU C compiler is available for many systems.
81
82 <sect>The First GILS Database
83
84 <p>
85 Having successfully acquired the software, it's time to try it out.
86 The directory <tt/test/ under the main distribution directory contains
87 a small sample database of GILS records.
88
89 <it>NOTE: The records included in the distribution are part of a
90 sample set provided by the US Geological Survey, as a service to GILS
91 implementors. They are included for testing and demonstrating the
92 software, and neither the USGS or Index Data nor anyone else should be
93 held responsible for their contents.</it>
94
95 If you <tt/cd/ to the <tt/test/ directory, the first thing to notice
96 is the file <tt/zebra.cfg/. There has to be a file like this present
97 whenever you use Zebra - it establishes various settings and defaults,
98 and we'll return to its contents below (a detailed
99 description is found in the general Zebra documentation file).
100
101 The subdirectory <tt/records/ contains the sample records. We'll get
102 back to them, too.
103
104 The first order of business is to index the sample records, and create
105 the access files required by the Z39.50 server. To do this, position
106 yourself in the <tt/test/ directory, and type the command
107 <tt>../index/zebraidx update records</tt>.
108
109 The indexing program will respond with a stream of control
110 information, and when it completes, the database is ready. To start
111 the Z39.50 server, type the command <tt>../index/zebrasrv</tt>.
112
113 Assuming that nothing unfortunate happened, you are now running a
114 GILS-compliant Z39.50 server on the port 9999 on your local machine
115 (to learn how to run the server at a different port, and redirect the
116 diagnostic output to a file, consult the section on <it/Running
117 zebrasrv/ in the general documentation).
118 The database containing the sample records is named <tt/Default/.
119
120 To test the server, you can use any compatible Z39.50 client. You can
121 also use the simple demonstration client which is included with Zebra
122 itself. To do this, start a new session on your machine (or put the
123 server in the background). Change to the directory <tt>yaz/client</tt>
124 under the main Zebra distribution directory. Now execute the command
125 <tt>./client tcp:localhost:9999</tt>.
126
127 If all went well, the client will tell you that it has established an
128 association with your test server. To test it, try out these commands:
129
130 <tscreen><verb>
131 Z> find surficial
132 Z> show 1
133 </verb></tscreen>
134
135 The default retrieval syntax for the client is USMARC. To try other
136 formats for the same record, try:
137
138 <tscreen><verb>
139 Z>format sutrs
140 Z>show 1
141 Z>format grs-1
142 Z>show 1
143 Z>elements B
144 Z>show 1
145 </verb></tscreen>
146
147 You can learn more about the sample client by reading the <tt/README/
148 file in the <tt/yaz/ directory.
149
150 <sect>The Records
151
152 <p>
153 The GILS profile is only concerned with the communication that takes
154 place between two compliant systems. It doesn't mandate how the client
155 application should behave, and it doesn't tell you how you should
156 maintain and process data at the server side. Specifically, while the
157 profile specifies a number of different exchange format for retrieval
158 records.
159
160 For the purposes of this discussion, we will be using a simple,
161 SGML-like representation of the GILS record structure. There is
162 nothing magical or sacrosanct about this format, but it is easy to
163 read and write, and because of its semblance of SGML and HTML, it is
164 familiar to many people. If you would like to use a different, local
165 representation for your GILS records, you can read the general Zebra
166 documentation to learn how to establish a custom input filter for your
167 particular record format.
168
169 In the SGML-like syntax, each record should begin with the tag
170 <tt/&lt;gils&gt;/. This selects the GILS profile, and provides context
171 for the content tags which follow. Similarly, each record should
172 finish with the end-tag <tt/&etago;gils&gt;/.
173
174 The body of the record is made up by a sequence of tagged elements,
175 reflecting the <it/abstract record syntax/ of the GILS profile. Some
176 of these elements contain simple data, or text, while others contain
177 more tagged elements - these are complex, or constructed, data
178 elements. The tag names generally correspond to the tag names provided
179 in the GILS profile. Capitalization is ignored in tag names, as are
180 dashes (-). Hence, <tt/local-subject-index/ is equivalent to
181 <tt/LocalSubjectIndex/ which is the same as <tt/LOCALSUBJECTINDEX/.
182
183 It is useful to look at the records in the <tt>test/records</tt> as
184 examples of how SGML-formatted GILS record can look. Note that
185 whitespace is generally ignored, so you can choose whatever layout of
186 your records suits you best.
187
188 <sect>The Zebra Configuration File
189
190 <p>
191 As mentioned, the Zebra indexer and server always look for the file
192 <tt/zebra.cfg/ in their current working directory (unless they are
193 told to look for it elsewhere with the <tt/-c/ option). The example
194 file in the <tt/test/ directory represents all but the bare minimum
195 for such a file. While it may seem daunting at first, we find the
196 following to be a powerful setup for a GILS-like database (everything
197 preceded by (&num;) is ignored by the software):
198
199 <tscreen><verb>
200 #
201 # Sample configuration file for GILS database
202 #
203
204 # Where are the configuration files located?
205 profilePath: /usr/local/lib/zebra
206
207 # Load attribute sets for searching
208 attset bib1.att
209 attset gils.att
210
211 # Records are identified by their path in the file system
212 recordId: file
213
214 # Store information about records to allow deletion and updating
215 storeKeys: 1
216
217 # Records are structured
218 recordType: grs
219
220 # Where to store the indexes
221 register: /datadisk/index:500M
222
223 # Where to store temporary data while merging with register
224 shadow: /datadisk/shadow:500M
225 </verb></tscreen>
226
227 If you like, you can paste this file straight into a <tt/zebra.cfg/
228 file ready for your own use (with a bit of editing of the pathnames).
229 In the following, we'll explain the individual settings. For the full
230 story on the <tt/zebra.cfg/ file and the configuration options of
231 Zebra, you should read the general documentation.
232
233 <descrip>
234
235 <tag/profilePath/ This field tells Zebra where to look for the
236 configuration files. In the distribution, these files are located in
237 the <tt/tab/ directory, but you may wish to put them someplace else
238 for convenience. If necessary, you can provide multiple directory
239 paths, separated by (:).
240
241 <tag/attset/ This field tells the Zebra server which attribute sets it
242 should support for searching. You could get by with just loading the
243 GILS set, but if you load BIB-1 as well, Zebra will support both sets
244 for those GILS attributes that are inherited from BIB-1.
245
246 <tag/recordId/ The <tt/recordId: file/ setting tells Zebra that
247 individual records should be identified by the physical files in which
248 they are located. In this mode, your database will always (after an
249 update operation) reflect the contents of the directory (or
250 directories).
251
252 <tag/storeKeys/ This setting tells Zebra to store additional
253 information about each record, to facilitate updating. In combination
254 with the <tt/recordId: file/ setting, this is a very convenient
255 maintenance option. If you maintain your records as individual files
256 in a directory tree, you have only to run <tt/zebraidx/ with the
257 top-level directory as an argument. If new files are added, they are
258 entered into the database. If they are modified, the indexes are
259 changed accordingly, and if they are deleted from the filesystem (or
260 renamed), the indexes are also updated correctly, the next time you
261 run <tt/zebraidx/.
262
263 <tag/recordType/ This setting selects the type of processing which is
264 to take place when a record is accessed by the indexer or the Z39.50
265 server. GRS stands for <it/Generic Record Syntax/, and signals that
266 the records are structured.
267
268 <tag/register/ In the first test above, you may have noticed that the
269 <tt/zebraidx/ created a number of files in the working directory. Some
270 of these files, which contain the indexing information for the
271 database, can grow quite large, and it is sometimes useful to place
272 them in a separate directory or file system. You should provide the
273 path of the directory followed by a colon (:), followed by the maximum
274 amounts of megabytes (M) or kilobytes (K) of disk space that Zebra is
275 allowed to use in the given directory. If you specify more than one
276 directory:size combination <it/on the same line/, Zebra will fill up
277 each directory, one at a time. This feature is essential if your
278 database is so large that the registers cannot fit into a single
279 partition of your disk.
280
281 <tag/shadow/ The format of this setting is the same as for the one
282 above. If you provide one or more directory for the &dquot;shadow
283 system&dquot;, you enable the safe updating system of the Zebra
284 indexer. When changes to the records are merged into the register
285 files, the files are not changed immediately. Instead, the changes are
286 written into separate files, or &dquot;shadow files&dquot;. At the end
287 of the merging process, or in a separate operation, the changes are
288 &dquot;committed&dquot;, and written into the register files
289 themselves. This final step is carried out by the command <tt/zebraidx
290 commit/ - the <tt/commit/ directive can also be given on the same
291 command line as the <tt/update/ directive - at the end of the command
292 line. The shadow file system can consume a lot of disk space -
293 particularly in a large update operation which involves almost all of
294 the index, but the benefits are substantial. If the system crashes
295 during an update procedure, or the process is otherwise interrupted,
296 the registers are left in an unknown state, and are effectively
297 rendered useless - this can be unfortunate if the index is very large,
298 but the use of the shadow system greatly reduces the risk of an index
299 being damaged in this way. Further, when the shadow system is enabled,
300 your clients may access the Zebra server without interruption
301 throughout the update and commit procedures - Zebra will ensure that
302 the parts of the register accessed by the server are always
303 consistent.
304
305 </descrip>
306
307 <sect>Creating Your Own Database
308
309 <p>
310
311 </article>