This VIEW expands as well-known display fields are added. */
SELECT
bre.id AS source,
- COALESCE(mcde_title.value, 'null') AS title,
- COALESCE(mcde_author.value, 'null') AS author,
- COALESCE(mcde_subject_geographic.value, 'null') AS subject_geographic,
- COALESCE(mcde_subject_name.value, 'null') AS subject_name,
- COALESCE(mcde_subject_temporal.value, 'null') AS subject_temporal,
- COALESCE(mcde_subject_topic.value, 'null') AS subject_topic,
- COALESCE(mcde_creators.value, 'null') AS creators,
- COALESCE(mcde_isbn.value, 'null') AS isbn,
- COALESCE(mcde_issn.value, 'null') AS issn,
- COALESCE(mcde_upc.value, 'null') AS upc,
- COALESCE(mcde_tcn.value, 'null') AS tcn,
- COALESCE(mcde_edition.value, 'null') AS edition,
- COALESCE(mcde_physical_description.value, 'null') AS physical_description,
- COALESCE(mcde_publisher.value, 'null') AS publisher,
- COALESCE(mcde_series_title.value, 'null') AS series_title,
- COALESCE(mcde_abstract.value, 'null') AS abstract,
- COALESCE(mcde_toc.value, 'null') AS toc,
- COALESCE(mcde_pubdate.value, 'null') AS pubdate,
- COALESCE(mcde_type_of_resource.value, 'null') AS type_of_resource
+ COALESCE(mcde_title.value, 'null')::TEXT AS title,
+ COALESCE(mcde_author.value, 'null')::TEXT AS author,
+ COALESCE(mcde_subject_geographic.value, 'null')::TEXT AS subject_geographic,
+ COALESCE(mcde_subject_name.value, 'null')::TEXT AS subject_name,
+ COALESCE(mcde_subject_temporal.value, 'null')::TEXT AS subject_temporal,
+ COALESCE(mcde_subject_topic.value, 'null')::TEXT AS subject_topic,
+ COALESCE(mcde_creators.value, 'null')::TEXT AS creators,
+ COALESCE(mcde_isbn.value, 'null')::TEXT AS isbn,
+ COALESCE(mcde_issn.value, 'null')::TEXT AS issn,
+ COALESCE(mcde_upc.value, 'null')::TEXT AS upc,
+ COALESCE(mcde_tcn.value, 'null')::TEXT AS tcn,
+ COALESCE(mcde_edition.value, 'null')::TEXT AS edition,
+ COALESCE(mcde_physical_description.value, 'null')::TEXT AS physical_description,
+ COALESCE(mcde_publisher.value, 'null')::TEXT AS publisher,
+ COALESCE(mcde_series_title.value, 'null')::TEXT AS series_title,
+ COALESCE(mcde_abstract.value, 'null')::TEXT AS abstract,
+ COALESCE(mcde_toc.value, 'null')::TEXT AS toc,
+ COALESCE(mcde_pubdate.value, 'null')::TEXT AS pubdate,
+ COALESCE(mcde_type_of_resource.value, 'null')::TEXT AS type_of_resource
FROM biblio.record_entry bre
LEFT JOIN metabib.compressed_display_entry mcde_title
ON (bre.id = mcde_title.source AND mcde_title.name = 'title')
WHERE record = $1
AND metabib_field = $2
$$ USING bib_id, vfield, rdata;
+ WHEN OTHERS THEN
+ -- ignore and move on
END;
END LOOP;
END;
)
;
+INSERT INTO config.metabib_field (id, field_class, name, format,
+ label, xpath, display_xpath, display_field, search_field, browse_field)
+VALUES (
+ 51, 'author', 'first_author', 'mods32',
+ oils_i18n_gettext(51, 'Author', 'cmf', 'label'),
+ $$//mods32:mods/mods32:name[mods32:role/mods32:roleTerm[text()='creator']][1]$$,
+ $$//*[local-name()='namePart']$$,
+ TRUE, TRUE, FALSE
+);
+
+INSERT INTO config.metabib_field (id, field_class, name, format,
+ label, xpath, display_xpath, display_field, search_field, browse_field)
+VALUES (
+ 52, 'keyword', 'origin_info', 'marcxml',
+ oils_i18n_gettext(52, 'Origin Info', 'cmf', 'label'),
+ $$//*[@tag='260']$$,
+ $$//*[local-name()='subfield' and contains('abc',@code)]$$,
+ TRUE, TRUE, FALSE
+);
+
INSERT INTO config.metabib_field_virtual_map (real, virtual)
SELECT id,
45
INSERT INTO config.display_field_map (name, field, multi) VALUES
('title', 6, FALSE),
- ('author', 8, FALSE),
+ ('author', 51, FALSE),
('creators', 37, TRUE),
('subject', 16, TRUE),
('isbn', 18, TRUE),
('tcn', 26, FALSE),
('edition', 38, FALSE),
('physical_description',39, TRUE),
- ('publisher', 40, FALSE),
+ ('publisher', 52, FALSE),
('abstract', 41, FALSE),
('toc', 42, FALSE),
('type_of_resource', 43, FALSE),
END;
$$ LANGUAGE PLPGSQL;
+-- Handy function for transforming marc to a variant available on config.xml_transform
+CREATE OR REPLACE FUNCTION evergreen.marc_to (marc text, xfrm text) RETURNS TEXT AS $$
+ SELECT evergreen.xml_pretty_print(xslt_process($1,xslt)::XML)::TEXT FROM config.xml_transform WHERE name = $2;
+$$ LANGUAGE SQL;
r.quality,
r.tcn_source,
r.tcn_value,
- CONCAT_WS(' ', FIRST(title.value),FIRST(title_np.val)) AS title,
- FIRST(author.value) AS author,
- STRING_AGG(DISTINCT publisher.value, ', ') AS publisher,
- STRING_AGG(DISTINCT SUBSTRING(pubdate.value FROM $$\d+$$), ', ') AS pubdate,
- CASE WHEN ARRAY_AGG( DISTINCT REPLACE(SUBSTRING(isbn.value FROM $$^\S+$$), '-', '') ) = '{NULL}'
+ evergreen.oils_json_to_text(d.title) AS title,
+ evergreen.oils_json_to_text(d.author) AS author,
+ evergreen.oils_json_to_text(d.publisher) AS publisher,
+ evergreen.oils_json_to_text(d.pubdate) AS pubdate,
+ CASE WHEN d.isbn = 'null'
THEN NULL
- ELSE ARRAY_AGG( DISTINCT REPLACE(SUBSTRING(isbn.value FROM $$^\S+$$), '-', '') )
+ ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.isbn::JSON)))
END AS isbn,
- CASE WHEN ARRAY_AGG( DISTINCT REGEXP_REPLACE(issn.value, E'^\\S*(\\d{4})[-\\s](\\d{3,4}x?)', E'\\1 \\2') ) = '{NULL}'
+ CASE WHEN d.issn = 'null'
THEN NULL
- ELSE ARRAY_AGG( DISTINCT REGEXP_REPLACE(issn.value, E'^\\S*(\\d{4})[-\\s](\\d{3,4}x?)', E'\\1 \\2') )
+ ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.issn::JSON)))
END AS issn
FROM biblio.record_entry r
- LEFT JOIN metabib.full_rec title ON (r.id = title.record AND title.tag = '245' AND title.subfield = 'a')
- LEFT JOIN ( -- Grab 245 N and P subfields in the order that they appear.
- SELECT b.record, string_agg(val, ' ') AS val FROM (
- SELECT title_np.record, title_np.value AS val
- FROM metabib.full_rec title_np
- WHERE
- title_np.tag = '245'
- AND title_np.subfield IN ('p','n')
- ORDER BY title_np.id
- ) b
- GROUP BY 1
- ) title_np ON (title_np.record=r.id)
- LEFT JOIN metabib.full_rec author ON (r.id = author.record AND author.tag IN ('100','110','111') AND author.subfield = 'a')
- LEFT JOIN metabib.full_rec publisher ON (r.id = publisher.record AND (publisher.tag = '260' OR (publisher.tag = '264' AND publisher.ind2 = '1')) AND publisher.subfield = 'b')
- LEFT JOIN metabib.full_rec pubdate ON (r.id = pubdate.record AND (pubdate.tag = '260' OR (pubdate.tag = '264' AND pubdate.ind2 = '1')) AND pubdate.subfield = 'c')
- LEFT JOIN metabib.full_rec isbn ON (r.id = isbn.record AND isbn.tag IN ('024', '020') AND isbn.subfield IN ('a','z'))
- LEFT JOIN metabib.full_rec issn ON (r.id = issn.record AND issn.tag = '022' AND issn.subfield = 'a')
- GROUP BY 1,2,3,4,5;
+ JOIN metabib.wide_display_entry d ON (r.id = d.source);
CREATE TABLE reporter.materialized_simple_record AS SELECT * FROM reporter.old_super_simple_record WHERE 1=0;
ALTER TABLE reporter.materialized_simple_record ADD PRIMARY KEY (id);
)
;
+INSERT INTO config.metabib_field (id, field_class, name, format,
+ label, xpath, display_xpath, display_field, search_field, browse_field)
+VALUES (
+ 51, 'author', 'first_author', 'mods32',
+ oils_i18n_gettext(51, 'Author', 'cmf', 'label'),
+ $$//mods32:mods/mods32:name[mods32:role/mods32:roleTerm[text()='creator']][1]$$,
+ $$//*[local-name()='namePart']$$,
+ TRUE, TRUE, FALSE
+);
+
+INSERT INTO config.metabib_field (id, field_class, name, format,
+ label, xpath, display_xpath, display_field, search_field, browse_field)
+VALUES (
+ 52, 'keyword', 'origin_info', 'marcxml',
+ oils_i18n_gettext(52, 'Origin Info', 'cmf', 'label'),
+ $$//*[@tag='260']$$,
+ $$//*[local-name()='subfield' and contains('abc',@code)]$$,
+ TRUE, TRUE, FALSE
+);
+
-- Modify existing config.metabib_field entries
('tcn', 26, FALSE),
('edition', 38, FALSE),
('physical_description',39, TRUE),
- ('publisher', 40, FALSE),
+ ('publisher', 52, FALSE),
('abstract', 41, FALSE),
('toc', 42, FALSE),
('type_of_resource', 43, FALSE),
('pubdate', 44, FALSE)
;
+UPDATE config.display_field_map SET field = 51 WHERE name = 'author';
+
-- Add a column to wide-display-entry per well-known field
-DROP VIEW metabib.wide_display_entry;
+DROP VIEW IF EXISTS metabib.wide_display_entry;
CREATE VIEW metabib.wide_display_entry AS
SELECT
bre.id AS source,
- COALESCE(mcde_title.value, 'null') AS title,
- COALESCE(mcde_author.value, 'null') AS author,
- COALESCE(mcde_subject_geographic.value, 'null') AS subject_geographic,
- COALESCE(mcde_subject_name.value, 'null') AS subject_name,
- COALESCE(mcde_subject_temporal.value, 'null') AS subject_temporal,
- COALESCE(mcde_subject_topic.value, 'null') AS subject_topic,
- COALESCE(mcde_creators.value, 'null') AS creators,
- COALESCE(mcde_isbn.value, 'null') AS isbn,
- COALESCE(mcde_issn.value, 'null') AS issn,
- COALESCE(mcde_upc.value, 'null') AS upc,
- COALESCE(mcde_tcn.value, 'null') AS tcn,
- COALESCE(mcde_edition.value, 'null') AS edition,
- COALESCE(mcde_physical_description.value, 'null') AS physical_description,
- COALESCE(mcde_publisher.value, 'null') AS publisher,
- COALESCE(mcde_series_title.value, 'null') AS series_title,
- COALESCE(mcde_abstract.value, 'null') AS abstract,
- COALESCE(mcde_toc.value, 'null') AS toc,
- COALESCE(mcde_pubdate.value, 'null') AS pubdate,
- COALESCE(mcde_type_of_resource.value, 'null') AS type_of_resource
+ COALESCE(mcde_title.value, 'null')::TEXT AS title,
+ COALESCE(mcde_author.value, 'null')::TEXT AS author,
+ COALESCE(mcde_subject_geographic.value, 'null')::TEXT AS subject_geographic,
+ COALESCE(mcde_subject_name.value, 'null')::TEXT AS subject_name,
+ COALESCE(mcde_subject_temporal.value, 'null')::TEXT AS subject_temporal,
+ COALESCE(mcde_subject_topic.value, 'null')::TEXT AS subject_topic,
+ COALESCE(mcde_creators.value, 'null')::TEXT AS creators,
+ COALESCE(mcde_isbn.value, 'null')::TEXT AS isbn,
+ COALESCE(mcde_issn.value, 'null')::TEXT AS issn,
+ COALESCE(mcde_upc.value, 'null')::TEXT AS upc,
+ COALESCE(mcde_tcn.value, 'null')::TEXT AS tcn,
+ COALESCE(mcde_edition.value, 'null')::TEXT AS edition,
+ COALESCE(mcde_physical_description.value, 'null')::TEXT AS physical_description,
+ COALESCE(mcde_publisher.value, 'null')::TEXT AS publisher,
+ COALESCE(mcde_series_title.value, 'null')::TEXT AS series_title,
+ COALESCE(mcde_abstract.value, 'null')::TEXT AS abstract,
+ COALESCE(mcde_toc.value, 'null')::TEXT AS toc,
+ COALESCE(mcde_pubdate.value, 'null')::TEXT AS pubdate,
+ COALESCE(mcde_type_of_resource.value, 'null')::TEXT AS type_of_resource
FROM biblio.record_entry bre
LEFT JOIN metabib.compressed_display_entry mcde_title
ON (bre.id = mcde_title.source AND mcde_title.name = 'title')
AND mcde_type_of_resource.name = 'type_of_resource')
;
+CREATE OR REPLACE VIEW reporter.old_super_simple_record AS
+SELECT r.id,
+ r.fingerprint,
+ r.quality,
+ r.tcn_source,
+ r.tcn_value,
+ evergreen.oils_json_to_text(d.title) AS title,
+ evergreen.oils_json_to_text(d.author) AS author,
+ evergreen.oils_json_to_text(d.publisher) AS publisher,
+ evergreen.oils_json_to_text(d.pubdate) AS pubdate,
+ CASE WHEN d.isbn = 'null'
+ THEN NULL
+ ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.isbn::JSON)))
+ END AS isbn,
+ CASE WHEN d.issn = 'null'
+ THEN NULL
+ ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.issn::JSON)))
+ END AS issn
+ FROM biblio.record_entry r
+ JOIN metabib.wide_display_entry d ON (r.id = d.source);
+
COMMIT;
WHERE record = $1
AND metabib_field = $2
$$ USING bib_id, vfield, rdata;
+ WHEN OTHERS THEN
+ -- ignore and move on
END;
END LOOP;
END;
END;
$function$ LANGUAGE plpgsql;
+CREATE OR REPLACE FUNCTION evergreen.marc_to (marc text, xfrm text) RETURNS TEXT AS $$
+ SELECT evergreen.xml_pretty_print(xslt_process($1,xslt)::XML)::TEXT FROM config.xml_transform WHERE name = $2;
+$$ LANGUAGE SQL;
+
COMMIT;
<!--3.2 change tmee additional note fields-->
+ <xsl:for-each select="marc:datafield[@tag=502]">
+ <note type="thesis">
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=504]">
+ <note type="bibliography">
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=508]">
+ <note type="creation/production credits">
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+
<xsl:for-each select="marc:datafield[@tag=506]">
<note type="restrictions">
<xsl:call-template name="uri"></xsl:call-template>
- <xsl:for-each select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=507 or @tag=508 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=535 or @tag=536 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=584 or @tag=585 or @tag=586]">
+ <xsl:for-each select="marc:datafield[@tag=501 or @tag=507 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=535 or @tag=536 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=584 or @tag=585 or @tag=586]">
<note>
<xsl:call-template name="uri"></xsl:call-template>
<xsl:variable name="str">
<!--3.2 change tmee additional note fields-->
+ <xsl:for-each select="marc:datafield[@tag=502]">
+ <note type="thesis">
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=504]">
+ <note type="bibliography">
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=508]">
+ <note type="creation/production credits">
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+
<xsl:for-each select="marc:datafield[@tag=506]">
<note type="restrictions">
<xsl:call-template name="uri"/>
</xsl:for-each>
<xsl:for-each
- select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=507 or @tag=508 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=535 or @tag=536 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=584 or @tag=585 or @tag=586]">+
+ select="marc:datafield[@tag=501 or @tag=507 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=535 or @tag=536 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=584 or @tag=585 or @tag=586]">+
<note>
<xsl:call-template name="uri"/>
<xsl:variable name="str">
</li>
[%- END %]
[%- END %]
- [%- IF attrs.phys_desc %]
+ [%- IF attrs.hl.physical_description.size %]
+ <li id='rdetail_phys_desc'>
+ <strong class='rdetail_label'>[% l("Physical Description:") %]</strong>
+ <span class='rdetail_value' highlighted='true'>[% attrs.hl.physical_description.join('<br/>') %]</span>
+ </li>
+ [%- ELSIF attrs.phys_desc %]
<li id='rdetail_phys_desc'>
<strong class='rdetail_label'>[% l("Physical Description:") %]</strong>
<span class='rdetail_value'>[% attrs.phys_desc | html %]</span>
</li>
[%- END %]
- [%- IF attrs.edition %]
+ [%- IF attrs.hl.edition %]
+ <li id='rdetail_edition'>
+ <strong class='rdetail_label'>[% l("Edition:") %]</strong>
+ <span class='rdetail_value' highlighted='true'>[% attrs.hl.edition %]</span>
+ [%- ELSIF attrs.edition %]
<li id='rdetail_edition'>
<strong class='rdetail_label'>[% l("Edition:") %]</strong>
<span class='rdetail_value'>[% attrs.edition | html %]</span>
-%]
</li>
[%- END %]
- [%- IF attrs.publisher %]
+ [%- IF attrs.hl.publisher %]
+ <li id='rdetail_publisher'>
+ <strong class='rdetail_label'>[% l("Publisher:") %]</strong>
+ <span class='rdetail_value' highlighted='true'>[% attrs.hl.publisher %]</span>
+ </li>
+ [%- ELSIF attrs.publisher %]
<li id='rdetail_publisher'>
<strong class='rdetail_label'>[% l("Publisher:") %]</strong>
<span class='rdetail_value' property="publisher" typeof="Organization">