From: Bill Erickson Date: Thu, 26 Oct 2017 15:10:34 +0000 (-0400) Subject: LP#1727487 Display field seed data WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=33fd61da72e61e963fecd9a7fb790e500d6a307c;p=working%2FEvergreen.git LP#1727487 Display field seed data WIP Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 5315327b97..e43affe34d 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3804,16 +3804,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + - + + + + + + + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.display-field-seed-data.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.display-field-seed-data.sql index 17a9b5e3f7..9c61bc03ea 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.display-field-seed-data.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.display-field-seed-data.sql @@ -2,63 +2,93 @@ BEGIN; -- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version); --- EDITION ----- -INSERT INTO config.metabib_field - (id, field_class, name, label, xpath, display_field) +-- NEW config.metabib_field entries + +INSERT INTO config.metabib_field (id, field_class, name, + label, xpath, display_field, search_field, browse_field) VALUES ( 38, 'identifier', 'edition', oils_i18n_gettext(38, 'Edition', 'cmf', 'label'), $$//mods33:mods/mods33:originInfo//mods33:edition[1]$$, - TRUE + TRUE, FALSE, FALSE ); -INSERT INTO config.display_field_map - (name, field, multi) VALUES ('edition', 38, FALSE); - --- ISSN ----- - -UPDATE config.metabib_field SET display_field = TRUE WHERE id = 19; -INSERT INTO config.display_field_map - (name, field, multi) VALUES ('issn', 19, TRUE); - --- UPC ----- - -UPDATE config.metabib_field SET display_field = TRUE WHERE id = 20; -INSERT INTO config.display_field_map - (name, field, multi) VALUES ('upc', 20, TRUE); --- Physical Description ----- - -/* TODO: concatenate the phys desc fields into a single string, - since that's likely what the caller will do with it ? */ -INSERT INTO config.metabib_field - (id, field_class, name, label, xpath, display_field) +INSERT INTO config.metabib_field (id, field_class, name, + label, xpath, display_field, search_field, browse_field) VALUES ( 39, 'identifier', 'physical_description', oils_i18n_gettext(39, 'Physical Descrption', 'cmf', 'label'), $$(//mods33:mods/mods33:physicalDescription/mods33:form|//mods33:mods/mods33:physicalDescription/mods33:extent|//mods33:mods/mods33:physicalDescription/mods33:reformattingQuality|//mods33:mods/mods33:physicalDescription/mods33:internetMediaType|//mods33:mods/mods33:physicalDescription/mods33:digitalOrigin)$$, - TRUE + TRUE, FALSE, FALSE ); -INSERT INTO config.display_field_map - (name, field, multi) VALUES ('physical_description', 39, TRUE); - --- Publisher ----- -INSERT INTO config.metabib_field - (id, field_class, name, label, xpath, display_field) +INSERT INTO config.metabib_field (id, field_class, name, + label, xpath, display_field, search_field, browse_field) VALUES ( 40, 'identifier', 'publisher', oils_i18n_gettext(40, 'Publisher', 'cmf', 'label'), $$//mods33:mods/mods33:originInfo//mods33:publisher[1]$$, - TRUE + TRUE, FALSE, FALSE ); -INSERT INTO config.display_field_map - (name, field, multi) VALUES ('publisher', 40, FALSE); --- Series ----- +INSERT INTO config.metabib_field (id, field_class, name, + label, xpath, display_field, search_field, browse_field) +VALUES ( + 41, 'identifier', 'abstract', + oils_i18n_gettext(41, 'Abstract', 'cmf', 'label'), + $$//mods33:mods/mods33:abstract$$, + TRUE, FALSE, FALSE +); -UPDATE config.metabib_field SET display_field = TRUE WHERE id = 1; -INSERT INTO config.display_field_map - (name, field, multi) VALUES ('seriestitle', 1, FALSE); +INSERT INTO config.metabib_field (id, field_class, name, + label, xpath, display_field, search_field, browse_field) +VALUES ( + 42, 'identifier', 'toc', + oils_i18n_gettext(42, 'Table of Contents', 'cmf', 'label'), + $$//mods33:tableOfContents$$, + TRUE, FALSE, FALSE +); + +INSERT INTO config.metabib_field (id, field_class, name, + label, xpath, display_field, search_field, browse_field) +VALUES ( + 43, 'identifier', 'type_of_resource', + oils_i18n_gettext(43, 'Type of Resource', 'cmf', 'label'), + $$//mods33:mods/mods33:typeOfResource$$, + TRUE, FALSE, FALSE +); + +-- Modify existing config.metabib_field entries + +UPDATE config.metabib_field SET display_field = TRUE WHERE id IN ( + 1, -- seriestitle + 11, -- subject_geographic + 12, -- subject_name + 13, -- subject_temporal + 14, -- subject_topic + 19, -- ISSN + 20, -- UPC + 26 -- TCN +); + +-- Map display field names to config.metabib_field entries + +INSERT INTO config.display_field_map (name, field, multi) VALUES + ('seriestitle', 1, FALSE), + ('subject_geographic', 11, TRUE), + ('subject_name', 12, TRUE), + ('subject_temporal', 13, TRUE), + ('subject_topic', 14, TRUE), + ('issn', 19, TRUE), + ('upc', 20, TRUE), + ('tcn', 26, FALSE), + ('edition', 38, FALSE), + ('physical_description',39, TRUE), + ('publisher', 40, FALSE), + ('abstract', 41, FALSE), + ('toc', 42, FALSE), + ('type_of_resource', 43, FALSE) +; -- Add a column to wide-display-entry per well-known field @@ -68,15 +98,22 @@ CREATE VIEW metabib.wide_display_entry AS bre.id AS source, COALESCE(mcde_title.value, 'null') AS title, COALESCE(mcde_author.value, 'null') AS author, - COALESCE(mcde_subject.value, 'null') AS subject, + 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_seriestitle.value, 'null') AS seriestitle + COALESCE(mcde_seriestitle.value, 'null') AS seriestitle, + COALESCE(mcde_abstract.value, 'null') AS abstract, + COALESCE(mcde_toc.value, 'null') AS toc, + COALESCE(mcde_type_of_resource.value, 'null') 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') @@ -84,6 +121,18 @@ CREATE VIEW metabib.wide_display_entry AS ON (bre.id = mcde_author.source AND mcde_author.name = 'author') LEFT JOIN metabib.compressed_display_entry mcde_subject ON (bre.id = mcde_subject.source AND mcde_subject.name = 'subject') + LEFT JOIN metabib.compressed_display_entry mcde_subject_geographic + ON (bre.id = mcde_subject_geographic.source + AND mcde_subject_geographic.name = 'subject_geographic') + LEFT JOIN metabib.compressed_display_entry mcde_subject_name + ON (bre.id = mcde_subject_name.source + AND mcde_subject_name.name = 'subject_name') + LEFT JOIN metabib.compressed_display_entry mcde_subject_temporal + ON (bre.id = mcde_subject_temporal.source + AND mcde_subject_temporal.name = 'subject_temporal') + LEFT JOIN metabib.compressed_display_entry mcde_subject_topic + ON (bre.id = mcde_subject_topic.source + AND mcde_subject_topic.name = 'subject_topic') LEFT JOIN metabib.compressed_display_entry mcde_creators ON (bre.id = mcde_creators.source AND mcde_creators.name = 'creators') LEFT JOIN metabib.compressed_display_entry mcde_isbn @@ -92,6 +141,8 @@ CREATE VIEW metabib.wide_display_entry AS ON (bre.id = mcde_issn.source AND mcde_issn.name = 'issn') LEFT JOIN metabib.compressed_display_entry mcde_upc ON (bre.id = mcde_upc.source AND mcde_upc.name = 'upc') + LEFT JOIN metabib.compressed_display_entry mcde_tcn + ON (bre.id = mcde_tcn.source AND mcde_tcn.name = 'tcn') LEFT JOIN metabib.compressed_display_entry mcde_edition ON (bre.id = mcde_edition.source AND mcde_edition.name = 'edition') LEFT JOIN metabib.compressed_display_entry mcde_physical_description @@ -101,6 +152,13 @@ CREATE VIEW metabib.wide_display_entry AS ON (bre.id = mcde_publisher.source AND mcde_publisher.name = 'publisher') LEFT JOIN metabib.compressed_display_entry mcde_seriestitle ON (bre.id = mcde_seriestitle.source AND mcde_seriestitle.name = 'seriestitle') + LEFT JOIN metabib.compressed_display_entry mcde_abstract + ON (bre.id = mcde_abstract.source AND mcde_abstract.name = 'abstract') + LEFT JOIN metabib.compressed_display_entry mcde_toc + ON (bre.id = mcde_toc.source AND mcde_toc.name = 'toc') + LEFT JOIN metabib.compressed_display_entry mcde_type_of_resource + ON (bre.id = mcde_type_of_resource.source + AND mcde_type_of_resource.name = 'type_of_resource') ; COMMIT; @@ -108,9 +166,9 @@ COMMIT; /** ROLLBACK BEGIN; -DELETE FROM metabib.display_entry WHERE field IN (1,19,20,38,39,40); -DELETE FROM config.display_field_map WHERE field IN (1,19,20,38,39,40); -DELETE FROM config.metabib_field WHERE id IN (38,39,40); +DELETE FROM metabib.display_entry WHERE field IN (1,11,12,13,14,19,20,26,38,39,40,41,42,43); +DELETE FROM config.display_field_map WHERE field IN (1,11,12,13,14,19,20,26,38,39,40,41,42,43); +DELETE FROM config.metabib_field WHERE id IN (38,39,40,41,42,43); COMMIT; */ @@ -121,6 +179,7 @@ COMMIT; \qecho \qecho Reingesting display field entries. This may take a while. \qecho This command can be stopped (control-c) and rerun later if needed: +\qecho \qecho SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE, \qecho (SELECT ARRAY_AGG(id)::INT[] FROM config.metabib_field WHERE display_field)) \qecho FROM biblio.record_entry WHERE NOT deleted AND id > 0;