From e99748e9a1bd91030259dee936b8d3b19b6f90db Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 17 Sep 2008 18:17:19 +0000 Subject: [PATCH] Complete the move to MODS32 git-svn-id: svn://svn.open-ils.org/ILS/trunk@10623 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Ingest.pm | 6 ++++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql | 20 ++++++++++++++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 32 +++++++++++----------- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm b/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm index daee2c92c2..e5e21f737c 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm @@ -20,6 +20,7 @@ use XML::LibXSLT; use Time::HiRes qw(time); our %supported_formats = ( + mods32 => {ns => 'http://www.loc.gov/mods/v3'}, mods3 => {ns => 'http://www.loc.gov/mods/v3'}, mods => {ns => 'http://www.loc.gov/mods/'}, marcxml => {ns => 'http://www.loc.gov/MARC21/slim'}, @@ -67,6 +68,11 @@ sub post_init { $supported_formats{mods3}{xslt} = $xslt->parse_stylesheet( $xslt_doc ); } + unless ($supported_formats{mods32}{xslt}) { + $log->debug("Loading MODS v32 XSLT", DEBUG); + my $xslt_doc = $parser->parse_file( $xsldir . "/MARC21slim2MODS32.xsl"); + $supported_formats{mods32}{xslt} = $xslt->parse_stylesheet( $xslt_doc ); + } my $req = OpenSRF::AppSession ->create('open-ils.cstore') diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 80c9ab36d7..57f2c78e28 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -119,7 +119,7 @@ CREATE TABLE config.metabib_field ( name TEXT NOT NULL, xpath TEXT NOT NULL, weight INT NOT NULL DEFAULT 1, - format TEXT NOT NULL DEFAULT 'mods', + format TEXT NOT NULL DEFAULT 'mods32', search_field BOOL NOT NULL DEFAULT TRUE, facet_field BOOL NOT NULL DEFAULT FALSE ); diff --git a/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql index 3da5b0d0b3..fcf439619a 100644 --- a/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql @@ -1,2 +1,22 @@ /* Enable LIKE to use an index for database clusters with locales other than C or POSIX */ CREATE INDEX authority_full_rec_value_tpo_index ON authority.full_rec (value text_pattern_ops); + +/* Upgrade to MODS32 for transforms */ +ALTER TABLE config.metabib_field + ALTER COLUMN format SET DEFAULT 'mods32'; +UPDATE config.metabib_field + SET format = 'mods32'; + +/* Update index definitions to MODS32-compliant XPaths */ +UPDATE config.metabib_field + SET xpath = $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods:roleTerm[text()='creator']]$$ + WHERE field_class = 'author' AND name = 'corporate'; +UPDATE config.metabib_field + SET xpath = $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods:roleTerm[text()='creator']]$$ + WHERE field_class = 'author' AND name = 'personal'; +UPDATE config.metabib_field + SET xpath = $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods:roleTerm[text()='creator']]$$ + WHERE field_class = 'author' AND name = 'conference'; +/* And they all want mods32: as their prefix */ +UPDATE config.metabib_field + SET xpath = regexp_replace(xpath, 'mods:', 'mods32:', 'g'); diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 07cbfe1a7f..a83a33d4d3 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -12,37 +12,37 @@ INSERT INTO config.standing (id, value) VALUES (2, oils_i18n_gettext(2, 'Barred' SELECT SETVAL('config.standing_id_seq'::TEXT, 100); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'series', 'seriestitle', $$//mods:mods/mods:relatedItem[@type="series"]/mods:titleInfo$$ ); + ( 'series', 'seriestitle', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'title', 'abbreviated', $$//mods:mods/mods:titleInfo[mods:title and (@type='abbreviated')]$$ ); + ( 'title', 'abbreviated', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='abbreviated')]$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'title', 'translated', $$//mods:mods/mods:titleInfo[mods:title and (@type='translated')]$$ ); + ( 'title', 'translated', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='translated')]$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'title', 'alternative', $$//mods:mods/mods:titleInfo[mods:title and (@type='alternative')]$$ ); + ( 'title', 'alternative', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative')]$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'title', 'uniform', $$//mods:mods/mods:titleInfo[mods:title and (@type='uniform')]$$ ); + ( 'title', 'uniform', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform')]$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'title', 'proper', $$//mods:mods/mods:titleInfo[mods:title and not (@type)]$$ ); + ( 'title', 'proper', $$//mods32:mods/mods32:titleInfo[mods32:title and not (@type)]$$ ); 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']]$$ ); + ( 'author', 'corporate', $$//mods32:mods/mods32:name[@type='corporate']/mods32:namePart[../mods32:role/mods32:roleTerm[text()='creator']]$$ ); 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']]$$ ); + ( 'author', 'personal', $$//mods32:mods/mods32:name[@type='personal']/mods32:namePart[../mods32:role/mods32:roleTerm[text()='creator']]$$ ); 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']]$$ ); + ( 'author', 'conference', $$//mods32:mods/mods32:name[@type='conference']/mods32:namePart[../mods32:role/mods32:roleTerm[text()='creator']]$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'author', 'other', $$//mods:mods/mods:name[@type='personal']/mods:namePart[not(../mods:role)]$$ ); + ( 'author', 'other', $$//mods32:mods/mods32:name[@type='personal']/mods32:namePart[not(../mods32:role)]$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'subject', 'geographic', $$//mods:mods/mods:subject/mods:geographic$$ ); + ( 'subject', 'geographic', $$//mods32:mods/mods32:subject/mods32:geographic$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'subject', 'name', $$//mods:mods/mods:subject/mods:name$$ ); + ( 'subject', 'name', $$//mods32:mods/mods32:subject/mods32:name$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'subject', 'temporal', $$//mods:mods/mods:subject/mods:temporal$$ ); + ( 'subject', 'temporal', $$//mods32:mods/mods32:subject/mods32:temporal$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'subject', 'topic', $$//mods:mods/mods:subject/mods:topic$$ ); + ( 'subject', 'topic', $$//mods32:mods/mods32:subject/mods32:topic$$ ); --INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES --- ( field_class, name, xpath ) VALUES ( 'subject', 'genre', $$//mods:mods/mods:genre$$ ); +-- ( field_class, name, xpath ) VALUES ( 'subject', 'genre', $$//mods32:mods/mods32:genre$$ ); INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES - ( 'keyword', 'keyword', $$//mods:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */; + ( 'keyword', 'keyword', $$//mods32:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */; INSERT INTO config.non_cataloged_type ( id, owning_lib, name ) VALUES ( 1, 1, oils_i18n_gettext(1, 'Paperback Book', 'cnct', 'name') ); SELECT SETVAL('config.non_cataloged_type_id_seq'::TEXT, 100); -- 2.11.0