[open-ils-commits] r10623 - in trunk/Open-ILS/src: perlmods/OpenILS/Application sql/Pg

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 17 14:17:23 EDT 2008


Author: dbs
Date: 2008-09-17 14:17:19 -0400 (Wed, 17 Sep 2008)
New Revision: 10623

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Complete the move to MODS32


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2008-09-17 17:49:32 UTC (rev 10622)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2008-09-17 18:17:19 UTC (rev 10623)
@@ -20,6 +20,7 @@
 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 @@
 			$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')

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2008-09-17 17:49:32 UTC (rev 10622)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2008-09-17 18:17:19 UTC (rev 10623)
@@ -119,7 +119,7 @@
 	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
 );

Modified: trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql	2008-09-17 17:49:32 UTC (rev 10622)
+++ trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql	2008-09-17 18:17:19 UTC (rev 10623)
@@ -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');

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2008-09-17 17:49:32 UTC (rev 10622)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2008-09-17 18:17:19 UTC (rev 10623)
@@ -12,37 +12,37 @@
 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);



More information about the open-ils-commits mailing list