stanford-mods 2.6.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/lib/stanford-mods/{geo_spatial.rb → concerns/geo_spatial.rb} +3 -5
- data/lib/stanford-mods/concerns/name.rb +57 -0
- data/lib/stanford-mods/concerns/origin_info.rb +113 -0
- data/lib/stanford-mods/{physical_location.rb → concerns/physical_location.rb} +2 -2
- data/lib/stanford-mods/concerns/searchworks.rb +125 -0
- data/lib/stanford-mods/concerns/searchworks_subjects.rb +126 -0
- data/lib/stanford-mods/concerns/title.rb +87 -0
- data/lib/stanford-mods/coordinate.rb +24 -3
- data/lib/stanford-mods/date_parsing.rb +32 -289
- data/lib/stanford-mods/imprint.rb +170 -322
- data/lib/stanford-mods/record.rb +20 -0
- data/lib/stanford-mods/version.rb +1 -1
- data/lib/stanford-mods/{searchworks_languages.rb → vocabularies/searchworks_languages.rb} +0 -0
- data/lib/stanford-mods.rb +12 -11
- data/spec/fixtures/searchworks_imprint_data.rb +38 -39
- data/spec/fixtures/searchworks_pub_date_data.rb +7 -7
- data/spec/fixtures/spotlight_pub_date_data.rb +7 -7
- data/spec/geo_spatial_spec.rb +1 -6
- data/spec/imprint_spec.rb +263 -207
- data/spec/lib/stanford-mods/coordinate_spec.rb +3 -5
- data/spec/name_spec.rb +26 -230
- data/spec/origin_info_spec.rb +34 -300
- data/spec/searchworks_basic_spec.rb +1 -3
- data/spec/searchworks_pub_dates_spec.rb +0 -215
- data/spec/searchworks_spec.rb +0 -21
- data/spec/searchworks_subject_raw_spec.rb +106 -105
- data/spec/searchworks_subject_spec.rb +19 -55
- data/spec/searchworks_title_spec.rb +5 -5
- data/stanford-mods.gemspec +1 -1
- metadata +19 -15
- data/lib/marc_countries.rb +0 -387
- data/lib/stanford-mods/geo_utils.rb +0 -28
- data/lib/stanford-mods/name.rb +0 -80
- data/lib/stanford-mods/origin_info.rb +0 -489
- data/lib/stanford-mods/searchworks.rb +0 -333
- data/lib/stanford-mods/searchworks_subjects.rb +0 -196
- data/spec/date_parsing_spec.rb +0 -905
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stanford-mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mods
|
@@ -17,14 +17,20 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '3.0'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.0.1
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
28
|
- - "~>"
|
26
29
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
30
|
+
version: '3.0'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.1
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: activesupport
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,21 +166,20 @@ files:
|
|
160
166
|
- LICENSE
|
161
167
|
- README.md
|
162
168
|
- Rakefile
|
163
|
-
- lib/marc_countries.rb
|
164
169
|
- lib/stanford-mods.rb
|
170
|
+
- lib/stanford-mods/concerns/geo_spatial.rb
|
171
|
+
- lib/stanford-mods/concerns/name.rb
|
172
|
+
- lib/stanford-mods/concerns/origin_info.rb
|
173
|
+
- lib/stanford-mods/concerns/physical_location.rb
|
174
|
+
- lib/stanford-mods/concerns/searchworks.rb
|
175
|
+
- lib/stanford-mods/concerns/searchworks_subjects.rb
|
176
|
+
- lib/stanford-mods/concerns/title.rb
|
165
177
|
- lib/stanford-mods/coordinate.rb
|
166
178
|
- lib/stanford-mods/date_parsing.rb
|
167
|
-
- lib/stanford-mods/geo_spatial.rb
|
168
|
-
- lib/stanford-mods/geo_utils.rb
|
169
179
|
- lib/stanford-mods/imprint.rb
|
170
|
-
- lib/stanford-mods/
|
171
|
-
- lib/stanford-mods/origin_info.rb
|
172
|
-
- lib/stanford-mods/physical_location.rb
|
173
|
-
- lib/stanford-mods/searchworks.rb
|
174
|
-
- lib/stanford-mods/searchworks_languages.rb
|
175
|
-
- lib/stanford-mods/searchworks_subjects.rb
|
180
|
+
- lib/stanford-mods/record.rb
|
176
181
|
- lib/stanford-mods/version.rb
|
177
|
-
-
|
182
|
+
- lib/stanford-mods/vocabularies/searchworks_languages.rb
|
178
183
|
- spec/fixtures/searchworks_imprint_data.rb
|
179
184
|
- spec/fixtures/searchworks_pub_date_data.rb
|
180
185
|
- spec/fixtures/spotlight_pub_date_data.rb
|
@@ -217,7 +222,6 @@ signing_key:
|
|
217
222
|
specification_version: 4
|
218
223
|
summary: Stanford specific wrangling of MODS metadata
|
219
224
|
test_files:
|
220
|
-
- spec/date_parsing_spec.rb
|
221
225
|
- spec/fixtures/searchworks_imprint_data.rb
|
222
226
|
- spec/fixtures/searchworks_pub_date_data.rb
|
223
227
|
- spec/fixtures/spotlight_pub_date_data.rb
|
data/lib/marc_countries.rb
DELETED
@@ -1,387 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Map 3 letter MARC Country/Location Code to User Friendly Name
|
4
|
-
# includes discontinued codes, because they're probably in our data
|
5
|
-
# from https://www.loc.gov/marc/countries/countries_code.html 01/20/2016
|
6
|
-
MARC_COUNTRIES =
|
7
|
-
{
|
8
|
-
'aa' => 'Albania',
|
9
|
-
'abc' => 'Alberta',
|
10
|
-
'ac' => 'Ashmore and Cartier Islands',
|
11
|
-
'aca' => 'Australian Capital Territory',
|
12
|
-
'ae' => 'Algeria',
|
13
|
-
'af' => 'Afghanistan',
|
14
|
-
'ag' => 'Argentina',
|
15
|
-
'ai' => 'Armenia (Republic)',
|
16
|
-
'air' => 'Armenian S.S.R.',
|
17
|
-
'aj' => 'Azerbaijan',
|
18
|
-
'ajr' => 'Azerbaijan S.S.R.',
|
19
|
-
'aku' => 'Alaska',
|
20
|
-
'alu' => 'Alabama',
|
21
|
-
'am' => 'Anguilla',
|
22
|
-
'an' => 'Andorra',
|
23
|
-
'ao' => 'Angola',
|
24
|
-
'aq' => 'Antigua and Barbuda',
|
25
|
-
'aru' => 'Arkansas',
|
26
|
-
'as' => 'American Samoa',
|
27
|
-
'at' => 'Australia',
|
28
|
-
'au' => 'Austria',
|
29
|
-
'aw' => 'Aruba',
|
30
|
-
'ay' => 'Antarctica',
|
31
|
-
'azu' => 'Arizona',
|
32
|
-
'ba' => 'Bahrain',
|
33
|
-
'bb' => 'Barbados',
|
34
|
-
'bcc' => 'British Columbia',
|
35
|
-
'bd' => 'Burundi',
|
36
|
-
'be' => 'Belgium',
|
37
|
-
'bf' => 'Bahamas',
|
38
|
-
'bg' => 'Bangladesh',
|
39
|
-
'bh' => 'Belize',
|
40
|
-
'bi' => 'British Indian Ocean Territory',
|
41
|
-
'bl' => 'Brazil',
|
42
|
-
'bm' => 'Bermuda Islands',
|
43
|
-
'bn' => 'Bosnia and Herzegovina',
|
44
|
-
'bo' => 'Bolivia',
|
45
|
-
'bp' => 'Solomon Islands',
|
46
|
-
'br' => 'Burma',
|
47
|
-
'bs' => 'Botswana',
|
48
|
-
'bt' => 'Bhutan',
|
49
|
-
'bu' => 'Bulgaria',
|
50
|
-
'bv' => 'Bouvet Island',
|
51
|
-
'bw' => 'Belarus',
|
52
|
-
'bwr' => 'Byelorussian S.S.R.',
|
53
|
-
'bx' => 'Brunei',
|
54
|
-
'ca' => 'Caribbean Netherlands',
|
55
|
-
'cau' => 'California',
|
56
|
-
'cb' => 'Cambodia',
|
57
|
-
'cc' => 'China',
|
58
|
-
'cd' => 'Chad',
|
59
|
-
'ce' => 'Sri Lanka',
|
60
|
-
'cf' => 'Congo (Brazzaville)',
|
61
|
-
'cg' => 'Congo (Democratic Republic)',
|
62
|
-
'ch' => 'China (Republic : 1949 )',
|
63
|
-
'ci' => 'Croatia',
|
64
|
-
'cj' => 'Cayman Islands',
|
65
|
-
'ck' => 'Colombia',
|
66
|
-
'cl' => 'Chile',
|
67
|
-
'cm' => 'Cameroon',
|
68
|
-
'cn' => 'Canada',
|
69
|
-
'co' => 'Curaçao',
|
70
|
-
'cou' => 'Colorado',
|
71
|
-
'cp' => 'Canton and Enderbury Islands',
|
72
|
-
'cq' => 'Comoros',
|
73
|
-
'cr' => 'Costa Rica',
|
74
|
-
'cs' => 'Czechoslovakia',
|
75
|
-
'ctu' => 'Connecticut',
|
76
|
-
'cu' => 'Cuba',
|
77
|
-
'cv' => 'Cabo Verde',
|
78
|
-
'cw' => 'Cook Islands',
|
79
|
-
'cx' => 'Central African Republic',
|
80
|
-
'cy' => 'Cyprus',
|
81
|
-
'cz' => 'Canal Zone',
|
82
|
-
'dcu' => 'District of Columbia',
|
83
|
-
'deu' => 'Delaware',
|
84
|
-
'dk' => 'Denmark',
|
85
|
-
'dm' => 'Benin',
|
86
|
-
'dq' => 'Dominica',
|
87
|
-
'dr' => 'Dominican Republic',
|
88
|
-
'ea' => 'Eritrea',
|
89
|
-
'ec' => 'Ecuador',
|
90
|
-
'eg' => 'Equatorial Guinea',
|
91
|
-
'em' => 'TimorLeste',
|
92
|
-
'enk' => 'England',
|
93
|
-
'er' => 'Estonia',
|
94
|
-
'err' => 'Estonia',
|
95
|
-
'es' => 'El Salvador',
|
96
|
-
'et' => 'Ethiopia',
|
97
|
-
'fa' => 'Faroe Islands',
|
98
|
-
'fg' => 'French Guiana',
|
99
|
-
'fi' => 'Finland',
|
100
|
-
'fj' => 'Fiji',
|
101
|
-
'fk' => 'Falkland Islands',
|
102
|
-
'flu' => 'Florida',
|
103
|
-
'fm' => 'Micronesia (Federated States)',
|
104
|
-
'fp' => 'French Polynesia',
|
105
|
-
'fr' => 'France',
|
106
|
-
'fs' => 'Terres australes et antarctiques françaises',
|
107
|
-
'ft' => 'Djibouti',
|
108
|
-
'gau' => 'Georgia',
|
109
|
-
'gb' => 'Kiribati',
|
110
|
-
'gd' => 'Grenada',
|
111
|
-
'ge' => 'Germany (East)',
|
112
|
-
'gh' => 'Ghana',
|
113
|
-
'gi' => 'Gibraltar',
|
114
|
-
'gl' => 'Greenland',
|
115
|
-
'gm' => 'Gambia',
|
116
|
-
'gn' => 'Gilbert and Ellice Islands',
|
117
|
-
'go' => 'Gabon',
|
118
|
-
'gp' => 'Guadeloupe',
|
119
|
-
'gr' => 'Greece',
|
120
|
-
'gs' => 'Georgia (Republic)',
|
121
|
-
'gsr' => 'Georgian S.S.R.',
|
122
|
-
'gt' => 'Guatemala',
|
123
|
-
'gu' => 'Guam',
|
124
|
-
'gv' => 'Guinea',
|
125
|
-
'gw' => 'Germany',
|
126
|
-
'gy' => 'Guyana',
|
127
|
-
'gz' => 'Gaza Strip',
|
128
|
-
'hiu' => 'Hawaii',
|
129
|
-
'hk' => 'Hong Kong',
|
130
|
-
'hm' => 'Heard and McDonald Islands',
|
131
|
-
'ho' => 'Honduras',
|
132
|
-
'ht' => 'Haiti',
|
133
|
-
'hu' => 'Hungary',
|
134
|
-
'iau' => 'Iowa',
|
135
|
-
'ic' => 'Iceland',
|
136
|
-
'idu' => 'Idaho',
|
137
|
-
'ie' => 'Ireland',
|
138
|
-
'ii' => 'India',
|
139
|
-
'ilu' => 'Illinois',
|
140
|
-
'inu' => 'Indiana',
|
141
|
-
'io' => 'Indonesia',
|
142
|
-
'iq' => 'Iraq',
|
143
|
-
'ir' => 'Iran',
|
144
|
-
'is' => 'Israel',
|
145
|
-
'it' => 'Italy',
|
146
|
-
'iu' => 'IsraelSyria Demilitarized Zones',
|
147
|
-
'iv' => "Côte d'Ivoire",
|
148
|
-
'iw' => 'IsraelJordan Demilitarized Zones',
|
149
|
-
'iy' => 'IraqSaudi Arabia Neutral Zone',
|
150
|
-
'ja' => 'Japan',
|
151
|
-
'ji' => 'Johnston Atoll',
|
152
|
-
'jm' => 'Jamaica',
|
153
|
-
'jn' => 'Jan Mayen',
|
154
|
-
'jo' => 'Jordan',
|
155
|
-
'ke' => 'Kenya',
|
156
|
-
'kg' => 'Kyrgyzstan',
|
157
|
-
'kgr' => 'Kirghiz S.S.R.',
|
158
|
-
'kn' => 'Korea (North)',
|
159
|
-
'ko' => 'Korea (South)',
|
160
|
-
'ksu' => 'Kansas',
|
161
|
-
'ku' => 'Kuwait',
|
162
|
-
'kv' => 'Kosovo',
|
163
|
-
'kyu' => 'Kentucky',
|
164
|
-
'kz' => 'Kazakhstan',
|
165
|
-
'kzr' => 'Kazakh S.S.R.',
|
166
|
-
'lau' => 'Louisiana',
|
167
|
-
'lb' => 'Liberia',
|
168
|
-
'le' => 'Lebanon',
|
169
|
-
'lh' => 'Liechtenstein',
|
170
|
-
'li' => 'Lithuania',
|
171
|
-
'lir' => 'Lithuania',
|
172
|
-
'ln' => 'Central and Southern Line Islands',
|
173
|
-
'lo' => 'Lesotho',
|
174
|
-
'ls' => 'Laos',
|
175
|
-
'lu' => 'Luxembourg',
|
176
|
-
'lv' => 'Latvia',
|
177
|
-
'lvr' => 'Latvia',
|
178
|
-
'ly' => 'Libya',
|
179
|
-
'mau' => 'Massachusetts',
|
180
|
-
'mbc' => 'Manitoba',
|
181
|
-
'mc' => 'Monaco',
|
182
|
-
'mdu' => 'Maryland',
|
183
|
-
'meu' => 'Maine',
|
184
|
-
'mf' => 'Mauritius',
|
185
|
-
'mg' => 'Madagascar',
|
186
|
-
'mh' => 'Macao',
|
187
|
-
'miu' => 'Michigan',
|
188
|
-
'mj' => 'Montserrat',
|
189
|
-
'mk' => 'Oman',
|
190
|
-
'ml' => 'Mali',
|
191
|
-
'mm' => 'Malta',
|
192
|
-
'mnu' => 'Minnesota',
|
193
|
-
'mo' => 'Montenegro',
|
194
|
-
'mou' => 'Missouri',
|
195
|
-
'mp' => 'Mongolia',
|
196
|
-
'mq' => 'Martinique',
|
197
|
-
'mr' => 'Morocco',
|
198
|
-
'msu' => 'Mississippi',
|
199
|
-
'mtu' => 'Montana',
|
200
|
-
'mu' => 'Mauritania',
|
201
|
-
'mv' => 'Moldova',
|
202
|
-
'mvr' => 'Moldavian S.S.R.',
|
203
|
-
'mw' => 'Malawi',
|
204
|
-
'mx' => 'Mexico',
|
205
|
-
'my' => 'Malaysia',
|
206
|
-
'mz' => 'Mozambique',
|
207
|
-
'na' => 'Netherlands Antilles',
|
208
|
-
'nbu' => 'Nebraska',
|
209
|
-
'ncu' => 'North Carolina',
|
210
|
-
'ndu' => 'North Dakota',
|
211
|
-
'ne' => 'Netherlands',
|
212
|
-
'nfc' => 'Newfoundland and Labrador',
|
213
|
-
'ng' => 'Niger',
|
214
|
-
'nhu' => 'New Hampshire',
|
215
|
-
'nik' => 'Northern Ireland',
|
216
|
-
'nju' => 'New Jersey',
|
217
|
-
'nkc' => 'New Brunswick',
|
218
|
-
'nl' => 'New Caledonia',
|
219
|
-
'nm' => 'Northern Mariana Islands',
|
220
|
-
'nmu' => 'New Mexico',
|
221
|
-
'nn' => 'Vanuatu',
|
222
|
-
'no' => 'Norway',
|
223
|
-
'np' => 'Nepal',
|
224
|
-
'nq' => 'Nicaragua',
|
225
|
-
'nr' => 'Nigeria',
|
226
|
-
'nsc' => 'Nova Scotia',
|
227
|
-
'ntc' => 'Northwest Territories',
|
228
|
-
'nu' => 'Nauru',
|
229
|
-
'nuc' => 'Nunavut',
|
230
|
-
'nvu' => 'Nevada',
|
231
|
-
'nw' => 'Northern Mariana Islands',
|
232
|
-
'nx' => 'Norfolk Island',
|
233
|
-
'nyu' => 'New York (State)',
|
234
|
-
'nz' => 'New Zealand',
|
235
|
-
'ohu' => 'Ohio',
|
236
|
-
'oku' => 'Oklahoma',
|
237
|
-
'onc' => 'Ontario',
|
238
|
-
'oru' => 'Oregon',
|
239
|
-
'ot' => 'Mayotte',
|
240
|
-
'pau' => 'Pennsylvania',
|
241
|
-
'pc' => 'Pitcairn Island',
|
242
|
-
'pe' => 'Peru',
|
243
|
-
'pf' => 'Paracel Islands',
|
244
|
-
'pg' => 'GuineaBissau',
|
245
|
-
'ph' => 'Philippines',
|
246
|
-
'pic' => 'Prince Edward Island',
|
247
|
-
'pk' => 'Pakistan',
|
248
|
-
'pl' => 'Poland',
|
249
|
-
'pn' => 'Panama',
|
250
|
-
'po' => 'Portugal',
|
251
|
-
'pp' => 'Papua New Guinea',
|
252
|
-
'pr' => 'Puerto Rico',
|
253
|
-
'pt' => 'Portuguese Timor',
|
254
|
-
'pw' => 'Palau',
|
255
|
-
'py' => 'Paraguay',
|
256
|
-
'qa' => 'Qatar',
|
257
|
-
'qea' => 'Queensland',
|
258
|
-
'quc' => 'Québec (Province)',
|
259
|
-
'rb' => 'Serbia',
|
260
|
-
're' => 'Réunion',
|
261
|
-
'rh' => 'Zimbabwe',
|
262
|
-
'riu' => 'Rhode Island',
|
263
|
-
'rm' => 'Romania',
|
264
|
-
'ru' => 'Russia (Federation)',
|
265
|
-
'rur' => 'Russian S.F.S.R.',
|
266
|
-
'rw' => 'Rwanda',
|
267
|
-
'ry' => 'Ryukyu Islands, Southern',
|
268
|
-
'sa' => 'South Africa',
|
269
|
-
'sb' => 'Svalbard',
|
270
|
-
'sc' => 'SaintBarthélemy',
|
271
|
-
'scu' => 'South Carolina',
|
272
|
-
'sd' => 'South Sudan',
|
273
|
-
'sdu' => 'South Dakota',
|
274
|
-
'se' => 'Seychelles',
|
275
|
-
'sf' => 'Sao Tome and Principe',
|
276
|
-
'sg' => 'Senegal',
|
277
|
-
'sh' => 'Spanish North Africa',
|
278
|
-
'si' => 'Singapore',
|
279
|
-
'sj' => 'Sudan',
|
280
|
-
'sk' => 'Sikkim',
|
281
|
-
'sl' => 'Sierra Leone',
|
282
|
-
'sm' => 'San Marino',
|
283
|
-
'sn' => 'Sint Maarten',
|
284
|
-
'snc' => 'Saskatchewan',
|
285
|
-
'so' => 'Somalia',
|
286
|
-
'sp' => 'Spain',
|
287
|
-
'sq' => 'Swaziland',
|
288
|
-
'sr' => 'Surinam',
|
289
|
-
'ss' => 'Western Sahara',
|
290
|
-
'st' => 'SaintMartin',
|
291
|
-
'stk' => 'Scotland',
|
292
|
-
'su' => 'Saudi Arabia',
|
293
|
-
'sv' => 'Swan Islands',
|
294
|
-
'sw' => 'Sweden',
|
295
|
-
'sx' => 'Namibia',
|
296
|
-
'sy' => 'Syria',
|
297
|
-
'sz' => 'Switzerland',
|
298
|
-
'ta' => 'Tajikistan',
|
299
|
-
'tar' => 'Tajik S.S.R.',
|
300
|
-
'tc' => 'Turks and Caicos Islands',
|
301
|
-
'tg' => 'Togo',
|
302
|
-
'th' => 'Thailand',
|
303
|
-
'ti' => 'Tunisia',
|
304
|
-
'tk' => 'Turkmenistan',
|
305
|
-
'tkr' => 'Turkmen S.S.R.',
|
306
|
-
'tl' => 'Tokelau',
|
307
|
-
'tma' => 'Tasmania',
|
308
|
-
'tnu' => 'Tennessee',
|
309
|
-
'to' => 'Tonga',
|
310
|
-
'tr' => 'Trinidad and Tobago',
|
311
|
-
'ts' => 'United Arab Emirates',
|
312
|
-
'tt' => 'Trust Territory of the Pacific Islands',
|
313
|
-
'tu' => 'Turkey',
|
314
|
-
'tv' => 'Tuvalu',
|
315
|
-
'txu' => 'Texas',
|
316
|
-
'tz' => 'Tanzania',
|
317
|
-
'ua' => 'Egypt',
|
318
|
-
'uc' => 'United States Misc. Caribbean Islands',
|
319
|
-
'ug' => 'Uganda',
|
320
|
-
'ui' => 'United Kingdom Misc. Islands',
|
321
|
-
'uik' => 'United Kingdom Misc. Islands',
|
322
|
-
'uk' => 'United Kingdom',
|
323
|
-
'un' => 'Ukraine',
|
324
|
-
'unr' => 'Ukraine',
|
325
|
-
'up' => 'United States Misc. Pacific Islands',
|
326
|
-
'ur' => 'Soviet Union',
|
327
|
-
'us' => 'United States',
|
328
|
-
'utu' => 'Utah',
|
329
|
-
'uv' => 'Burkina Faso',
|
330
|
-
'uy' => 'Uruguay',
|
331
|
-
'uz' => 'Uzbekistan',
|
332
|
-
'uzr' => 'Uzbek S.S.R.',
|
333
|
-
'vau' => 'Virginia',
|
334
|
-
'vb' => 'British Virgin Islands',
|
335
|
-
'vc' => 'Vatican City',
|
336
|
-
've' => 'Venezuela',
|
337
|
-
'vi' => 'Virgin Islands of the United States',
|
338
|
-
'vm' => 'Vietnam',
|
339
|
-
'vn' => 'Vietnam, North',
|
340
|
-
'vp' => 'Various places',
|
341
|
-
'vra' => 'Victoria',
|
342
|
-
'vs' => 'Vietnam, South',
|
343
|
-
'vtu' => 'Vermont',
|
344
|
-
'wau' => 'Washington (State)',
|
345
|
-
'wb' => 'West Berlin',
|
346
|
-
'wea' => 'Western Australia',
|
347
|
-
'wf' => 'Wallis and Futuna',
|
348
|
-
'wiu' => 'Wisconsin',
|
349
|
-
'wj' => 'West Bank of the Jordan River',
|
350
|
-
'wk' => 'Wake Island',
|
351
|
-
'wlk' => 'Wales',
|
352
|
-
'ws' => 'Samoa',
|
353
|
-
'wvu' => 'West Virginia',
|
354
|
-
'wyu' => 'Wyoming',
|
355
|
-
'xa' => 'Christmas Island (Indian Ocean)',
|
356
|
-
'xb' => 'Cocos (Keeling) Islands',
|
357
|
-
'xc' => 'Maldives',
|
358
|
-
'xd' => 'Saint KittsNevis',
|
359
|
-
'xe' => 'Marshall Islands',
|
360
|
-
'xf' => 'Midway Islands',
|
361
|
-
'xga' => 'Coral Sea Islands Territory',
|
362
|
-
'xh' => 'Niue',
|
363
|
-
'xi' => 'Saint KittsNevisAnguilla',
|
364
|
-
'xj' => 'Saint Helena',
|
365
|
-
'xk' => 'Saint Lucia',
|
366
|
-
'xl' => 'Saint Pierre and Miquelon',
|
367
|
-
'xm' => 'Saint Vincent and the Grenadines',
|
368
|
-
'xn' => 'Macedonia',
|
369
|
-
'xna' => 'New South Wales',
|
370
|
-
'xo' => 'Slovakia',
|
371
|
-
'xoa' => 'Northern Territory',
|
372
|
-
'xp' => 'Spratly Island',
|
373
|
-
'xr' => 'Czech Republic',
|
374
|
-
'xra' => 'South Australia',
|
375
|
-
'xs' => 'South Georgia and the South Sandwich Islands',
|
376
|
-
'xv' => 'Slovenia',
|
377
|
-
# 'xx' => 'No place, unknown, or undetermined',
|
378
|
-
'xxc' => 'Canada',
|
379
|
-
'xxk' => 'United Kingdom',
|
380
|
-
'xxr' => 'Soviet Union',
|
381
|
-
'xxu' => 'United States',
|
382
|
-
'ye' => 'Yemen',
|
383
|
-
'ykc' => 'Yukon Territory',
|
384
|
-
'ys' => "Yemen (People's Democratic Republic)",
|
385
|
-
'yu' => 'Serbia and Montenegro',
|
386
|
-
'za' => 'Zambia'
|
387
|
-
}.freeze
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Stanford
|
3
|
-
module Mods
|
4
|
-
# Abstract geo methods usable to several classes
|
5
|
-
module GeoUtils
|
6
|
-
# @param [String] val Coordinates value
|
7
|
-
# @return [String] cleaned value (strips parens and period), or the original value
|
8
|
-
def cleaner_coordinate(val)
|
9
|
-
matches = val.match(/^\(?([^)]+)\)?\.?$/)
|
10
|
-
matches ? matches[1] : val
|
11
|
-
end
|
12
|
-
|
13
|
-
# @param [String] point coordinate point in degrees notation
|
14
|
-
# @return [Float] converted value in decimal notation
|
15
|
-
def coord_to_decimal(point)
|
16
|
-
regex = /(?<dir>[NESW])\s*(?<deg>\d+)[°⁰º](?:(?<min>\d+)[ʹ'])?(?:(?<sec>\d+)[ʺ"])?/
|
17
|
-
match = regex.match(point)
|
18
|
-
return Float::INFINITY unless match
|
19
|
-
|
20
|
-
dec = match['deg'].to_i
|
21
|
-
dec += match['min'].to_f / 60
|
22
|
-
dec += match['sec'].to_f / 60 / 60
|
23
|
-
dec = -1 * dec if match['dir'] == 'W' || match['dir'] == 'S'
|
24
|
-
dec
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/stanford-mods/name.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'mods'
|
3
|
-
|
4
|
-
# NON-SearchWorks specific wranglings of MODS <name> metadata as a mixin to the Stanford::Mods::Record object
|
5
|
-
module Stanford
|
6
|
-
module Mods
|
7
|
-
class Record < ::Mods::Record
|
8
|
-
# the first encountered <mods><name> element with marcrelator flavor role of 'Creator' or 'Author'.
|
9
|
-
# if no marcrelator 'Creator' or 'Author', the first name without a role.
|
10
|
-
# if no name without a role, then nil
|
11
|
-
# @return [String] a name in the display_value_w_date form
|
12
|
-
# see Mods::Record.name in nom_terminology for details on the display_value algorithm
|
13
|
-
def main_author_w_date
|
14
|
-
result = nil
|
15
|
-
first_wo_role = nil
|
16
|
-
mods_ng_xml.plain_name.each { |n|
|
17
|
-
first_wo_role ||= n if n.role.empty?
|
18
|
-
n.role.each { |r|
|
19
|
-
if r.authority.include?('marcrelator') &&
|
20
|
-
r.value.any? { |v| v.match(/creator/i) || v.match?(/author/i) }
|
21
|
-
result ||= n.display_value_w_date
|
22
|
-
end
|
23
|
-
}
|
24
|
-
}
|
25
|
-
result = first_wo_role.display_value_w_date if !result && first_wo_role
|
26
|
-
result
|
27
|
-
end # main_author
|
28
|
-
|
29
|
-
# all names, in display form, except the main_author
|
30
|
-
# names will be the display_value_w_date form
|
31
|
-
# see Mods::Record.name in nom_terminology for details on the display_value algorithm
|
32
|
-
def additional_authors_w_dates
|
33
|
-
results = []
|
34
|
-
mods_ng_xml.plain_name.each { |n|
|
35
|
-
results << n.display_value_w_date
|
36
|
-
}
|
37
|
-
results.delete(main_author_w_date)
|
38
|
-
results
|
39
|
-
end
|
40
|
-
|
41
|
-
# @return Array of Strings, each containing the computed display value of a personal name
|
42
|
-
# except for the collector role (see mods gem nom_terminology for display value algorithm)
|
43
|
-
# FIXME: this is broken if there are multiple role codes and some of them are not marcrelator
|
44
|
-
def non_collector_person_authors
|
45
|
-
result = []
|
46
|
-
mods_ng_xml.personal_name.map do |n|
|
47
|
-
next if n.role.size.zero?
|
48
|
-
|
49
|
-
n.role.each { |r|
|
50
|
-
result << n.display_value_w_date unless includes_marc_relator_collector_role?(r)
|
51
|
-
}
|
52
|
-
end
|
53
|
-
result unless result.empty?
|
54
|
-
end
|
55
|
-
|
56
|
-
# @return Array of Strings, each containing the computed display value of
|
57
|
-
# a personal name with the role of Collector (see mods gem nom_terminology for display value algorithm)
|
58
|
-
def collectors_w_dates
|
59
|
-
result = []
|
60
|
-
mods_ng_xml.personal_name.each do |n|
|
61
|
-
next if n.role.size.zero?
|
62
|
-
|
63
|
-
n.role.each { |r|
|
64
|
-
result << n.display_value_w_date if includes_marc_relator_collector_role?(r)
|
65
|
-
}
|
66
|
-
end
|
67
|
-
result unless result.empty?
|
68
|
-
end
|
69
|
-
|
70
|
-
COLLECTOR_ROLE_URI = 'http://id.loc.gov/vocabulary/relators/col'.freeze
|
71
|
-
|
72
|
-
# @param Nokogiri::XML::Node role_node the role node from a parent name node
|
73
|
-
# @return true if there is a MARC relator collector role assigned
|
74
|
-
def includes_marc_relator_collector_role?(role_node)
|
75
|
-
(role_node.authority.include?('marcrelator') && role_node.value.include?('Collector')) ||
|
76
|
-
role_node.roleTerm.valueURI.first == COLLECTOR_ROLE_URI
|
77
|
-
end
|
78
|
-
end # class Record
|
79
|
-
end # Module Mods
|
80
|
-
end # Module Stanford
|