3 -- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
5 -- NEW config.metabib_field entries
7 UPDATE config.metabib_field SET display_xpath = facet_xpath, display_field = TRUE WHERE id = 33;
9 INSERT INTO config.metabib_field (id, field_class, name,
10 label, xpath, display_field, search_field, browse_field)
12 38, 'keyword', 'edition',
13 oils_i18n_gettext(38, 'Edition', 'cmf', 'label'),
14 $$//mods33:mods/mods33:originInfo//mods33:edition[1]$$,
18 INSERT INTO config.metabib_field (id, field_class, name,
19 label, xpath, display_field, search_field, browse_field)
21 39, 'keyword', 'physical_description',
22 oils_i18n_gettext(39, 'Physical Descrption', 'cmf', 'label'),
23 $$(//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)$$,
27 INSERT INTO config.metabib_field (id, field_class, name,
28 label, xpath, display_field, search_field, browse_field)
30 40, 'keyword', 'publisher',
31 oils_i18n_gettext(40, 'Publisher', 'cmf', 'label'),
32 $$//mods33:mods/mods33:originInfo//mods33:publisher[1]$$,
36 INSERT INTO config.metabib_field (id, field_class, name,
37 label, xpath, display_field, search_field, browse_field)
39 41, 'keyword', 'abstract',
40 oils_i18n_gettext(41, 'Abstract', 'cmf', 'label'),
41 $$//mods33:mods/mods33:abstract$$,
45 INSERT INTO config.metabib_field (id, field_class, name,
46 label, xpath, display_field, search_field, browse_field)
49 oils_i18n_gettext(42, 'Table of Contents', 'cmf', 'label'),
50 $$//mods33:tableOfContents$$,
54 INSERT INTO config.metabib_field (id, field_class, name,
55 label, xpath, display_field, search_field, browse_field)
57 43, 'identifier', 'type_of_resource',
58 oils_i18n_gettext(43, 'Type of Resource', 'cmf', 'label'),
59 $$//mods33:mods/mods33:typeOfResource$$,
63 INSERT INTO config.metabib_field (id, field_class, name,
64 label, xpath, display_field, search_field, browse_field)
66 44, 'identifier', 'pubdate',
67 oils_i18n_gettext(44, 'Publication Date', 'cmf', 'label'),
68 $$//mods33:mods/mods33:originInfo//mods33:dateIssued[@encoding="marc"]|//mods33:mods/mods33:originInfo//mods33:dateIssued[1]$$,
72 INSERT INTO config.metabib_field (id, field_class, name,
73 label, xpath, display_field, search_field, browse_field)
75 46, 'keyword', 'bibliography',
76 oils_i18n_gettext(46, 'Bibliography', 'cmf', 'label'),
77 $$//mods33:note[@type='bibliography']$$,
80 47, 'keyword', 'thesis',
81 oils_i18n_gettext(47, 'Thesis', 'cmf', 'label'),
82 $$//mods33:note[@type='thesis']$$,
85 48, 'keyword', 'production_credits',
86 oils_i18n_gettext(48, 'Creation/Production Credits', 'cmf', 'label'),
87 $$//mods33:note[@type='creation/production credits']$$,
90 49, 'keyword', 'performers',
91 oils_i18n_gettext(49, 'Performers', 'cmf', 'label'),
92 $$//mods33:note[@type='performers']$$,
95 50, 'keyword', 'general_note',
96 oils_i18n_gettext(50, 'General Note', 'cmf', 'label'),
97 $$//mods33:note[not(@type)]$$,
102 INSERT INTO config.metabib_field (id, field_class, name, format,
103 label, xpath, display_xpath, display_field, search_field, browse_field)
105 51, 'author', 'first_author', 'mods32',
106 oils_i18n_gettext(51, 'Author', 'cmf', 'label'),
107 $$//mods32:mods/mods32:name[mods32:role/mods32:roleTerm[text()='creator']][1]$$,
108 $$//*[local-name()='namePart']$$,
112 INSERT INTO config.metabib_field (id, field_class, name, format,
113 label, xpath, display_xpath, display_field, search_field, browse_field)
115 52, 'keyword', 'origin_info', 'marcxml',
116 oils_i18n_gettext(52, 'Origin Info', 'cmf', 'label'),
118 $$//*[local-name()='subfield' and contains('abc',@code)]$$,
123 -- Modify existing config.metabib_field entries
125 UPDATE config.metabib_field SET display_field = TRUE WHERE id IN (
127 11, -- subject_geographic
129 13, -- subject_temporal
136 -- Map display field names to config.metabib_field entries
138 INSERT INTO config.display_field_map (name, field, multi) VALUES
139 ('series_title', 1, FALSE),
140 ('subject_geographic', 11, TRUE),
141 ('subject_name', 12, TRUE),
142 ('subject_temporal', 13, TRUE),
143 ('subject_topic', 14, TRUE),
147 ('edition', 38, FALSE),
148 ('physical_description',39, TRUE),
149 ('publisher', 52, FALSE),
150 ('abstract', 41, FALSE),
152 ('type_of_resource', 43, FALSE),
153 ('pubdate', 44, FALSE)
156 UPDATE config.display_field_map SET field = 51 WHERE name = 'author';
158 -- Add a column to wide-display-entry per well-known field
160 DROP VIEW IF EXISTS metabib.wide_display_entry;
161 CREATE VIEW metabib.wide_display_entry AS
164 COALESCE(mcde_title.value, 'null')::TEXT AS title,
165 COALESCE(mcde_author.value, 'null')::TEXT AS author,
166 COALESCE(mcde_subject_geographic.value, 'null')::TEXT AS subject_geographic,
167 COALESCE(mcde_subject_name.value, 'null')::TEXT AS subject_name,
168 COALESCE(mcde_subject_temporal.value, 'null')::TEXT AS subject_temporal,
169 COALESCE(mcde_subject_topic.value, 'null')::TEXT AS subject_topic,
170 COALESCE(mcde_creators.value, 'null')::TEXT AS creators,
171 COALESCE(mcde_isbn.value, 'null')::TEXT AS isbn,
172 COALESCE(mcde_issn.value, 'null')::TEXT AS issn,
173 COALESCE(mcde_upc.value, 'null')::TEXT AS upc,
174 COALESCE(mcde_tcn.value, 'null')::TEXT AS tcn,
175 COALESCE(mcde_edition.value, 'null')::TEXT AS edition,
176 COALESCE(mcde_physical_description.value, 'null')::TEXT AS physical_description,
177 COALESCE(mcde_publisher.value, 'null')::TEXT AS publisher,
178 COALESCE(mcde_series_title.value, 'null')::TEXT AS series_title,
179 COALESCE(mcde_abstract.value, 'null')::TEXT AS abstract,
180 COALESCE(mcde_toc.value, 'null')::TEXT AS toc,
181 COALESCE(mcde_pubdate.value, 'null')::TEXT AS pubdate,
182 COALESCE(mcde_type_of_resource.value, 'null')::TEXT AS type_of_resource
183 FROM biblio.record_entry bre
184 LEFT JOIN metabib.compressed_display_entry mcde_title
185 ON (bre.id = mcde_title.source AND mcde_title.name = 'title')
186 LEFT JOIN metabib.compressed_display_entry mcde_author
187 ON (bre.id = mcde_author.source AND mcde_author.name = 'author')
188 LEFT JOIN metabib.compressed_display_entry mcde_subject
189 ON (bre.id = mcde_subject.source AND mcde_subject.name = 'subject')
190 LEFT JOIN metabib.compressed_display_entry mcde_subject_geographic
191 ON (bre.id = mcde_subject_geographic.source
192 AND mcde_subject_geographic.name = 'subject_geographic')
193 LEFT JOIN metabib.compressed_display_entry mcde_subject_name
194 ON (bre.id = mcde_subject_name.source
195 AND mcde_subject_name.name = 'subject_name')
196 LEFT JOIN metabib.compressed_display_entry mcde_subject_temporal
197 ON (bre.id = mcde_subject_temporal.source
198 AND mcde_subject_temporal.name = 'subject_temporal')
199 LEFT JOIN metabib.compressed_display_entry mcde_subject_topic
200 ON (bre.id = mcde_subject_topic.source
201 AND mcde_subject_topic.name = 'subject_topic')
202 LEFT JOIN metabib.compressed_display_entry mcde_creators
203 ON (bre.id = mcde_creators.source AND mcde_creators.name = 'creators')
204 LEFT JOIN metabib.compressed_display_entry mcde_isbn
205 ON (bre.id = mcde_isbn.source AND mcde_isbn.name = 'isbn')
206 LEFT JOIN metabib.compressed_display_entry mcde_issn
207 ON (bre.id = mcde_issn.source AND mcde_issn.name = 'issn')
208 LEFT JOIN metabib.compressed_display_entry mcde_upc
209 ON (bre.id = mcde_upc.source AND mcde_upc.name = 'upc')
210 LEFT JOIN metabib.compressed_display_entry mcde_tcn
211 ON (bre.id = mcde_tcn.source AND mcde_tcn.name = 'tcn')
212 LEFT JOIN metabib.compressed_display_entry mcde_edition
213 ON (bre.id = mcde_edition.source AND mcde_edition.name = 'edition')
214 LEFT JOIN metabib.compressed_display_entry mcde_physical_description
215 ON (bre.id = mcde_physical_description.source
216 AND mcde_physical_description.name = 'physical_description')
217 LEFT JOIN metabib.compressed_display_entry mcde_publisher
218 ON (bre.id = mcde_publisher.source AND mcde_publisher.name = 'publisher')
219 LEFT JOIN metabib.compressed_display_entry mcde_series_title
220 ON (bre.id = mcde_series_title.source AND mcde_series_title.name = 'series_title')
221 LEFT JOIN metabib.compressed_display_entry mcde_abstract
222 ON (bre.id = mcde_abstract.source AND mcde_abstract.name = 'abstract')
223 LEFT JOIN metabib.compressed_display_entry mcde_toc
224 ON (bre.id = mcde_toc.source AND mcde_toc.name = 'toc')
225 LEFT JOIN metabib.compressed_display_entry mcde_pubdate
226 ON (bre.id = mcde_pubdate.source AND mcde_pubdate.name = 'pubdate')
227 LEFT JOIN metabib.compressed_display_entry mcde_type_of_resource
228 ON (bre.id = mcde_type_of_resource.source
229 AND mcde_type_of_resource.name = 'type_of_resource')
232 CREATE OR REPLACE VIEW reporter.old_super_simple_record AS
238 evergreen.oils_json_to_text(d.title) AS title,
239 evergreen.oils_json_to_text(d.author) AS author,
240 evergreen.oils_json_to_text(d.publisher) AS publisher,
241 evergreen.oils_json_to_text(d.pubdate) AS pubdate,
242 CASE WHEN d.isbn = 'null'
244 ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.isbn::JSON)))
246 CASE WHEN d.issn = 'null'
248 ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.issn::JSON)))
250 FROM biblio.record_entry r
251 JOIN metabib.wide_display_entry d ON (r.id = d.source);