| 1 | # $Id: Spec.pm,v 1.27 2008-07-16 18:37:33 mike Exp $ | ||
| 2 | |||
| 3 | package Net::Z3950::DBIServer::Spec; | ||
| 4 | use strict; | ||
| 5 | |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Net::Z3950::DBIServer::Spec - The zSQLgate Configuration File Format | ||
| 10 | |||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | C<zSQLgate> configuration files are free-form and treat all whitespace | ||
| 15 | equivalently, with the sole exception of comments. Related directives | ||
| 16 | are grouped together with braces, with sections of detailed | ||
| 17 | information nested within more general sections. | ||
| 18 | |||
| 19 | Apart from a few top-level declarations such as the data-source and | ||
| 20 | authentication credentials to use, the bulk of a typical configuration | ||
| 21 | file consists of a set of one or more per-database sections, each | ||
| 22 | describing a single Z39.50 database (corresponding to a single table | ||
| 23 | of the relational database). Each such per-database section has a | ||
| 24 | subsection specifying how searching should be handled and another | ||
| 25 | about retrieval, which in turn is broken into stanzas describing each | ||
| 26 | of the record formats to be supported. | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | =head1 DESCRIPTION | ||
| 31 | |||
| 32 | Comments are introduced by a hash character (C<#>), and run to the end | ||
| 33 | of the line. They are ignored. Comments are the only part of the | ||
| 34 | configuration file syntax that treats lines specially: otherwise the | ||
| 35 | syntax is totally free-form. | ||
| 36 | |||
| 37 | The contents of the file must follow this BNF grammar, where C<config> | ||
| 38 | is the start production. | ||
| 39 | |||
| 40 | config = chunk* | ||
| 41 | |||
| 42 | chunk = DATASOURCE '=' STRING | ||
| 43 | | USERNAME '=' STRING | ||
| 44 | | PASSWORD '=' STRING | ||
| 45 | | OPTION STRING '=' string_or_num | ||
| 46 | | perDb | ||
| 47 | |||
| 48 | string_or_num = STRING | ||
| 49 | | NUMBER | ||
| 50 | |||
| 51 | perDB = DATABASE DBNAME '{' section* '}' | ||
| 52 | |||
| 53 | section = TABLE '=' TABLENAME | ||
| 54 | | AUXILIARY TABLENAME WITH CONDITION | ||
| 55 | | RESTRICTION '=' STRING | ||
| 56 | | JOIN '=' STRING # "implicit" or "outer" | ||
| 57 | | searchSpec | ||
| 58 | | dataSpec | ||
| 59 | |||
| 60 | searchSpec = SEARCH attrsetSpec | ||
| 61 | | SEARCH '{' attrsetSpec* '}' | ||
| 62 | |||
| 63 | attrsetSpec = ATTRSET oidSpec '{' accessSpec* '}' | ||
| 64 | | DEFAULTATTRS attrs | ||
| 65 | |||
| 66 | attrs = attr | ||
| 67 | | attr ',' attrs | ||
| 68 | |||
| 69 | attr = NUMBER '=' NUMBER | ||
| 70 | |||
| 71 | oidSpec = oid | ||
| 72 | | SYMBOL | ||
| 73 | | STRING | ||
| 74 | |||
| 75 | oid = NUMBER | ||
| 76 | | NUMBER '.' oid | ||
| 77 | |||
| 78 | accessSpec = ACCESS NUMBER '=' modifier* COLUMNNAME | ||
| 79 | |||
| 80 | modifier = FULLTEXT | ||
| 81 | | UPPERCASE | ||
| 82 | |||
| 83 | dataSpec = DATA formatSpec | ||
| 84 | | DATA '{' formatSpec* '}' | ||
| 85 | |||
| 86 | formatSpec = CACHESIZE NUMBER | ||
| 87 | | FORMAT GRS1 grsFormatSpec | ||
| 88 | | FORMAT XML xmlFormatSpec | ||
| 89 | | FORMAT MARC xmlFormatSpec | ||
| 90 | | FORMAT SUTRS xmlFormatSpec | ||
| 91 | |||
| 92 | grsFormatSpec = '{' grs1ElementSpec* '}' | ||
| 93 | |||
| 94 | grs1ElementSpec = FIELD tagPath '=' COLUMNNAME | ||
| 95 | | COLUMN COLUMNNAME '=' tagPath # DEPRECATED | ||
| 96 | |||
| 97 | tagPath = tag+ | ||
| 98 | |||
| 99 | tag = '(' NUMBER ',' tag-val ')' | ||
| 100 | |||
| 101 | tag-val = NUMBER | ||
| 102 | | STRING | ||
| 103 | |||
| 104 | xmlFormatSpec = '{' xmlElementSpec* '}' | ||
| 105 | |||
| 106 | xmlElementSpec = RECORD '=' STRING | ||
| 107 | | ATTRS '=' STRING | ||
| 108 | | TRANSFORM '=' FILENAME | ||
| 109 | | SCHEMA '=' IDENTIFIER | ||
| 110 | | FIELD TAGNAME '=' COLUMNNAME | ||
| 111 | | COLUMN COLUMNNAME '=' TAGNAME # DEPRECATED | ||
| 112 | |||
| 113 | DBNAME = STRING | ||
| 114 | TABLENAME = STRING | ||
| 115 | CONDITION = STRING | ||
| 116 | COLUMNNAME = STRING | ||
| 117 | FILENAME = STRING | ||
| 118 | TAGNAME = STRING | ||
| 119 | |||
| 120 | I didn't initially write prose describing what the various sections | ||
| 121 | mean, because I thought this format was likely to change a fair bit | ||
| 122 | before it stabilised enough for that to be worthwhile. Now, though | ||
| 123 | (April 2005) the format is stable, and descriptive prose should | ||
| 124 | follow. However, work on the tutorial takes precedence. | ||
| 125 | |||
| 126 | |||
| 127 | =head1 AUTHOR | ||
| 128 | |||
| 129 | Mike Taylor E<lt>mike@miketaylor.org.ukE<gt> | ||
| 130 | |||
| 131 | First version Sunday 24th February 2002. | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | 1; |