bolognese 1.6 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -7
- data/lib/bolognese/readers/citeproc_reader.rb +4 -2
- data/lib/bolognese/readers/codemeta_reader.rb +4 -2
- data/lib/bolognese/readers/datacite_reader.rb +18 -13
- data/lib/bolognese/readers/ris_reader.rb +4 -2
- data/lib/bolognese/readers/schema_org_reader.rb +7 -2
- data/lib/bolognese/utils.rb +95 -0
- data/lib/bolognese/version.rb +1 -1
- data/resources/oecd/for-mappings.json +1101 -0
- data/resources/oecd/fos-mappings.json +198 -0
- data/spec/fixtures/datacite-funderIdentifier.xml +4 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_for_match.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_match.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_no_match.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_for_match.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_match.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_no_match.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/even_more_subject_scheme_FOR.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/more_subject_scheme_FOR.yml +107 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/subject_scheme_FOR.yml +110 -0
- data/spec/readers/datacite_reader_spec.rb +101 -1
- data/spec/readers/schema_org_reader_spec.rb +15 -1
- data/spec/utils_spec.rb +50 -0
- data/spec/writers/datacite_writer_spec.rb +8 -0
- data/spec/writers/schema_org_writer_spec.rb +2 -0
- metadata +13 -2
@@ -78,6 +78,18 @@ describe Bolognese::Metadata, vcr: true do
|
|
78
78
|
"nameType" => "Personal", "givenName"=>"Matthias", "familyName"=>"Staib", "affiliation" => [{"name"=>"University of Zurich, Zurich, Switzerland"}])
|
79
79
|
expect(subject.publisher).to be_nil
|
80
80
|
expect(subject.publication_year).to eq("2018")
|
81
|
+
expect(subject.subjects).to eq([{"subject"=>"Pupil Size Response"},
|
82
|
+
{"subject"=>"Skin Conductance Response"},
|
83
|
+
{"subject"=>"Electrocardiogram"},
|
84
|
+
{"subject"=>"Electromyogram"},
|
85
|
+
{"subject"=>"Electrodermal Activity"},
|
86
|
+
{"subject"=>"Galvanic Skin Response"},
|
87
|
+
{"subject"=>"PSR"},
|
88
|
+
{"subject"=>"SCR"},
|
89
|
+
{"subject"=>"ECG"},
|
90
|
+
{"subject"=>"EMG"},
|
91
|
+
{"subject"=>"EDA"},
|
92
|
+
{"subject"=>"GSR"}])
|
81
93
|
end
|
82
94
|
|
83
95
|
it "pangaea" do
|
@@ -119,6 +131,9 @@ describe Bolognese::Metadata, vcr: true do
|
|
119
131
|
expect(subject.titles).to eq([{"title"=>"Summary data ankylosing spondylitis GWAS"}])
|
120
132
|
expect(subject.container).to eq("identifier"=>"https://dataverse.harvard.edu", "identifierType"=>"URL", "title"=>"Harvard Dataverse", "type"=>"DataRepository")
|
121
133
|
expect(subject.creators).to eq([{"name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)", "nameIdentifiers"=>[], "affiliation" => []}])
|
134
|
+
expect(subject.subjects).to eq([{"subject"=>"Medicine, Health and Life Sciences"},
|
135
|
+
{"subject"=>"Genome-Wide Association Studies"},
|
136
|
+
{"subject"=>"Ankylosing spondylitis"}])
|
122
137
|
end
|
123
138
|
|
124
139
|
it "harvard dataverse via identifiers.org" do
|
@@ -285,7 +300,6 @@ describe Bolognese::Metadata, vcr: true do
|
|
285
300
|
expect(subject.id).to eq("https://doi.org/10.23698/aida/drov")
|
286
301
|
end
|
287
302
|
|
288
|
-
|
289
303
|
it "from attributes" do
|
290
304
|
subject = Bolognese::Metadata.new(input: nil,
|
291
305
|
from: "schema_org",
|
data/spec/utils_spec.rb
CHANGED
@@ -481,4 +481,54 @@ describe Bolognese::Metadata, vcr: true do
|
|
481
481
|
expect(response).to eq("https://raw.githubusercontent.com/datacite/metadata-reports/master/software/codemeta.json")
|
482
482
|
end
|
483
483
|
end
|
484
|
+
|
485
|
+
context "fos" do
|
486
|
+
it "name_to_fos match" do
|
487
|
+
name = "Biological sciences"
|
488
|
+
response = subject.name_to_fos(name)
|
489
|
+
expect(response).to eq([{"subject"=>"Biological sciences"},
|
490
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
491
|
+
"subject"=>"FOS: Biological sciences",
|
492
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
493
|
+
end
|
494
|
+
|
495
|
+
it "name_to_fos for match" do
|
496
|
+
name = "Statistics"
|
497
|
+
response = subject.name_to_fos(name)
|
498
|
+
expect(response).to eq([{"subject"=>"Statistics"},
|
499
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
500
|
+
"subject"=>"FOS: Mathematics",
|
501
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
502
|
+
end
|
503
|
+
|
504
|
+
it "name_to_fos no match" do
|
505
|
+
name = "Random tag"
|
506
|
+
response = subject.name_to_fos(name)
|
507
|
+
expect(response).to eq([{"subject"=>"Random tag"}])
|
508
|
+
end
|
509
|
+
|
510
|
+
it "hsh_to_fos match" do
|
511
|
+
hsh = { "__content__" => "Biological sciences" }
|
512
|
+
response = subject.hsh_to_fos(hsh)
|
513
|
+
expect(response).to eq([{"subject"=>"Biological sciences"},
|
514
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
515
|
+
"subject"=>"FOS: Biological sciences",
|
516
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
517
|
+
end
|
518
|
+
|
519
|
+
it "hsh_to_fos for match" do
|
520
|
+
hsh = { "__content__" => "Statistics" }
|
521
|
+
response = subject.hsh_to_fos(hsh)
|
522
|
+
expect(response).to eq([{"subject"=>"Statistics"},
|
523
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
524
|
+
"subject"=>"FOS: Mathematics",
|
525
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
526
|
+
end
|
527
|
+
|
528
|
+
it "hsh_to_fos no match" do
|
529
|
+
hsh = { "__content__"=>"Random tag" }
|
530
|
+
response = subject.hsh_to_fos(hsh)
|
531
|
+
expect(response).to eq([{"subject"=>"Random tag"}])
|
532
|
+
end
|
533
|
+
end
|
484
534
|
end
|
@@ -165,6 +165,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
165
165
|
expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
|
166
166
|
expect(subject.publication_year).to eq("2017")
|
167
167
|
expect(subject.publisher).to eq("Figshare")
|
168
|
+
expect(subject.subjects).to eq([{"subject"=>"Information Systems"},
|
169
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
170
|
+
"subject"=>"FOS: Computer and information sciences",
|
171
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
168
172
|
expect(subject.agency).to eq("DataCite")
|
169
173
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
|
170
174
|
expect(subject.datacite).to end_with("</resource>")
|
@@ -183,6 +187,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
183
187
|
expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
|
184
188
|
expect(subject.publication_year).to eq("2017")
|
185
189
|
expect(subject.publisher).to eq("Figshare")
|
190
|
+
expect(subject.subjects).to eq([{"subject"=>"Information Systems"},
|
191
|
+
{"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
|
192
|
+
"subject"=>"FOS: Computer and information sciences",
|
193
|
+
"subjectScheme"=>"Fields of Science and Technology (FOS)"}])
|
186
194
|
expect(subject.agency).to eq("DataCite")
|
187
195
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
|
188
196
|
expect(subject.datacite).to end_with("</resource>")
|
@@ -50,6 +50,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
50
50
|
expect(json["@id"]).to eq("https://doi.org/10.5061/dryad.8515")
|
51
51
|
expect(json["@reverse"]).to eq("citation" => [{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446", "@type"=>"ScholarlyArticle"}, {"@type"=>"ScholarlyArticle", "identifier"=>{"@type"=>"PropertyValue", "propertyID"=>"PMID", "value"=>"19478877"}}],
|
52
52
|
"isBasedOn" => [{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446", "@type"=>"ScholarlyArticle"}, {"@type"=>"ScholarlyArticle", "identifier"=>{"@type"=>"PropertyValue", "propertyID"=>"PMID", "value"=>"19478877"}}])
|
53
|
+
expect(json["keywords"]).to eq("Phylogeny, Malaria, Parasites, Taxonomy, Mitochondrial genome, Africa, Plasmodium")
|
53
54
|
end
|
54
55
|
|
55
56
|
it "Schema.org JSON IsSupplementTo" do
|
@@ -81,6 +82,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
81
82
|
"affiliation"=>{"@type"=>"Organization", "name"=>"NCEAS"}},
|
82
83
|
{"name"=>"University Of California, Santa Barbara", "@type"=>"Organization"}])
|
83
84
|
expect(json["version"]).to eq("2.0.0")
|
85
|
+
expect(json["keywords"]).to eq("data sharing, data repository, DataONE")
|
84
86
|
end
|
85
87
|
|
86
88
|
it "Funding" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -722,6 +722,8 @@ files:
|
|
722
722
|
- resources/kernel-4/include/datacite-titleType-v4.xsd
|
723
723
|
- resources/kernel-4/include/xml.xsd
|
724
724
|
- resources/kernel-4/metadata.xsd
|
725
|
+
- resources/oecd/for-mappings.json
|
726
|
+
- resources/oecd/fos-mappings.json
|
725
727
|
- resources/schema_org/jsonldcontext.json
|
726
728
|
- resources/xml.xsd
|
727
729
|
- spec/array_spec.rb
|
@@ -874,6 +876,12 @@ files:
|
|
874
876
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/ris.yml
|
875
877
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/schema_org.yml
|
876
878
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_string/crosscite.yml
|
879
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_for_match.yml
|
880
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_match.yml
|
881
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_no_match.yml
|
882
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_for_match.yml
|
883
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_match.yml
|
884
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_no_match.yml
|
877
885
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/from_schema_org/with_id.yml
|
878
886
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/from_schema_org_creators/with_affiliation.yml
|
879
887
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/from_schema_org_creators/without_affiliation.yml
|
@@ -935,15 +943,18 @@ files:
|
|
935
943
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/dissertation.yml
|
936
944
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/doi_with_sign.yml
|
937
945
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/empty_subject.yml
|
946
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/even_more_subject_scheme_FOR.yml
|
938
947
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/funding_references.yml
|
939
948
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/funding_schema_version_3.yml
|
940
949
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/is_identical_to.yml
|
941
950
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/keywords_with_attributes.yml
|
942
951
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/leading_and_trailing_whitespace.yml
|
952
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/more_subject_scheme_FOR.yml
|
943
953
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/multiple_author_names_in_one_creatorsName.yml
|
944
954
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/multiple_licenses.yml
|
945
955
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/series-information.yml
|
946
956
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/subject_scheme.yml
|
957
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/subject_scheme_FOR.yml
|
947
958
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/xs_string_attributes.yml
|
948
959
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date/publication_date.yml
|
949
960
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_from_date_parts/date.yml
|