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, 'identifier', '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, 'identifier', '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, 'identifier', '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, TRUE),
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),
150 ('bibliography', 46, TRUE),
151 ('thesis', 47, TRUE),
152 ('performers', 49, TRUE),
153 ('production_credits', 48, TRUE),
154 ('general_note', 50, TRUE),
155 ('publisher', 52, FALSE),
156 ('abstract', 41, FALSE),
158 ('type_of_resource', 43, FALSE),
159 ('pubdate', 44, FALSE)
162 UPDATE config.display_field_map SET field = 51 WHERE name = 'author';
164 -- Add a column to wide-display-entry per well-known field
166 DROP VIEW IF EXISTS metabib.wide_display_entry;
167 CREATE VIEW metabib.wide_display_entry AS
170 COALESCE(mcde_title.value, 'null')::TEXT AS title,
171 COALESCE(mcde_author.value, 'null')::TEXT AS author,
172 COALESCE(mcde_subject_geographic.value, 'null')::TEXT AS subject_geographic,
173 COALESCE(mcde_subject_name.value, 'null')::TEXT AS subject_name,
174 COALESCE(mcde_subject_temporal.value, 'null')::TEXT AS subject_temporal,
175 COALESCE(mcde_subject_topic.value, 'null')::TEXT AS subject_topic,
176 COALESCE(mcde_creators.value, 'null')::TEXT AS creators,
177 COALESCE(mcde_isbn.value, 'null')::TEXT AS isbn,
178 COALESCE(mcde_issn.value, 'null')::TEXT AS issn,
179 COALESCE(mcde_upc.value, 'null')::TEXT AS upc,
180 COALESCE(mcde_tcn.value, 'null')::TEXT AS tcn,
181 COALESCE(mcde_edition.value, 'null')::TEXT AS edition,
182 COALESCE(mcde_physical_description.value, 'null')::TEXT AS physical_description,
183 COALESCE(mcde_publisher.value, 'null')::TEXT AS publisher,
184 COALESCE(mcde_series_title.value, 'null')::TEXT AS series_title,
185 COALESCE(mcde_abstract.value, 'null')::TEXT AS abstract,
186 COALESCE(mcde_toc.value, 'null')::TEXT AS toc,
187 COALESCE(mcde_pubdate.value, 'null')::TEXT AS pubdate,
188 COALESCE(mcde_type_of_resource.value, 'null')::TEXT AS type_of_resource
189 FROM biblio.record_entry bre
190 LEFT JOIN metabib.compressed_display_entry mcde_title
191 ON (bre.id = mcde_title.source AND mcde_title.name = 'title')
192 LEFT JOIN metabib.compressed_display_entry mcde_author
193 ON (bre.id = mcde_author.source AND mcde_author.name = 'author')
194 LEFT JOIN metabib.compressed_display_entry mcde_subject
195 ON (bre.id = mcde_subject.source AND mcde_subject.name = 'subject')
196 LEFT JOIN metabib.compressed_display_entry mcde_subject_geographic
197 ON (bre.id = mcde_subject_geographic.source
198 AND mcde_subject_geographic.name = 'subject_geographic')
199 LEFT JOIN metabib.compressed_display_entry mcde_subject_name
200 ON (bre.id = mcde_subject_name.source
201 AND mcde_subject_name.name = 'subject_name')
202 LEFT JOIN metabib.compressed_display_entry mcde_subject_temporal
203 ON (bre.id = mcde_subject_temporal.source
204 AND mcde_subject_temporal.name = 'subject_temporal')
205 LEFT JOIN metabib.compressed_display_entry mcde_subject_topic
206 ON (bre.id = mcde_subject_topic.source
207 AND mcde_subject_topic.name = 'subject_topic')
208 LEFT JOIN metabib.compressed_display_entry mcde_creators
209 ON (bre.id = mcde_creators.source AND mcde_creators.name = 'creators')
210 LEFT JOIN metabib.compressed_display_entry mcde_isbn
211 ON (bre.id = mcde_isbn.source AND mcde_isbn.name = 'isbn')
212 LEFT JOIN metabib.compressed_display_entry mcde_issn
213 ON (bre.id = mcde_issn.source AND mcde_issn.name = 'issn')
214 LEFT JOIN metabib.compressed_display_entry mcde_upc
215 ON (bre.id = mcde_upc.source AND mcde_upc.name = 'upc')
216 LEFT JOIN metabib.compressed_display_entry mcde_tcn
217 ON (bre.id = mcde_tcn.source AND mcde_tcn.name = 'tcn')
218 LEFT JOIN metabib.compressed_display_entry mcde_edition
219 ON (bre.id = mcde_edition.source AND mcde_edition.name = 'edition')
220 LEFT JOIN metabib.compressed_display_entry mcde_physical_description
221 ON (bre.id = mcde_physical_description.source
222 AND mcde_physical_description.name = 'physical_description')
223 LEFT JOIN metabib.compressed_display_entry mcde_publisher
224 ON (bre.id = mcde_publisher.source AND mcde_publisher.name = 'publisher')
225 LEFT JOIN metabib.compressed_display_entry mcde_series_title
226 ON (bre.id = mcde_series_title.source AND mcde_series_title.name = 'series_title')
227 LEFT JOIN metabib.compressed_display_entry mcde_abstract
228 ON (bre.id = mcde_abstract.source AND mcde_abstract.name = 'abstract')
229 LEFT JOIN metabib.compressed_display_entry mcde_toc
230 ON (bre.id = mcde_toc.source AND mcde_toc.name = 'toc')
231 LEFT JOIN metabib.compressed_display_entry mcde_pubdate
232 ON (bre.id = mcde_pubdate.source AND mcde_pubdate.name = 'pubdate')
233 LEFT JOIN metabib.compressed_display_entry mcde_type_of_resource
234 ON (bre.id = mcde_type_of_resource.source
235 AND mcde_type_of_resource.name = 'type_of_resource')
238 CREATE OR REPLACE VIEW reporter.old_super_simple_record AS
244 evergreen.oils_json_to_text(d.title) AS title,
245 evergreen.oils_json_to_text(d.author) AS author,
246 evergreen.oils_json_to_text(d.publisher) AS publisher,
247 evergreen.oils_json_to_text(d.pubdate) AS pubdate,
248 CASE WHEN d.isbn = 'null'
250 ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.isbn::JSON)))
252 CASE WHEN d.issn = 'null'
254 ELSE (SELECT ARRAY(SELECT json_array_elements_text(d.issn::JSON)))
256 FROM biblio.record_entry r
257 JOIN metabib.wide_display_entry d ON (r.id = d.source);