From: Lebbeous Fogle-Weekley Date: Mon, 13 May 2013 20:14:37 +0000 (-0400) Subject: Extensions to our MODS32 stylesheet to capture all possible NFI in fields X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=37f08768549953a531a79eb85c8a205f4ca80088;p=working%2FEvergreen.git Extensions to our MODS32 stylesheet to capture all possible NFI in fields MODS 3 reacts to non-filing indicators only in the 245 field. This gives us extra output nodes from which we can get better-sorted headings from fields 130, 242, 440, 630, 730, 740, and 830. We also update the index definitions for seriestitle, alternative title, transalted title, and uniform title to use the leading-articles-stripped-by-NFI versions of the headings for browse. Signed-off-by: Lebbeous Fogle-Weekley --- 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 94b4b52574..5b9f1a3f0f 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -110,17 +110,17 @@ INSERT INTO config.xml_transform VALUES ( 'mods33', 'http://www.loc.gov/mods/v3' INSERT INTO config.xml_transform VALUES ( 'marc21expand880', 'http://www.loc.gov/MARC21/slim', 'marc', '' ); -- Index Definitions -INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field, authority_xpath ) VALUES - (1, 'series', 'seriestitle', oils_i18n_gettext(1, 'Series Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo$$, TRUE, '//@xlink:href' ); +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field, authority_xpath, browse_xpath ) VALUES + (1, 'series', 'seriestitle', oils_i18n_gettext(1, 'Series Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$, TRUE, '//@xlink:href', $$//*/*[local-name() != "nonSort"]$$ ); -- vim */ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES (2, 'title', 'abbreviated', oils_i18n_gettext(2, 'Abbreviated Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='abbreviated')]$$, '//@xlink:href' ); -INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES - (3, 'title', 'translated', oils_i18n_gettext(3, 'Translated Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='translated')]$$, '//@xlink:href' ); -INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES - (4, 'title', 'alternative', oils_i18n_gettext(4, 'Alternate Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative')]$$, '//@xlink:href' ); -INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES - (5, 'title', 'uniform', oils_i18n_gettext(5, 'Uniform Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform')]$$, '//@xlink:href' ); +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath, browse_xpath ) VALUES + (3, 'title', 'translated', oils_i18n_gettext(3, 'Translated Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='translated-nfi')]$$, '//@xlink:href', $$//*/*[local-name() != "nonSort"]$$ ); -- vim */ +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath, browse_xpath ) VALUES + (4, 'title', 'alternative', oils_i18n_gettext(4, 'Alternate Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative-nfi')]$$, '//@xlink:href', $$//*/*[local-name() != "nonSort"]$$ ); -- vim */ +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath, browse_xpath ) VALUES + (5, 'title', 'uniform', oils_i18n_gettext(5, 'Uniform Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform-nfi')]$$, '//@xlink:href', $$//*/*[local-name() != "nonSort"]$$ ); -- vim */ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath, browse_field ) VALUES (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$, '//@xlink:href', FALSE ); diff --git a/Open-ILS/src/sql/Pg/953.data.MODS32-xsl.sql b/Open-ILS/src/sql/Pg/953.data.MODS32-xsl.sql index 542440a693..d5486c5f52 100644 --- a/Open-ILS/src/sql/Pg/953.data.MODS32-xsl.sql +++ b/Open-ILS/src/sql/Pg/953.data.MODS32-xsl.sql @@ -182,6 +182,16 @@ Added Log Comment + + + + + + a + + + + @@ -190,19 +200,36 @@ Added Log Comment - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <!-- 1/04 removed $h, b --> - <xsl:with-param name="codes">a</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + + @@ -226,39 +253,91 @@ Added Log Comment + + + + + + + + + + + + + + + + + + + + + + + + + + - <xsl:call-template name="uri" /> - <xsl:variable name="str"> - <xsl:for-each select="marc:subfield"> - <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> - <xsl:value-of select="text()"/> - <xsl:text> </xsl:text> - </xsl:if> - </xsl:for-each> - </xsl:variable> - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:value-of select="substring($str,1,string-length($str)-1)"/> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop"/> + + + + + + + + <xsl:value-of select="substring($titleChop,$nfi+1)"/> + + + + + <xsl:value-of select="$titleChop"/> + + + + + + + + + + ah + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">ah</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind1+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -1591,18 +1670,40 @@ Added Log Comment + + + + + av + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">av</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -1788,16 +1889,37 @@ Added Log Comment + + + + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind1+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -1951,18 +2073,39 @@ Added Log Comment + + + + + adfgklmorsv + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -2695,17 +2838,39 @@ Added Log Comment + + + + + adfhklor + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">adfhklor</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> - <xsl:call-template name="part"></xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + + + <xsl:value-of select="substring($titleChop,@ind1+1)"/> + + + + + + <xsl:value-of select="$titleChop" /> + + + + diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql index 5e6379b31b..3ecf6b252d 100644 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql @@ -23,15 +23,15 @@ UPDATE config.metabib_field field_class IN ('subject','series','title','author') AND browse_field IS TRUE; -INSERT INTO config.metabib_field ( - id, field_class, name, label, xpath, format, - search_field, facet_field, browse_field -) VALUES ( - 31, 'title', 'browse', - oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'), - $$//mods32:mods/mods32:titleInfo[not (@type)]/mods32:title$$, - 'mods32', FALSE, FALSE, TRUE -); +-- INSERT INTO config.metabib_field ( +-- id, field_class, name, label, xpath, format, +-- search_field, facet_field, browse_field +-- ) VALUES ( +-- 31, 'title', 'browse', +-- oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'), +-- $$//mods32:mods/mods32:titleInfo[not (@type)]/mods32:title$$, +-- 'mods32', FALSE, FALSE, TRUE +-- ); ALTER TYPE metabib.field_entry_template ADD ATTRIBUTE authority BIGINT; @@ -454,6 +454,16 @@ Added Log Comment + + + + + + a + + + + @@ -462,19 +472,36 @@ Added Log Comment - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <!-- 1/04 removed $h, b --> - <xsl:with-param name="codes">a</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + + @@ -498,39 +525,91 @@ Added Log Comment + + + + + + + + + + + + + + + + + + + + + + + + + + - <xsl:call-template name="uri" /> - <xsl:variable name="str"> - <xsl:for-each select="marc:subfield"> - <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> - <xsl:value-of select="text()"/> - <xsl:text> </xsl:text> - </xsl:if> - </xsl:for-each> - </xsl:variable> - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:value-of select="substring($str,1,string-length($str)-1)"/> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop"/> + + + + + + + + <xsl:value-of select="substring($titleChop,$nfi+1)"/> + + + + + <xsl:value-of select="$titleChop"/> + + + + + + + + + + ah + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">ah</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind1+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -1863,18 +1942,40 @@ Added Log Comment + + + + + av + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">av</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -2060,16 +2161,37 @@ Added Log Comment + + + + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:value-of select="marc:subfield[@code='a']"></xsl:value-of> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind1+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -2223,18 +2345,39 @@ Added Log Comment + + + + + adfgklmorsv + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + <xsl:value-of select="$titleChop" /> + + + + + @@ -2967,17 +3110,39 @@ Added Log Comment + + + + + adfhklor + + + + - <xsl:call-template name="chopPunctuation"> - <xsl:with-param name="chopString"> - <xsl:call-template name="subfieldSelect"> - <xsl:with-param name="codes">adfhklor</xsl:with-param> - </xsl:call-template> - </xsl:with-param> - </xsl:call-template> - <xsl:call-template name="part"></xsl:call-template> + <xsl:value-of select="$titleChop" /> + + + + + + + + + + <xsl:value-of select="substring($titleChop,@ind1+1)"/> + + + + + + <xsl:value-of select="$titleChop" /> + + + + @@ -7148,4 +7313,32 @@ BEGIN END; $p$ LANGUAGE PLPGSQL; +UPDATE config.metabib_field +SET + xpath = $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$, + browse_xpath = $$//*/*[local-name() != "nonSort"]$$ -- vim highlighting */ +WHERE + field_class = 'series' AND name = 'seriestitle' ; + +UPDATE config.metabib_field +SET + xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative-nfi')]$$, + browse_xpath = $$//*/*[local-name() != "nonSort"]$$ -- vim highlighting */ +WHERE + field_class = 'title' AND name = 'alternative' ; + +UPDATE config.metabib_field +SET + xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform-nfi')]$$, + browse_xpath = $$//*/*[local-name() != "nonSort"]$$ -- vim highlighting */ +WHERE + field_class = 'title' AND name = 'uniform' ; + +UPDATE config.metabib_field +SET + xpath = $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='translated-nfi')]$$, + browse_xpath = $$//*/*[local-name() != "nonSort"]$$ -- vim highlighting */ +WHERE + field_class = 'title' AND name = 'translated' ; + COMMIT;