[open-ils-commits] r16623 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jun 8 09:46:35 EDT 2010


Author: miker
Date: 2010-06-08 09:46:33 -0400 (Tue, 08 Jun 2010)
New Revision: 16623

Added:
   trunk/Open-ILS/src/sql/Pg/954.data.marc21expand880.sql
   trunk/Open-ILS/src/sql/Pg/upgrade/0299.data.marc21expand880.sql
Modified:
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Patch from Galen Charlton:

[This] patch adds a new XSL transform for indexing purpose that converts MARC21 880 fields (which are used for alternate graphic representations, i.e., vernacular representations of foreign language strings) to the base tags.

For example, if a MARC record for a Chinese book has

245.00 $6 880-01 $a Ba shi san nian duan pian xiao shuo xuan
880.00 $6 245-01/$1 $a\u516b\u5341\u4e09\u5e74\u77ed\u7bc7\u5c0f\u8aaa\u9078

this stylesheet will transform it to the equivalent of

245.00 $6 880-01 $a Ba shi san nian duan pian xiao shuo xuan
245.00 $6 245-01/$1 $a\u516b\u5341\u4e09\u5e74\u77ed\u7bc7\u5c0f\u8aaa\u9078

This allows an indexing XPath like //marc:datafield[@tag='245']/marc:subfield[@code='a'] to bring in both the vernacular and transliterated versions of the 245$a.

[ED: pretend the \u-encoded unicode are real characters ... curse you, Chrome, for not giving me the raw string!]



Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-06-07 21:28:59 UTC (rev 16622)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-06-08 13:46:33 UTC (rev 16623)
@@ -65,7 +65,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0298'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0299'); -- Galen Charlton
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-06-07 21:28:59 UTC (rev 16622)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-06-08 13:46:33 UTC (rev 16623)
@@ -24,6 +24,7 @@
 INSERT INTO config.xml_transform VALUES ( 'mods3', 'http://www.loc.gov/mods/v3', 'mods3', '');
 INSERT INTO config.xml_transform VALUES ( 'mods32', 'http://www.loc.gov/mods/v3', 'mods32', '');
 INSERT INTO config.xml_transform VALUES ( 'mods33', 'http://www.loc.gov/mods/v3', 'mods33', '');
+INSERT INTO config.xml_transform VALUES ( 'marc21expand880', 'http://www.loc.gov/MARC21/slim', 'marc', '' );
 
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES 
     (1, 'series', 'seriestitle', oils_i18n_gettext(1, 'Series Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo$$, TRUE );

Added: trunk/Open-ILS/src/sql/Pg/954.data.marc21expand880.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/954.data.marc21expand880.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/954.data.marc21expand880.sql	2010-06-08 13:46:33 UTC (rev 16623)
@@ -0,0 +1,62 @@
+UPDATE config.xml_transform SET xslt = $$<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:marc="http://www.loc.gov/MARC21/slim"
+    version="1.0">
+<!--
+Copyright (C) 2010  Equinox Software, Inc.
+Galen Charlton <gmc at esilibrary.cOM.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+marc21_expand_880.xsl - stylesheet used during indexing to
+                        map alternative graphical representations
+                        of MARC fields stored in 880 fields
+                        to the corresponding tag name and value.
+
+For example, if a MARC record for a Chinese book has
+
+245.00 $6 880-01 $a Ba shi san nian duan pian xiao shuo xuan
+880.00 $6 245-01/$1 $a八十三年短篇小說選
+
+this stylesheet will transform it to the equivalent of
+
+245.00 $6 880-01 $a Ba shi san nian duan pian xiao shuo xuan
+245.00 $6 245-01/$1 $a八十三年短篇小說選
+
+-->
+    <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
+
+    <xsl:template match="@*|node()">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|node()"/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="//marc:datafield[@tag='880']">
+        <xsl:if test="./marc:subfield[@code='6'] and string-length(./marc:subfield[@code='6']) &gt;= 6">
+            <marc:datafield>
+                <xsl:attribute name="tag">
+                    <xsl:value-of select="substring(./marc:subfield[@code='6'], 1, 3)" />
+                </xsl:attribute>
+                <xsl:attribute name="ind1">
+                    <xsl:value-of select="@ind1" />
+                </xsl:attribute>
+                <xsl:attribute name="ind2">
+                    <xsl:value-of select="@ind2" />
+                </xsl:attribute>
+                <xsl:apply-templates />
+            </marc:datafield>
+        </xsl:if>
+    </xsl:template>
+    
+</xsl:stylesheet>$$
+where name = 'marc21expand880';

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0299.data.marc21expand880.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0299.data.marc21expand880.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0299.data.marc21expand880.sql	2010-06-08 13:46:33 UTC (rev 16623)
@@ -0,0 +1,68 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0299'); -- Galen Charlton
+
+insert INTO CONFIG.xml_transform(name, namespace_uri, prefix, xslt)
+VALUES ('marc21expand880', 'http://www.loc.gov/MARC21/slim', 'marc', $$<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:marc="http://www.loc.gov/MARC21/slim"
+    version="1.0">
+<!--
+Copyright (C) 2010  Equinox Software, Inc.
+Galen Charlton <gmc at esilibrary.cOM.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+marc21_expand_880.xsl - stylesheet used during indexing to
+                        map alternative graphical representations
+                        of MARC fields stored in 880 fields
+                        to the corresponding tag name and value.
+
+For example, if a MARC record for a Chinese book has
+
+245.00 $6 880-01 $a Ba shi san nian duan pian xiao shuo xuan
+880.00 $6 245-01/$1 $a八十三年短篇小說選
+
+this stylesheet will transform it to the equivalent of
+
+245.00 $6 880-01 $a Ba shi san nian duan pian xiao shuo xuan
+245.00 $6 245-01/$1 $a八十三年短篇小說選
+
+-->
+    <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
+
+    <xsl:template match="@*|node()">
+        <xsl:copy>
+            <xsl:apply-templates select="@*|node()"/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="//marc:datafield[@tag='880']">
+        <xsl:if test="./marc:subfield[@code='6'] and string-length(./marc:subfield[@code='6']) &gt;= 6">
+            <marc:datafield>
+                <xsl:attribute name="tag">
+                    <xsl:value-of select="substring(./marc:subfield[@code='6'], 1, 3)" />
+                </xsl:attribute>
+                <xsl:attribute name="ind1">
+                    <xsl:value-of select="@ind1" />
+                </xsl:attribute>
+                <xsl:attribute name="ind2">
+                    <xsl:value-of select="@ind2" />
+                </xsl:attribute>
+                <xsl:apply-templates />
+            </marc:datafield>
+        </xsl:if>
+    </xsl:template>
+    
+</xsl:stylesheet>$$);
+
+COMMIT;



More information about the open-ils-commits mailing list