Paste number 66999: bonehead mods32

Index of paste annotations: 1

Paste number 66999: bonehead mods32
Pasted by: dbs
When:9 months, 2 weeks ago
Share:Tweet this! | http://paste.lisp.org/+1FP3
Channel:#openils-evergreen
Paste contents:
Raw Source | XML | Display As
So, are there any obvious bits that I'm missing? Running an ingest (via marc2bre / direct_ingest) results in namespace errors - although I was last looking at this around 1:45 am so boneheadedness is entirely possible.

"""""""""

Index: Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- Open-ILS/src/sql/Pg/002.schema.config.sql	(revision 10607)
+++ Open-ILS/src/sql/Pg/002.schema.config.sql	(working copy)
@@ -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
 );
Index: Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- Open-ILS/src/sql/Pg/950.data.seed-values.sql	(revision 10607)
+++ Open-ILS/src/sql/Pg/950.data.seed-values.sql	(working copy)
@@ -24,11 +24,11 @@
 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES 
     ( 'title', 'proper', $$//mods:mods/mods:titleInfo[mods: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', $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods: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', $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods: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', $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods: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)]$$ );
 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES 
Index: Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql
===================================================================
--- Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql	(revision 10607)
+++ Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql	(working copy)
@@ -1,2 +1,20 @@
 /* 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';
Index: Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	(revision 10607)
+++ Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	(working copy)
@@ -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')

Annotations for this paste:

Annotation number 1: direct_ingest error with patch in place
Pasted by: dbs
When:9 months, 2 weeks ago
Share:Tweet this! | http://paste.lisp.org/+1FP3#1
Paste contents:
Raw Source | Display As
Couldn't process record: Undefined namespace prefix
xmlXPathCompiledEval: evaluation failed

 >>> {"__c":"bre","__p":[null,null,null,null,null,"t","now",1,"f","now",1,null,"776677","IMPORT-1221663632.68846","<record    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"    xsi:schemaLocation=\"http://www.loc.gov/MARC21/slim http://www.loc.gov/ standards/marcxml/schema/MARC21slim.xsd\"    xmlns=\"http://www.loc.gov/MARC21/slim\"><leader>01314cas  2200133   4500</leader><controlfield tag=\"008\">060821n                            eng u</controlfield><datafield tag=\"022\" ind1=\" \" ind2=\" \"><subfield code=\"a\">1074-9187</subfield></datafield><datafield tag=\"040\" ind1=\" \" ind2=\" \"><subfield code=\"d\">UtOrBLW</subfield></datafield><datafield tag=\"245\" ind1=\"0\" ind2=\"0\"><subfield code=\"a\">Villanova Sports &amp; Entertainment Law Journal </subfield><subfield code=\"h\">[electronic resource].</subfield></datafield><datafield tag=\"260\" ind1=\" \" ind2=\" \"><subfield code=\"a\"> Villanova, PA   :</subfield><subfield code=\"b\">Villanova University School of Law</subfield></datafield><datafield tag=\"520\" ind1=\" \" ind2=\" \"><subfield code=\"a\">The Villanova Sports and Entertainment Law Journal is a national legal periodical published and edited twice per year by a staff of students chosen for membership based on their performance in an Open-Writing Competition. The Journal is committed to publishing scholarly articles on topics of importance in the sports and entertainment law fields. It serves as an interpretative guide and research tool for practitioners, academics and students on issues of law in sports and entertainment. The Journal explains the significance of recent changes or developments as well as addresses the future of law. Past volumes have included articles on copyright infringement, ERISA, gender equity, antitrust, collective bargaining, and regulation of indecent speech. Source: http://www.law.vill.edu/scholarlyresources/journals/</subfield></datafield><datafield tag=\"596\" ind1=\" \" ind2=\" \"><subfield code=\"a\">1</subfield></datafield><datafield tag=\"856\" ind1=\"4\" ind2=\"0\"><subfield code=\"z\">Available online</subfield><subfield code=\"u\">http://librweb.laurentian.ca/login?url=http://heinonline.org/HOL/Index?index=journals/vse&amp;collection=journals</subfield></datafield><datafield tag=\"901\" ind1=\" \" ind2=\" \"><subfield code=\"a\">776677</subfield><subfield code=\"b\">System</subfield><subfield code=\"c\">776677</subfield></datafield></record>",null,null,"System","776677"]}

Colorize as:
Show Line Numbers
Index of paste annotations: 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.