SYNOPSIS

 <client>
   <authentication>http://some.url/{user}/pwd={pass}<authentication>
   <database name="srubooks">
     <zurl>http://z3950.loc.gov:7090/voyager</zurl>
     <option name="sru">get</option>
     <charset>marc-8</charset>
     <search>
       <querytype>cql</querytype>
       <map use="4"><index>title</index></map>
       <map use="1003"><index>creator</index></map>
     </search>
   </database>
 </client>

DESCRIPTION

The universal Swiss Army Gateway \*(C`simple2zoom\*(C' is configured by a single file, named on the command-line, and expressed in \s-1XML\s0. This file specifies which back-end databases are supported, how the back-ends are contacted, what character-sets they provide records in, and how to map Z39.50 searches to \s-1CQL\s0.

The structure of the file is pretty simple.

Top Level

<client>

The top-level element is <client>. It contains a single optional <authentication> element, any number of <database> elements and a single optional <search> element. The second of these specifies how to interpret requests to search in the configured databases; the last provides query mapping specifications for dynamically specified databases.

<authentication>

This element contains a \s-1URL\s0 template, specifying the address of an \s-1HTTP\s0 authentication server. The template must include the special strings \*(C`{user}\*(C' and \*(C`{pass}\*(C', which are substituted with the username and password supplied in the Init request, if any. The resulting \s-1URL\s0 is actioned and the result examined: any successful response (\s-1HTTP\s0 status 200) indicates that the username/password combination is acceptable, and that the session can continue; any other response (e.g. 401 Authorization Required) results in the Init request being refused with \s-1BIB-1\s0 diagnostic 1014 (Init/AC: Authentication System error). If the <authentication> element is omitted from the configuration, no authentication credentials are required, and any that are provided are ignored. (A trivial example of an authentication server script is included in the Simple2ZOOM distribution, as \*(C`etc/sru-auth\*(C'.)

<database>

The <database> element carries a \*(C`name\*(C' attribute specifying the Z39.50 database name by which is it is known to clients. It contains several complex elements, and is discussed in more detail below.

<search>

Each <search> element, whether contained within a specific <database> (see below) or at the top level, consists of a single mandatory <querytype> element followed by any number of <map>s. The content of <querytype> indicates the type of query that should be sent to the back-end server, with Simple2ZOOM reposible for translating incoming queries as required into that format. At present, the only supported value is \*(C`cql\*(C'.

<map>

Each <map> element carries a \*(C`use\*(C' attribute, which is the numeric value of \s-1BIB-1\s0 use attribute to be supported, and optionally contains a single <index> element which in turn contains the name of the corresponding \s-1CQL\s0 index. Type-1 searches against the specified \s-1BIB-1\s0 access point are mapped to \s-1CQL\s0 searches against the specified index. If the <index> is omitted within a <map>, then the generated \s-1CQL\s0 query term has no index specified. This can be useful for \s-1BIB-1\s0 attributes such as 1016 (any) and 1035 (anywhere).

Databases

The <database> element which describes each database contains the following elements in the specified order.

In general, <database> entries are of two kinds: those connecting through to a Z39.50 database will have no <search> element, since no query mapping is necessary to translate an incoming Type-1 query; but those connecting to an \s-1SRU\s0 or \s-1SRW\s0 database will have a <search> element with <querytype> set to \*(C`cql\*(C' and containing information on how to map from specified \s-1BIB-1\s0 use attributes to \s-1CQL\s0 indexes.

<zurl>

Contains the target address of the back-end database (e.g. \*(C`tcp:z3950.indexdata.com/gils\*(C' or \*(C`http://z3950.loc.gov:7090/voyager\*(C').

<resultsetid>

Optional. If provided, it must take one of the following values, and if it is omitted then the value \*(C`fallback\*(C' is assumed:

When queries are received that include references to existing result-sets, these are translated into result-set references using the \*(C`cql.resultSetId\*(C' index. It is an error if the server does not support this facility. References to existing result-sets are rewritten as resubmissions of the query. This works on all servers, but does not reliably give precisely correct results if the database is updated between searches. Result-set references are used when supported, but resubmissions of prior queries are used when this facility is unavailable.

<nonamedresultsets>

This is optional. If provided, it is empty and indicates that the back-end database does not support named result sets.

<option>

There may be any number of these. Each <option> element carries a \*(C`name\*(C' attribute and contains a corresponding value. These are \s-1ZOOM\s0 options which are applied to the connection when it is first created, and can be used to control, for example, the desired \*(C`elementSetName\*(C' or \*(C`schema\*(C' of the records provided by the back-end. A particularly important option is \*(C`sru\*(C', which may be set to \*(C`get\*(C', \*(C`post\*(C' or \*(C`soap\*(C' to request vanilla \s-1SRU\s0, \s-1SRU\s0 over \s-1POST\s0 and \s-1SRW\s0 respectively.

<charset>

Optional. Contains the name of the character-set in which the back-end target supplies records (e.g. \*(C`marc-8\*(C')

<search>

Optional. Provides specifications for how to search the database, exactly like the top-level <search> element described above.

<schema>

Optional and repeatable: each element indicates special handling for when records are requested in a particular schema. See below.

<sutrs-record>, <usmarc-record>, <grs1-record>.

Optional. Provides specifications for how to construct records in the relevant syntaxes when they are requested by clients. The format is the same in all cases: the specification contains a list of <field> elements, each of which has an \*(C`xpath\*(C' attribute and textual content. Records are built by accessing the data addressed by the specified XPath expressions, and encoding each as an element addressed as specified by the element content. The interpretation of the content is different for different record-syntaxes:

\s-1SUTRS\s0

The content is ignored.

\s-1USMARC\s0

The content indicates a \s-1MARC\s0 field by a string consisting of the following parts, in order: a three-digit field number; optionally a slash followed by the first indicator; optionally another slash followed by the second indicator; optionally a dollar sign followed by a subfield tag. In other words, \s-1MARC\s0 field specifications much match the regular expression \*(C`/^\d\d\d(/w)?(/w?)(\$\w)?$/\*(C'. It is impossible to specify the second indicator without the first, but a subfield may be specified along with zero, one or two indicators. As usual, a few examples are worth any amount of explanation: 001 260$c 500$a 100/1$a 245/1/0$a

\s-1GRS-1\s0

The content indicates an address within a \s-1GRS-1\s0 record in the form of one or more consecutive (type,value) pairs, each enclosed in parentheses. For example, \*(C`(1,14)\*(C' would indicate an element of type 1 (tagSet-M) with value 14 (localControlNumber). A longer path such as \*(C`(3,admin)(2,6)\*(C' indicates an abstract field (tagSet-G element 6) within an \*(L"admin\*(R" sub-record.

Schemas

Each <schema> element is empty, but carries the following attributes, which are used to provide records to Z39.50 clients in \s-1MARC\s0 formats.

oid

Mandatory. This is the \s-1OID\s0 of a Z39.50 record-syntax which is to be handled by schema mapping. Requests in this database for this record-syntax are handled as specified. Example value: 1.2.840.10003.5.10

sru

Mandatory. This is the \s-1URI\s0 of an \s-1SRU/W\s0 schema which is requested from the \s-1SRU\s0 or \s-1SRW\s0 back-end in order to fulfill the request. Example value: \*(C`info:srw/schema/1/marcxml-v1.1\*(C'

format

Optional. Indicates which of the \s-1MARC\s0 variants is in use, so that the record can be formatted correctly. Defaults to \*(C`MARC21\*(C' if omitted. Example values: \*(C`MARC21\*(C', \*(C`USMARC\*(C', \*(C`UNIMARC\*(C'

encoding

Optional. Indicates which character-set to use for the formatted record. Defaults to \*(C`UTF-8\*(C' if omitted. Example values: \*(C`UTF-8\*(C', <\s-1MARC-8\s0>

\s-1NOTE\s0 that in its current form this schema-mapping only works for the specific though common combination of Z39.50 front-end, \s-1SRU\s0 back-end and \s-1MARC\s0 record syntax.

CONFIGURATION FILE SCHEMA

The Simple2ZOOM distribution includes, in the \*(C`etc\*(C' directory, an \s-1XML\s0 schema which can be used to validate configuration files. This schema is provided in four formats:

simple2zoom.rnc

Relax-NG compact format: a simple, elegant, terse and wholly comprehensible \s-1XML\s0 constraint language that you don't even need to learn in order to understand. This is the master version: the others are automatically generated from it.

simple2zoom.rng

Relax-NG \s-1XML\s0 format: the world seems to have this zany fetish that everything must be specified in \s-1XML\s0, so Relax-NG has an \s-1XML\s0 syntax that corresponds trivially with the much nicer compact syntax. The principle value of this is that \*(C`xmllint\*(C' understands it.

simple2zoom.dtd

An old-fashioned \s-1DTD\s0 (document type definition).

simple2zoom.xsd

If you must.

Use whichever you like. For example,

xmllint --relaxng simple2zoom.rng --noout test.xml xmllint --dtdvalid simple2zoom.dtd --noout test.xml xmllint --schema simple2zoom.xsd --noout test.xml

RELATED TO Net::Z3950::Simple2ZOOM::Config…

The \*(C`simple2zoom\*(C' program.

The \*(C`Net::Z3950::Simple2ZOOM\*(C' module.

AUTHOR

Mike Taylor <[email protected]>

COPYRIGHT AND LICENCE

Copyright (C) 2007 by Index Data.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.