stanford-mods 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stanford-mods/searchworks.rb +7 -10
- data/lib/stanford-mods/version.rb +1 -1
- data/spec/fixtures/searchworks_pub_date_data.rb +13 -14
- data/spec/searchworks_format_spec.rb +27 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69a9ca8048029f26ee81d1ecedcfce609472a4fd
|
4
|
+
data.tar.gz: 94bebebe8d0ae3eab18dd309279af83a1e4d700e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c30ff296e9e66ebeac2be5d0924536516ae2b1d2939122c5ebf786f1347dd8072ff7a9ddab3a8211bec38d17731d7d032a7f6073c18a3da2f348fceaf6cfba6
|
7
|
+
data.tar.gz: 12c8c7f6af8e26172a041aaeb68c421c0a165477d9a8365088bc0af8453380e3e996e43b4de3647439603afc917769ab831ebd9c33649854bc71b2abf239e306
|
@@ -276,6 +276,8 @@ module Stanford
|
|
276
276
|
|
277
277
|
# select one or more format values from the controlled vocabulary per JVine Summer 2014
|
278
278
|
# http://searchworks-solr-lb.stanford.edu:8983/solr/select?facet.field=format_main_ssim&rows=0&facet.sort=index
|
279
|
+
# https://github.com/sul-dlss/stanford-mods/issues/66 - For geodata, the
|
280
|
+
# resource type should be only Map and not include Software, multimedia.
|
279
281
|
# @return <Array[String]> value in the SearchWorks controlled vocabulary
|
280
282
|
def format_main
|
281
283
|
val = []
|
@@ -300,6 +302,7 @@ module Stanford
|
|
300
302
|
case type
|
301
303
|
when 'cartographic'
|
302
304
|
val << 'Map'
|
305
|
+
val.delete 'Software/Multimedia'
|
303
306
|
when 'mixed material'
|
304
307
|
val << 'Archive/Manuscript'
|
305
308
|
when 'moving image'
|
@@ -309,7 +312,7 @@ module Stanford
|
|
309
312
|
when 'software, multimedia'
|
310
313
|
if genres && (genres.include?('dataset') || genres.include?('Dataset'))
|
311
314
|
val << 'Dataset'
|
312
|
-
|
315
|
+
elsif (!val.include?('Map'))
|
313
316
|
val << 'Software/Multimedia'
|
314
317
|
end
|
315
318
|
when 'sound recording-musical'
|
@@ -333,30 +336,28 @@ module Stanford
|
|
333
336
|
end
|
334
337
|
|
335
338
|
# return values for the genre facet in SearchWorks
|
339
|
+
# https://github.com/sul-dlss/stanford-mods/issues/66
|
340
|
+
# Limit genre values to Government document, Conference proceedings,
|
341
|
+
# Technical report and Thesis/Dissertation
|
336
342
|
# @return <Array[String]>
|
337
343
|
def sw_genre
|
338
344
|
val = []
|
339
345
|
genres = self.term_values(:genre)
|
340
346
|
types = self.term_values(:typeOfResource)
|
341
347
|
if genres
|
342
|
-
val << genres.map(&:capitalize)
|
343
|
-
val.flatten! if !val.empty?
|
344
348
|
if genres.include?('thesis') || genres.include?('Thesis')
|
345
349
|
val << 'Thesis/Dissertation'
|
346
|
-
val.delete 'Thesis'
|
347
350
|
end
|
348
351
|
conf_pub = ['conference publication', 'Conference publication', 'Conference Publication']
|
349
352
|
if !(genres & conf_pub).empty?
|
350
353
|
if types && types.include?('text')
|
351
354
|
val << 'Conference proceedings'
|
352
|
-
val.delete 'Conference publication'
|
353
355
|
end
|
354
356
|
end
|
355
357
|
gov_pub = ['government publication', 'Government publication', 'Government Publication']
|
356
358
|
if !(genres & gov_pub).empty?
|
357
359
|
if types && types.include?('text')
|
358
360
|
val << 'Government document'
|
359
|
-
val.delete 'Government publication'
|
360
361
|
end
|
361
362
|
end
|
362
363
|
tech_rpt = ['technical report', 'Technical report', 'Technical Report']
|
@@ -366,10 +367,6 @@ module Stanford
|
|
366
367
|
end
|
367
368
|
end
|
368
369
|
end
|
369
|
-
# Archived website is in the MODS genre tag but it is considered a
|
370
|
-
# Resource type for Searchworks, so it needs to be removed from the
|
371
|
-
# applicable genre values
|
372
|
-
val.delete 'Archived website'
|
373
370
|
val.uniq
|
374
371
|
end
|
375
372
|
|
@@ -739,8 +739,7 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
739
739
|
# project_south
|
740
740
|
# reaction_kinetics?
|
741
741
|
# reliability
|
742
|
-
|
743
|
-
'xxx' =>
|
742
|
+
'renaissance' =>
|
744
743
|
{ # key is mods_xml; values = [pub date sortable facet value, pub date single string facet value]
|
745
744
|
# coll rec sr605np6062 no originInfo
|
746
745
|
# mj187xt5183
|
@@ -808,18 +807,18 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
808
807
|
# rigler
|
809
808
|
# rumsey
|
810
809
|
'rumsey' =>
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
810
|
+
{ # key is mods_xml; values = [pub date sortable facet value, pub date single string facet value]
|
811
|
+
# coll rec xh235dd9059 no originInfo
|
812
|
+
# fy259fg4220
|
813
|
+
mods_origin_info_start_str +
|
814
|
+
'<dateIssued>1855.</dateIssued>' +
|
815
|
+
mods_origin_info_end_str => [1855, '1855'],
|
816
|
+
# hp058zk7170
|
817
|
+
mods_origin_info_start_str +
|
818
|
+
'<dateCreated encoding="marc">1861</dateCreated>' +
|
819
|
+
'<dateIssued>1861.</dateIssued>' +
|
820
|
+
mods_origin_info_end_str => [1861, '1861']
|
821
|
+
},
|
823
822
|
# rock?
|
824
823
|
# scrf
|
825
824
|
# shale
|
@@ -493,6 +493,13 @@ describe "Format fields (searchworks.rb)" do
|
|
493
493
|
@smods_rec.from_str(m)
|
494
494
|
expect(@smods_rec.format_main).to eq ['Software/Multimedia']
|
495
495
|
end
|
496
|
+
# https://github.com/sul-dlss/stanford-mods/issues/66 - For geodata, the
|
497
|
+
# resource type should be only Map and not include Software, multimedia.
|
498
|
+
it "typeOfResource 'cartographic' and 'software, multimedia'" do
|
499
|
+
m = "<mods #{@ns_decl}><typeOfResource>cartographic</typeOfResource><typeOfResource>software, multimedia</typeOfResource></mods>"
|
500
|
+
@smods_rec.from_str(m)
|
501
|
+
expect(@smods_rec.format_main).to eq ['Map']
|
502
|
+
end
|
496
503
|
end
|
497
504
|
|
498
505
|
context "Sound Recording:" do
|
@@ -575,6 +582,11 @@ describe "Format fields (searchworks.rb)" do
|
|
575
582
|
end #format_main
|
576
583
|
|
577
584
|
context "sw_genre" do
|
585
|
+
it "ignores values that are not in the prescribed list" do
|
586
|
+
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">Not on the list</genre><typeOfResource>text</typeOfResource></mods>"
|
587
|
+
@smods_rec.from_str(m)
|
588
|
+
expect(@smods_rec.sw_genre).to eq []
|
589
|
+
end
|
578
590
|
it "Conference proceedings: typeOfResource 'text', genre 'conference publication'" do
|
579
591
|
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">conference publication</genre><typeOfResource>text</typeOfResource></mods>"
|
580
592
|
@smods_rec.from_str(m)
|
@@ -628,37 +640,36 @@ describe "Format fields (searchworks.rb)" do
|
|
628
640
|
expect(@smods_rec.sw_genre).to_not eq ['Archived website']
|
629
641
|
end
|
630
642
|
it "capitalizes the first letter of a genre value" do
|
631
|
-
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">
|
632
|
-
@smods_rec.from_str(m)
|
633
|
-
expect(@smods_rec.sw_genre).to eq ['Student project report']
|
634
|
-
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">Student project report</genre></mods>"
|
643
|
+
m = "<mods #{@ns_decl}><typeOfResource>text</typeOfResource><genre authority=\"marcgt\">technical report</genre></mods>"
|
635
644
|
@smods_rec.from_str(m)
|
636
|
-
expect(@smods_rec.sw_genre).to eq ['
|
637
|
-
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">
|
645
|
+
expect(@smods_rec.sw_genre).to eq ['Technical report']
|
646
|
+
m = "<mods #{@ns_decl}><typeOfResource>text</typeOfResource><genre authority=\"marcgt\">Technical report</genre></mods>"
|
638
647
|
@smods_rec.from_str(m)
|
639
|
-
expect(@smods_rec.sw_genre).to eq ['
|
640
|
-
m = "<mods #{@ns_decl}><genre authority=\"marcgt\">
|
648
|
+
expect(@smods_rec.sw_genre).to eq ['Technical report']
|
649
|
+
m = "<mods #{@ns_decl}><typeOfResource>text</typeOfResource><genre authority=\"marcgt\">Technical Report</genre></mods>"
|
641
650
|
@smods_rec.from_str(m)
|
642
|
-
expect(@smods_rec.sw_genre).to eq ['
|
651
|
+
expect(@smods_rec.sw_genre).to eq ['Technical report']
|
643
652
|
end
|
644
653
|
# NOTE: may need to remove plurals and/or trailing punctuation in future
|
645
654
|
it "returns all genre values" do
|
646
655
|
m = "<mods #{@ns_decl}>
|
647
|
-
<
|
648
|
-
<genre>
|
649
|
-
<genre>
|
656
|
+
<typeOfResource>text</typeOfResource>
|
657
|
+
<genre>government publication</genre>
|
658
|
+
<genre>conference publication</genre>
|
659
|
+
<genre>thesis</genre>
|
650
660
|
</mods>"
|
651
661
|
@smods_rec.from_str(m)
|
652
|
-
expect(@smods_rec.sw_genre).to eq ['
|
662
|
+
expect(@smods_rec.sw_genre).to eq ['Thesis/Dissertation', 'Conference proceedings', 'Government document']
|
653
663
|
end
|
654
664
|
it "doesn't have duplicates" do
|
655
665
|
m = "<mods #{@ns_decl}>
|
656
|
-
<
|
666
|
+
<typeOfResource>text</typeOfResource>
|
667
|
+
<genre>conference publication</genre>
|
657
668
|
<genre>technical report</genre>
|
658
|
-
<genre>
|
669
|
+
<genre>Conference publication</genre>
|
659
670
|
</mods>"
|
660
671
|
@smods_rec.from_str(m)
|
661
|
-
expect(@smods_rec.sw_genre).to eq ['
|
672
|
+
expect(@smods_rec.sw_genre).to eq ['Conference proceedings', 'Technical report']
|
662
673
|
end
|
663
674
|
it "empty Array if no genre values" do
|
664
675
|
m = "<mods #{@ns_decl}>
|
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: 1.5.
|
4
|
+
version: 1.5.4
|
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: 2016-02-
|
12
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mods
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.4.
|
170
|
+
rubygems_version: 2.4.8
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Stanford specific wrangling of MODS metadata
|