]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/002.schema.config.sql
adding xml_transform support. this will require a patched xml2 module.
[Evergreen.git] / Open-ILS / src / sql / Pg / 002.schema.config.sql
1
2 DROP SCHEMA stats CASCADE;
3 DROP SCHEMA config CASCADE;
4
5 BEGIN;
6 CREATE SCHEMA stats;
7
8 CREATE SCHEMA config;
9 COMMENT ON SCHEMA config IS $$
10 /*
11  * Copyright (C) 2005  Georgia Public Library Service 
12  * Mike Rylander <mrylander@gmail.com>
13  *
14  * The config schema holds static configuration data for the
15  * Open-ILS installation.
16  *
17  * ****
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  */
29 $$;
30
31
32 CREATE TABLE config.bib_source (
33         id              SERIAL  PRIMARY KEY,
34         quality         INT     CHECK ( quality BETWEEN 0 AND 100 ),
35         source          TEXT    NOT NULL UNIQUE,
36         transcendant    BOOL    NOT NULL DEFAULT FALSE
37 );
38 COMMENT ON TABLE config.bib_source IS $$
39 /*
40  * Copyright (C) 2005  Georgia Public Library Service 
41  * Mike Rylander <mrylander@gmail.com>
42  *
43  * Valid sources of MARC records
44  *
45  * This is table is used to set up the relative "quality" of each
46  * MARC source, such as OCLC.
47  *
48  * ****
49  *
50  * This program is free software; you can redistribute it and/or
51  * modify it under the terms of the GNU General Public License
52  * as published by the Free Software Foundation; either version 2
53  * of the License, or (at your option) any later version.
54  *
55  * This program is distributed in the hope that it will be useful,
56  * but WITHOUT ANY WARRANTY; without even the implied warranty of
57  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
58  * GNU General Public License for more details.
59  */
60 $$;
61
62
63 INSERT INTO config.bib_source (quality, source) VALUES (90, 'oclc');
64 INSERT INTO config.bib_source (quality, source) VALUES (10, 'System Local');
65 INSERT INTO config.bib_source (quality, source, transcendant) VALUES (1, 'Project Gutenberg', TRUE);
66
67 CREATE TABLE config.standing (
68         id              SERIAL  PRIMARY KEY,
69         value           TEXT    NOT NULL UNIQUE
70 );
71 COMMENT ON TABLE config.standing IS $$
72 /*
73  * Copyright (C) 2005  Georgia Public Library Service 
74  * Mike Rylander <mrylander@gmail.com>
75  *
76  * Patron Standings
77  *
78  * This table contains the values that can be applied to a patron
79  * by a staff member.  These values should not be changed, other
80  * that for translation, as the ID column is currently a "magic
81  * number" in the source. :(
82  *
83  * ****
84  *
85  * This program is free software; you can redistribute it and/or
86  * modify it under the terms of the GNU General Public License
87  * as published by the Free Software Foundation; either version 2
88  * of the License, or (at your option) any later version.
89  *
90  * This program is distributed in the hope that it will be useful,
91  * but WITHOUT ANY WARRANTY; without even the implied warranty of
92  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
93  * GNU General Public License for more details.
94  */
95 $$;
96
97 INSERT INTO config.standing (value) VALUES ('Good');
98 INSERT INTO config.standing (value) VALUES ('Barred');
99
100
101 CREATE TABLE config.xml_transform (
102         name            TEXT    PRIMARY KEY,
103         namespace_uri   TEXT    NOT NULL UNIQUE,
104         prefix          TEXT    NOT NULL,
105         xslt            TEXT    NOT NULL
106 );
107 INSERT INTO config.xml_transform VALUES ( 'marcxml', 'http://www.loc.gov/MARC21/slim', 'marc', '---' );
108 INSERT INTO config.xml_transform VALUES ( 'mods', 'http://www.loc.gov/mods/', 'mods', '/home/miker/MARC21slim2MODS.xsl' );
109
110 CREATE TABLE config.metabib_field (
111         id              SERIAL  PRIMARY KEY,
112         field_class     TEXT    NOT NULL CHECK (lower(field_class) IN ('title','author','subject','keyword','series')),
113         name            TEXT    NOT NULL UNIQUE,
114         xpath           TEXT    NOT NULL,
115         weight          INT     NOT NULL DEFAULT 1,
116         format          TEXT    NOT NULL DEFAULT 'mods',
117         search          BOOL    NOT NULL DEFAULT TRUE,
118         facet           BOOL    NOT NULL DEFAULT FALSE
119 );
120 COMMENT ON TABLE config.metabib_field IS $$
121 /*
122  * Copyright (C) 2005  Georgia Public Library Service 
123  * Mike Rylander <mrylander@gmail.com>
124  *
125  * XPath used for WoRMing
126  *
127  * This table contains the XPath used to chop up MODS into it's
128  * indexable parts.  Each XPath entry is named and assigned to
129  * a "class" of either title, subject, author, keyword or series.
130  * 
131  *
132  * ****
133  *
134  * This program is free software; you can redistribute it and/or
135  * modify it under the terms of the GNU General Public License
136  * as published by the Free Software Foundation; either version 2
137  * of the License, or (at your option) any later version.
138  *
139  * This program is distributed in the hope that it will be useful,
140  * but WITHOUT ANY WARRANTY; without even the implied warranty of
141  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
142  * GNU General Public License for more details.
143  */
144 $$;
145
146
147 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'series', 'seriestitle', $$//mods:mods/mods:relatedItem[@type="series"]/mods:titleInfo$$ );
148 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'abbreviated', $$//mods:mods/mods:titleInfo[mods:title and (@type='abreviated')]$$ );
149 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'translated', $$//mods:mods/mods:titleInfo[mods:title and (@type='translated')]$$ );
150 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'uniform', $$//mods:mods/mods:titleInfo[mods:title and (@type='uniform')]$$ );
151 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'proper', $$//mods:mods/mods:titleInfo[mods:title and not (@type)]$$ );
152 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'corporate', $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
153 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'personal', $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
154 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'conference', $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
155 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'other', $$//mods:mods/mods:name[@type='personal']/mods:namePart[not(../mods:role)]$$ );
156 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'geographic', $$//mods:mods/mods:subject/mods:geographic$$ );
157 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'name', $$//mods:mods/mods:subject/mods:name$$ );
158 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'temporal', $$//mods:mods/mods:subject/mods:temporal$$ );
159 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'topic', $$//mods:mods/mods:subject/mods:topic$$ );
160 -- INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'genre', $$//mods:mods/mods:genre$$ );
161 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'keyword', 'keyword', $$//mods:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */
162
163
164
165 CREATE OR REPLACE FUNCTION oils_xml_transform ( TEXT, TEXT ) RETURNS TEXT AS $_$
166         SELECT  CASE    WHEN (SELECT COUNT(*) FROM config.xml_transform WHERE name = $2 AND xslt = '---') > 0 THEN $1
167                         ELSE xslt_process($1, (SELECT xslt FROM config.xml_transform WHERE name = $2))
168                 END;
169 $_$ LANGUAGE SQL STRICT IMMUTABLE;
170
171
172
173 CREATE TYPE biblio_field_vtype AS ( record BIGINT, field INT, content TEXT );
174 CREATE OR REPLACE FUNCTION biblio_field_table ( record BIGINT, field_list INT[] ) RETURNS SETOF biblio_field_vtype AS $_$
175 DECLARE
176         i INT;
177         rec biblio_field_vtype%ROWTYPE;
178 BEGIN
179         FOR i IN ARRAY_LOWER(field_list,1) .. ARRAY_UPPER(field_list,1) LOOP
180                 FOR rec IN      SELECT  DISTINCT r, field_list[i], BTRIM(REGEXP_REPLACE(REGEXP_REPLACE(f, E'\n', ' ', 'g'), '[ ]+', ' ', 'g'))
181                                   FROM  xpath_table_ns(
182                                                 'id',
183                                                 $$oils_xml_transform(marc,'$$ || (SELECT format FROM config.metabib_field WHERE id = field_list[i]) || $$')$$,
184                                                 'biblio.record_entry',
185                                                 (SELECT xpath FROM config.metabib_field WHERE id = field_list[i]),
186                                                 'id = ' || record,
187                                                 (SELECT x.prefix FROM config.xml_transform x JOIN config.metabib_field m ON (m.format = x.name) WHERE m.id = field_list[i]),
188                                                 (SELECT x.namespace_uri FROM config.xml_transform x JOIN config.metabib_field m ON (m.format = x.name) WHERE m.id = field_list[i])
189                                         ) AS t( r bigint, f text)
190                                   WHERE f IS NOT NULL LOOP
191                         RETURN NEXT rec;
192                 END LOOP;
193         END LOOP;
194 END;
195 $_$ LANGUAGE PLPGSQL;
196
197
198
199 CREATE OR REPLACE FUNCTION biblio_field_table ( record BIGINT, field INT ) RETURNS SETOF biblio_field_vtype AS $_$
200         SELECT * FROM biblio_field_table( $1, ARRAY[$2] )
201 $_$ LANGUAGE SQL;
202
203
204
205 CREATE TABLE config.non_cataloged_type (
206         id              SERIAL          PRIMARY KEY,
207         owning_lib      INT             NOT NULL, -- REFERENCES actor.org_unit (id),
208         name            TEXT            NOT NULL,
209         circ_duration   INTERVAL        NOT NULL DEFAULT '14 days'::INTERVAL,
210         in_house        BOOL            NOT NULL DEFAULT FALSE,
211         CONSTRAINT noncat_once_per_lib UNIQUE (owning_lib,name)
212 );
213 COMMENT ON TABLE config.non_cataloged_type IS $$
214 /*
215  * Copyright (C) 2005  Georgia Public Library Service 
216  * Mike Rylander <mrylander@gmail.com>
217  *
218  * Types of valid non-cataloged items.
219  *
220  *
221  * ****
222  *
223  * This program is free software; you can redistribute it and/or
224  * modify it under the terms of the GNU General Public License
225  * as published by the Free Software Foundation; either version 2
226  * of the License, or (at your option) any later version.
227  *
228  * This program is distributed in the hope that it will be useful,
229  * but WITHOUT ANY WARRANTY; without even the implied warranty of
230  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
231  * GNU General Public License for more details.
232  */
233 $$;
234
235
236 INSERT INTO config.non_cataloged_type ( owning_lib, name ) VALUES ( 1, 'Paperback Book' );
237
238 CREATE TABLE config.identification_type (
239         id              SERIAL  PRIMARY KEY,
240         name            TEXT    NOT NULL UNIQUE
241 );
242 COMMENT ON TABLE config.identification_type IS $$
243 /*
244  * Copyright (C) 2005  Georgia Public Library Service 
245  * Mike Rylander <mrylander@gmail.com>
246  *
247  * Types of valid patron identification.
248  *
249  * Each patron must display at least one valid form of identification
250  * in order to get a library card.  This table lists those forms.
251  * 
252  *
253  * ****
254  *
255  * This program is free software; you can redistribute it and/or
256  * modify it under the terms of the GNU General Public License
257  * as published by the Free Software Foundation; either version 2
258  * of the License, or (at your option) any later version.
259  *
260  * This program is distributed in the hope that it will be useful,
261  * but WITHOUT ANY WARRANTY; without even the implied warranty of
262  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
263  * GNU General Public License for more details.
264  */
265 $$;
266
267
268 INSERT INTO config.identification_type ( name ) VALUES ( 'Drivers License' );
269 INSERT INTO config.identification_type ( name ) VALUES ( 'SSN' );
270 INSERT INTO config.identification_type ( name ) VALUES ( 'Other' );
271
272 CREATE TABLE config.rule_circ_duration (
273         id              SERIAL          PRIMARY KEY,
274         name            TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
275         extended        INTERVAL        NOT NULL,
276         normal          INTERVAL        NOT NULL,
277         shrt            INTERVAL        NOT NULL,
278         max_renewals    INT             NOT NULL
279 );
280 COMMENT ON TABLE config.rule_circ_duration IS $$
281 /*
282  * Copyright (C) 2005  Georgia Public Library Service 
283  * Mike Rylander <mrylander@gmail.com>
284  *
285  * Circulation Duration rules
286  *
287  * Each circulation is given a duration based on one of these rules.
288  * 
289  *
290  * ****
291  *
292  * This program is free software; you can redistribute it and/or
293  * modify it under the terms of the GNU General Public License
294  * as published by the Free Software Foundation; either version 2
295  * of the License, or (at your option) any later version.
296  *
297  * This program is distributed in the hope that it will be useful,
298  * but WITHOUT ANY WARRANTY; without even the implied warranty of
299  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
300  * GNU General Public License for more details.
301  */
302 $$;
303
304 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '7_days_0_renew', '7 days', '7 days', '7 days', 0);
305 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '28_days_2_renew', '28 days', '28 days', '28 days', 2);
306 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '3_months_0_renew', '3 mons', '3 mons', '3 mons', 0);
307 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '3_days_1_renew', '3 days', '3 days', '3 days', 1);
308 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '2_months_2_renew', '2 mons', '2 mons', '2 mons', 2);
309 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '35_days_1_renew', '35 days', '35 days', '35 days', 1);
310 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '7_days_2_renew', '7 days', '7 days', '7 days', 2);
311 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '1_hour_2_renew', '1 hour', '1 hour', '1 hour', 2);
312 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '28_days_0_renew', '28 days', '28 days', '28 days', 0);
313 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '14_days_2_renew', '14 days', '14 days', '14 days', 2);
314
315
316 CREATE TABLE config.rule_max_fine (
317         id      SERIAL          PRIMARY KEY,
318         name    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
319         amount  NUMERIC(6,2)    NOT NULL
320 );
321 COMMENT ON TABLE config.rule_max_fine IS $$
322 /*
323  * Copyright (C) 2005  Georgia Public Library Service 
324  * Mike Rylander <mrylander@gmail.com>
325  *
326  * Circulation Max Fine rules
327  *
328  * Each circulation is given a maximum fine based on one of
329  * these rules.
330  * 
331  *
332  * ****
333  *
334  * This program is free software; you can redistribute it and/or
335  * modify it under the terms of the GNU General Public License
336  * as published by the Free Software Foundation; either version 2
337  * of the License, or (at your option) any later version.
338  *
339  * This program is distributed in the hope that it will be useful,
340  * but WITHOUT ANY WARRANTY; without even the implied warranty of
341  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
342  * GNU General Public License for more details.
343  */
344 $$;
345
346 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_min', 5.00);
347 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_mid', 10.00);
348 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_max', 100.00);
349 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_equip_min', 25.00);
350 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_equip_mid', 25.00);
351 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_equip_max', 100.00);
352
353
354 CREATE TABLE config.rule_recuring_fine (
355         id                      SERIAL          PRIMARY KEY,
356         name                    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
357         high                    NUMERIC(6,2)    NOT NULL,
358         normal                  NUMERIC(6,2)    NOT NULL,
359         low                     NUMERIC(6,2)    NOT NULL,
360         recurance_interval      INTERVAL        NOT NULL DEFAULT '1 day'::INTERVAL
361 );
362 COMMENT ON TABLE config.rule_recuring_fine IS $$
363 /*
364  * Copyright (C) 2005  Georgia Public Library Service 
365  * Mike Rylander <mrylander@gmail.com>
366  *
367  * Circulation Recuring Fine rules
368  *
369  * Each circulation is given a recuring fine amount based on one of
370  * these rules.  The recurance_interval should not be any shorter
371  * than the interval between runs of the fine_processor.pl script
372  * (which is run from CRON), or you could miss fines.
373  * 
374  *
375  * ****
376  *
377  * This program is free software; you can redistribute it and/or
378  * modify it under the terms of the GNU General Public License
379  * as published by the Free Software Foundation; either version 2
380  * of the License, or (at your option) any later version.
381  *
382  * This program is distributed in the hope that it will be useful,
383  * but WITHOUT ANY WARRANTY; without even the implied warranty of
384  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
385  * GNU General Public License for more details.
386  */
387 $$;
388
389 INSERT INTO config.rule_recuring_fine VALUES (DEFAULT, '10_cent_per_day', 0.50, 0.10, 0.10, '1 day');
390 INSERT INTO config.rule_recuring_fine VALUES (DEFAULT, '50_cent_per_day', 0.50, 0.50, 0.50, '1 day');
391
392
393 CREATE TABLE config.rule_age_hold_protect (
394         id      SERIAL          PRIMARY KEY,
395         name    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
396         age     INTERVAL        NOT NULL,
397         prox    INT             NOT NULL
398 );
399 COMMENT ON TABLE config.rule_age_hold_protect IS $$
400 /*
401  * Copyright (C) 2005  Georgia Public Library Service 
402  * Mike Rylander <mrylander@gmail.com>
403  *
404  * Hold Item Age Protection rules
405  *
406  * A hold request can only capture new(ish) items when they are
407  * within a particular proximity of the home_ou of the requesting
408  * user.  The proximity ('prox' column) is calculated by counting
409  * the number of tree edges beween the user's home_ou and the owning_lib
410  * of the copy that could fulfill the hold.
411  * 
412  *
413  * ****
414  *
415  * This program is free software; you can redistribute it and/or
416  * modify it under the terms of the GNU General Public License
417  * as published by the Free Software Foundation; either version 2
418  * of the License, or (at your option) any later version.
419  *
420  * This program is distributed in the hope that it will be useful,
421  * but WITHOUT ANY WARRANTY; without even the implied warranty of
422  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
423  * GNU General Public License for more details.
424  */
425 $$;
426
427 INSERT INTO config.rule_age_hold_protect VALUES (DEFAULT, '3month', '3 mons', 0);
428 INSERT INTO config.rule_age_hold_protect VALUES (DEFAULT, '6month', '6 mons', 2);
429
430
431 CREATE TABLE config.copy_status (
432         id              SERIAL  PRIMARY KEY,
433         name            TEXT    NOT NULL UNIQUE,
434         holdable        BOOL    NOT NULL DEFAULT FALSE
435 );
436 COMMENT ON TABLE config.copy_status IS $$
437 /*
438  * Copyright (C) 2005  Georgia Public Library Service 
439  * Mike Rylander <mrylander@gmail.com>
440  *
441  * Copy Statuses
442  *
443  * The available copy statuses, and whether a copy in that
444  * status is available for hold request capture.  0 (zero) is
445  * the only special number in this set, meaning that the item
446  * is available for imediate checkout, and is counted as available
447  * in the OPAC.
448  *
449  * Statuses with an ID below 100 are not removable, and have special
450  * meaning in the code.  Do not change them except to translate the
451  * textual name.
452  *
453  * You may add and remove statuses above 100, and these can be used
454  * to remove items from normal circulation without affecting the rest
455  * of the copy's values or it's location.
456  *
457  * ****
458  *
459  * This program is free software; you can redistribute it and/or
460  * modify it under the terms of the GNU General Public License
461  * as published by the Free Software Foundation; either version 2
462  * of the License, or (at your option) any later version.
463  *
464  * This program is distributed in the hope that it will be useful,
465  * but WITHOUT ANY WARRANTY; without even the implied warranty of
466  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
467  * GNU General Public License for more details.
468  */
469 $$;
470
471 INSERT INTO config.copy_status (id,name,holdable)       VALUES (0,'Available','t');
472 INSERT INTO config.copy_status (name,holdable)          VALUES ('Checked out','t');
473 INSERT INTO config.copy_status (name)                   VALUES ('Bindery');
474 INSERT INTO config.copy_status (name)                   VALUES ('Lost');
475 INSERT INTO config.copy_status (name)                   VALUES ('Missing');
476 INSERT INTO config.copy_status (name,holdable)          VALUES ('In process','t');
477 INSERT INTO config.copy_status (name,holdable)          VALUES ('In transit','t');
478 INSERT INTO config.copy_status (name,holdable)          VALUES ('Reshelving','t');
479 INSERT INTO config.copy_status (name,holdable)          VALUES ('On holds shelf','t');
480 INSERT INTO config.copy_status (name,holdable)          VALUES ('On order','t');
481 INSERT INTO config.copy_status (name)                   VALUES ('ILL');
482 INSERT INTO config.copy_status (name)                   VALUES ('Cataloging');
483 INSERT INTO config.copy_status (name)                   VALUES ('Reserves');
484 INSERT INTO config.copy_status (name)                   VALUES ('Discard/Weed');
485 INSERT INTO config.copy_status (name)                   VALUES ('Damaged');
486
487 SELECT SETVAL('config.copy_status_id_seq'::TEXT, 100);
488
489
490 CREATE TABLE config.net_access_level (
491         id      SERIAL          PRIMARY KEY,
492         name    TEXT            NOT NULL UNIQUE
493 );
494 COMMENT ON TABLE config.net_access_level IS $$
495 /*
496  * Copyright (C) 2005  Georgia Public Library Service 
497  * Mike Rylander <mrylander@gmail.com>
498  *
499  * Patron Network Access level
500  *
501  * This will be used to inform the in-library firewall of how much
502  * internet access the using patron should be allowed.
503  *
504  * ****
505  *
506  * This program is free software; you can redistribute it and/or
507  * modify it under the terms of the GNU General Public License
508  * as published by the Free Software Foundation; either version 2
509  * of the License, or (at your option) any later version.
510  *
511  * This program is distributed in the hope that it will be useful,
512  * but WITHOUT ANY WARRANTY; without even the implied warranty of
513  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
514  * GNU General Public License for more details.
515  */
516 $$;
517
518 INSERT INTO config.net_access_level (name) VALUES ('Filtered');
519 INSERT INTO config.net_access_level (name) VALUES ('Unfiltered');
520 INSERT INTO config.net_access_level (name) VALUES ('No Access');
521
522 CREATE TABLE config.audience_map (
523         code            TEXT    PRIMARY KEY,
524         value           TEXT    NOT NULL,
525         description     TEXT
526 );
527
528 COPY config.audience_map FROM STDIN;
529         Unknown or unspecified  The target audience for the item not known or not specified.
530 a       Preschool       The item is intended for children, approximate ages 0-5 years.
531 b       Primary The item is intended for children, approximate ages 6-8 years.
532 c       Pre-adolescent  The item is intended for young people, approximate ages 9-13 years.
533 d       Adolescent      The item is intended for young people, approximate ages 14-17 years.
534 e       Adult   The item is intended for adults.
535 f       Specialized     The item is aimed at a particular audience and the nature of the presentation makes the item of little interest to another audience.
536 g       General The item is of general interest and not aimed at an audience of a particular intellectual level.
537 j       Juvenile        The item is intended for children and young people, approximate ages 0-15 years.
538 \.
539
540
541 CREATE TABLE config.lit_form_map (
542         code            TEXT    PRIMARY KEY,
543         value           TEXT    NOT NULL,
544         description     TEXT
545 );
546
547 COPY config.lit_form_map FROM STDIN;
548 0       Not fiction (not further specified)     The item is not a work of fiction and no further identification of the literary form is desired
549 1       Fiction (not further specified) The item is a work of fiction and no further identification of the literary form is desired
550 c       Comic strips    \N
551 d       Dramas  \N
552 e       Essays  \N
553 f       Novels  \N
554 h       Humor, satires, etc.    The item is a humorous work, satire or of similar literary form.
555 i       Letters The item is a single letter or collection of correspondence.
556 j       Short stories   The item is a short story or collection of short stories.
557 m       Mixed forms     The item is a variety of literary forms (e.g., poetry and short stories).
558 p       Poetry  The item is a poem or collection of poems.
559 s       Speeches        The item is a speech or collection of speeches.
560 u       Unknown The literary form of the item is unknown.
561 \.
562
563 CREATE TABLE config.language_map (
564         code    TEXT    PRIMARY KEY,
565         value   TEXT    NOT NULL
566 );
567
568 COPY config.language_map FROM STDIN;
569 aar     Afar
570 abk     Abkhaz
571 ace     Achinese
572 ach     Acoli
573 ada     Adangme
574 ady     Adygei
575 afa     Afroasiatic (Other)
576 afh     Afrihili (Artificial language)
577 afr     Afrikaans
578 -ajm    Aljamía
579 aka     Akan
580 akk     Akkadian
581 alb     Albanian
582 ale     Aleut
583 alg     Algonquian (Other)
584 amh     Amharic
585 ang     English, Old (ca. 450-1100)
586 apa     Apache languages
587 ara     Arabic
588 arc     Aramaic
589 arg     Aragonese Spanish
590 arm     Armenian
591 arn     Mapuche
592 arp     Arapaho
593 art     Artificial (Other)
594 arw     Arawak
595 asm     Assamese
596 ast     Bable
597 ath     Athapascan (Other)
598 aus     Australian languages
599 ava     Avaric
600 ave     Avestan
601 awa     Awadhi
602 aym     Aymara
603 aze     Azerbaijani
604 bad     Banda
605 bai     Bamileke languages
606 bak     Bashkir
607 bal     Baluchi
608 bam     Bambara
609 ban     Balinese
610 baq     Basque
611 bas     Basa
612 bat     Baltic (Other)
613 bej     Beja
614 bel     Belarusian
615 bem     Bemba
616 ben     Bengali
617 ber     Berber (Other)
618 bho     Bhojpuri
619 bih     Bihari
620 bik     Bikol
621 bin     Edo
622 bis     Bislama
623 bla     Siksika
624 bnt     Bantu (Other)
625 bos     Bosnian
626 bra     Braj
627 bre     Breton
628 btk     Batak
629 bua     Buriat
630 bug     Bugis
631 bul     Bulgarian
632 bur     Burmese
633 cad     Caddo
634 cai     Central American Indian (Other)
635 -cam    Khmer
636 car     Carib
637 cat     Catalan
638 cau     Caucasian (Other)
639 ceb     Cebuano
640 cel     Celtic (Other)
641 cha     Chamorro
642 chb     Chibcha
643 che     Chechen
644 chg     Chagatai
645 chi     Chinese
646 chk     Truk
647 chm     Mari
648 chn     Chinook jargon
649 cho     Choctaw
650 chp     Chipewyan
651 chr     Cherokee
652 chu     Church Slavic
653 chv     Chuvash
654 chy     Cheyenne
655 cmc     Chamic languages
656 cop     Coptic
657 cor     Cornish
658 cos     Corsican
659 cpe     Creoles and Pidgins, English-based (Other)
660 cpf     Creoles and Pidgins, French-based (Other)
661 cpp     Creoles and Pidgins, Portuguese-based (Other)
662 cre     Cree
663 crh     Crimean Tatar
664 crp     Creoles and Pidgins (Other)
665 cus     Cushitic (Other)
666 cze     Czech
667 dak     Dakota
668 dan     Danish
669 dar     Dargwa
670 day     Dayak
671 del     Delaware
672 den     Slave
673 dgr     Dogrib
674 din     Dinka
675 div     Divehi
676 doi     Dogri
677 dra     Dravidian (Other)
678 dua     Duala
679 dum     Dutch, Middle (ca. 1050-1350)
680 dut     Dutch
681 dyu     Dyula
682 dzo     Dzongkha
683 efi     Efik
684 egy     Egyptian
685 eka     Ekajuk
686 elx     Elamite
687 eng     English
688 enm     English, Middle (1100-1500)
689 epo     Esperanto
690 -esk    Eskimo languages
691 -esp    Esperanto
692 est     Estonian
693 -eth    Ethiopic
694 ewe     Ewe
695 ewo     Ewondo
696 fan     Fang
697 fao     Faroese
698 -far    Faroese
699 fat     Fanti
700 fij     Fijian
701 fin     Finnish
702 fiu     Finno-Ugrian (Other)
703 fon     Fon
704 fre     French
705 -fri    Frisian
706 frm     French, Middle (ca. 1400-1600)
707 fro     French, Old (ca. 842-1400)
708 fry     Frisian
709 ful     Fula
710 fur     Friulian
711 gaa     Gã
712 -gae    Scottish Gaelic
713 -gag    Galician
714 -gal    Oromo
715 gay     Gayo
716 gba     Gbaya
717 gem     Germanic (Other)
718 geo     Georgian
719 ger     German
720 gez     Ethiopic
721 gil     Gilbertese
722 gla     Scottish Gaelic
723 gle     Irish
724 glg     Galician
725 glv     Manx
726 gmh     German, Middle High (ca. 1050-1500)
727 goh     German, Old High (ca. 750-1050)
728 gon     Gondi
729 gor     Gorontalo
730 got     Gothic
731 grb     Grebo
732 grc     Greek, Ancient (to 1453)
733 gre     Greek, Modern (1453- )
734 grn     Guarani
735 -gua    Guarani
736 guj     Gujarati
737 gwi     Gwich'in
738 hai     Haida
739 hat     Haitian French Creole
740 hau     Hausa
741 haw     Hawaiian
742 heb     Hebrew
743 her     Herero
744 hil     Hiligaynon
745 him     Himachali
746 hin     Hindi
747 hit     Hittite
748 hmn     Hmong
749 hmo     Hiri Motu
750 hun     Hungarian
751 hup     Hupa
752 iba     Iban
753 ibo     Igbo
754 ice     Icelandic
755 ido     Ido
756 iii     Sichuan Yi
757 ijo     Ijo
758 iku     Inuktitut
759 ile     Interlingue
760 ilo     Iloko
761 ina     Interlingua (International Auxiliary Language Association)
762 inc     Indic (Other)
763 ind     Indonesian
764 ine     Indo-European (Other)
765 inh     Ingush
766 -int    Interlingua (International Auxiliary Language Association)
767 ipk     Inupiaq
768 ira     Iranian (Other)
769 -iri    Irish
770 iro     Iroquoian (Other)
771 ita     Italian
772 jav     Javanese
773 jpn     Japanese
774 jpr     Judeo-Persian
775 jrb     Judeo-Arabic
776 kaa     Kara-Kalpak
777 kab     Kabyle
778 kac     Kachin
779 kal     Kalâtdlisut
780 kam     Kamba
781 kan     Kannada
782 kar     Karen
783 kas     Kashmiri
784 kau     Kanuri
785 kaw     Kawi
786 kaz     Kazakh
787 kbd     Kabardian
788 kha     Khasi
789 khi     Khoisan (Other)
790 khm     Khmer
791 kho     Khotanese
792 kik     Kikuyu
793 kin     Kinyarwanda
794 kir     Kyrgyz
795 kmb     Kimbundu
796 kok     Konkani
797 kom     Komi
798 kon     Kongo
799 kor     Korean
800 kos     Kusaie
801 kpe     Kpelle
802 kro     Kru
803 kru     Kurukh
804 kua     Kuanyama
805 kum     Kumyk
806 kur     Kurdish
807 -kus    Kusaie
808 kut     Kutenai
809 lad     Ladino
810 lah     Lahnda
811 lam     Lamba
812 -lan    Occitan (post-1500)
813 lao     Lao
814 -lap    Sami
815 lat     Latin
816 lav     Latvian
817 lez     Lezgian
818 lim     Limburgish
819 lin     Lingala
820 lit     Lithuanian
821 lol     Mongo-Nkundu
822 loz     Lozi
823 ltz     Letzeburgesch
824 lua     Luba-Lulua
825 lub     Luba-Katanga
826 lug     Ganda
827 lui     Luiseño
828 lun     Lunda
829 luo     Luo (Kenya and Tanzania)
830 lus     Lushai
831 mac     Macedonian
832 mad     Madurese
833 mag     Magahi
834 mah     Marshallese
835 mai     Maithili
836 mak     Makasar
837 mal     Malayalam
838 man     Mandingo
839 mao     Maori
840 map     Austronesian (Other)
841 mar     Marathi
842 mas     Masai
843 -max    Manx
844 may     Malay
845 mdr     Mandar
846 men     Mende
847 mga     Irish, Middle (ca. 1100-1550)
848 mic     Micmac
849 min     Minangkabau
850 mis     Miscellaneous languages
851 mkh     Mon-Khmer (Other)
852 -mla    Malagasy
853 mlg     Malagasy
854 mlt     Maltese
855 mnc     Manchu
856 mni     Manipuri
857 mno     Manobo languages
858 moh     Mohawk
859 mol     Moldavian
860 mon     Mongolian
861 mos     Mooré
862 mul     Multiple languages
863 mun     Munda (Other)
864 mus     Creek
865 mwr     Marwari
866 myn     Mayan languages
867 nah     Nahuatl
868 nai     North American Indian (Other)
869 nap     Neapolitan Italian
870 nau     Nauru
871 nav     Navajo
872 nbl     Ndebele (South Africa)
873 nde     Ndebele (Zimbabwe)  
874 ndo     Ndonga
875 nds     Low German
876 nep     Nepali
877 new     Newari
878 nia     Nias
879 nic     Niger-Kordofanian (Other)
880 niu     Niuean
881 nno     Norwegian (Nynorsk)
882 nob     Norwegian (Bokmål)
883 nog     Nogai
884 non     Old Norse
885 nor     Norwegian
886 nso     Northern Sotho
887 nub     Nubian languages
888 nya     Nyanja
889 nym     Nyamwezi
890 nyn     Nyankole
891 nyo     Nyoro
892 nzi     Nzima
893 oci     Occitan (post-1500)
894 oji     Ojibwa
895 ori     Oriya
896 orm     Oromo
897 osa     Osage
898 oss     Ossetic
899 ota     Turkish, Ottoman
900 oto     Otomian languages
901 paa     Papuan (Other)
902 pag     Pangasinan
903 pal     Pahlavi
904 pam     Pampanga
905 pan     Panjabi
906 pap     Papiamento
907 pau     Palauan
908 peo     Old Persian (ca. 600-400 B.C.)
909 per     Persian
910 phi     Philippine (Other)
911 phn     Phoenician
912 pli     Pali
913 pol     Polish
914 pon     Ponape
915 por     Portuguese
916 pra     Prakrit languages
917 pro     Provençal (to 1500)
918 pus     Pushto
919 que     Quechua
920 raj     Rajasthani
921 rap     Rapanui
922 rar     Rarotongan
923 roa     Romance (Other)
924 roh     Raeto-Romance
925 rom     Romani
926 rum     Romanian
927 run     Rundi
928 rus     Russian
929 sad     Sandawe
930 sag     Sango (Ubangi Creole)
931 sah     Yakut
932 sai     South American Indian (Other)
933 sal     Salishan languages
934 sam     Samaritan Aramaic
935 san     Sanskrit
936 -sao    Samoan
937 sas     Sasak
938 sat     Santali
939 scc     Serbian
940 sco     Scots
941 scr     Croatian
942 sel     Selkup
943 sem     Semitic (Other)
944 sga     Irish, Old (to 1100)
945 sgn     Sign languages
946 shn     Shan
947 -sho    Shona
948 sid     Sidamo
949 sin     Sinhalese
950 sio     Siouan (Other)
951 sit     Sino-Tibetan (Other)
952 sla     Slavic (Other)
953 slo     Slovak
954 slv     Slovenian
955 sma     Southern Sami
956 sme     Northern Sami
957 smi     Sami
958 smj     Lule Sami
959 smn     Inari Sami
960 smo     Samoan
961 sms     Skolt Sami
962 sna     Shona
963 snd     Sindhi
964 -snh    Sinhalese
965 snk     Soninke
966 sog     Sogdian
967 som     Somali
968 son     Songhai
969 sot     Sotho
970 spa     Spanish
971 srd     Sardinian
972 srr     Serer
973 ssa     Nilo-Saharan (Other)
974 -sso    Sotho
975 ssw     Swazi
976 suk     Sukuma
977 sun     Sundanese
978 sus     Susu
979 sux     Sumerian
980 swa     Swahili
981 swe     Swedish
982 -swz    Swazi
983 syr     Syriac
984 -tag    Tagalog
985 tah     Tahitian
986 tai     Tai (Other)
987 -taj    Tajik
988 tam     Tamil
989 -tar    Tatar
990 tat     Tatar
991 tel     Telugu
992 tem     Temne
993 ter     Terena
994 tet     Tetum
995 tgk     Tajik
996 tgl     Tagalog
997 tha     Thai
998 tib     Tibetan
999 tig     Tigré
1000 tir     Tigrinya
1001 tiv     Tiv
1002 tkl     Tokelauan
1003 tli     Tlingit
1004 tmh     Tamashek
1005 tog     Tonga (Nyasa)
1006 ton     Tongan
1007 tpi     Tok Pisin
1008 -tru    Truk
1009 tsi     Tsimshian
1010 tsn     Tswana
1011 tso     Tsonga
1012 -tsw    Tswana
1013 tuk     Turkmen
1014 tum     Tumbuka
1015 tup     Tupi languages
1016 tur     Turkish
1017 tut     Altaic (Other)
1018 tvl     Tuvaluan
1019 twi     Twi
1020 tyv     Tuvinian
1021 udm     Udmurt
1022 uga     Ugaritic
1023 uig     Uighur
1024 ukr     Ukrainian
1025 umb     Umbundu
1026 und     Undetermined
1027 urd     Urdu
1028 uzb     Uzbek
1029 vai     Vai
1030 ven     Venda
1031 vie     Vietnamese
1032 vol     Volapük
1033 vot     Votic
1034 wak     Wakashan languages
1035 wal     Walamo
1036 war     Waray
1037 was     Washo
1038 wel     Welsh
1039 wen     Sorbian languages
1040 wln     Walloon
1041 wol     Wolof
1042 xal     Kalmyk
1043 xho     Xhosa
1044 yao     Yao (Africa)
1045 yap     Yapese
1046 yid     Yiddish
1047 yor     Yoruba
1048 ypk     Yupik languages
1049 zap     Zapotec
1050 zen     Zenaga
1051 zha     Zhuang
1052 znd     Zande
1053 zul     Zulu
1054 zun     Zuni
1055 \.
1056
1057 CREATE TABLE config.item_form_map (
1058         code    TEXT    PRIMARY KEY,
1059         value   TEXT    NOT NULL
1060 );
1061
1062 COPY config.item_form_map FROM STDIN;
1063 a       Microfilm
1064 b       Microfiche
1065 c       Microopaque
1066 d       Large print
1067 f       Braille
1068 r       Regular print reproduction
1069 s       Electronic
1070 \.
1071
1072 CREATE TABLE config.item_type_map (
1073         code    TEXT    PRIMARY KEY,
1074         value   TEXT    NOT NULL
1075 );
1076
1077 COPY config.item_type_map FROM STDIN;
1078 a       Language material
1079 t       Manuscript language material
1080 g       Projected medium
1081 k       Two-dimensional nonprojectable graphic
1082 r       Three-dimensional artifact or naturally occurring object
1083 o       Kit
1084 p       Mixed materials
1085 e       Cartographic material
1086 f       Manuscript cartographic material
1087 c       Notated music
1088 d       Manuscript notated music
1089 i       Nonmusical sound recording
1090 j       Musical sound recording
1091 m       Computer file
1092 \.
1093
1094 COMMIT;
1095