bolognese 1.5.19 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +16 -13
  4. data/lib/bolognese/datacite_utils.rb +27 -3
  5. data/lib/bolognese/metadata_utils.rb +1 -0
  6. data/lib/bolognese/readers/bibtex_reader.rb +2 -1
  7. data/lib/bolognese/readers/citeproc_reader.rb +5 -3
  8. data/lib/bolognese/readers/codemeta_reader.rb +6 -4
  9. data/lib/bolognese/readers/crossref_reader.rb +1 -1
  10. data/lib/bolognese/readers/datacite_reader.rb +20 -15
  11. data/lib/bolognese/readers/ris_reader.rb +4 -2
  12. data/lib/bolognese/readers/schema_org_reader.rb +10 -6
  13. data/lib/bolognese/utils.rb +184 -9
  14. data/lib/bolognese/version.rb +1 -1
  15. data/lib/bolognese/writers/bibtex_writer.rb +2 -1
  16. data/lib/bolognese/writers/codemeta_writer.rb +2 -1
  17. data/resources/oecd/for-mappings.json +1101 -0
  18. data/resources/oecd/fos-mappings.json +198 -0
  19. data/resources/spdx/licenses.json +5297 -0
  20. data/spec/datacite_utils_spec.rb +32 -8
  21. data/spec/fixtures/datacite-example-affiliation.xml +1 -1
  22. data/spec/fixtures/datacite-funderIdentifier.xml +4 -0
  23. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_for_match.yml +44 -0
  24. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_match.yml +44 -0
  25. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/hsh_to_fos_no_match.yml +44 -0
  26. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_for_match.yml +44 -0
  27. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_match.yml +44 -0
  28. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/fos/name_to_fos_no_match.yml +44 -0
  29. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/even_more_subject_scheme_FOR.yml +97 -0
  30. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/more_subject_scheme_FOR.yml +107 -0
  31. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/subject_scheme_FOR.yml +110 -0
  32. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates/insert.yml +49 -0
  33. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_formats/insert.yml +49 -0
  34. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_person/creator_given_and_family_name.yml +49 -0
  35. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_sizes/insert.yml +49 -0
  36. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_cc_url/not_found.yml +44 -0
  37. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_cc_url/with_trailing_slash.yml +44 -0
  38. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_cc_url/with_trailing_slash_and_to_https.yml +44 -0
  39. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_url/to_https.yml +44 -0
  40. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_url/with_trailing_slash_and_to_https.yml +44 -0
  41. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/spdx/hsh_to_spdx_id.yml +44 -0
  42. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/spdx/hsh_to_spdx_not_found.yml +44 -0
  43. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/spdx/hsh_to_spdx_url.yml +44 -0
  44. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/spdx/name_to_spdx_exists.yml +44 -0
  45. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/spdx/name_to_spdx_id.yml +44 -0
  46. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/spdx/name_to_spdx_not_found.yml +44 -0
  47. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/url_to_https/http.yml +44 -0
  48. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/url_to_https/uri.yml +44 -0
  49. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/url_to_https/with_trailing_slash.yml +44 -0
  50. data/spec/readers/bibtex_reader_spec.rb +5 -1
  51. data/spec/readers/codemeta_reader_spec.rb +20 -0
  52. data/spec/readers/crossref_reader_spec.rb +21 -5
  53. data/spec/readers/datacite_reader_spec.rb +150 -10
  54. data/spec/readers/schema_org_reader_spec.rb +15 -1
  55. data/spec/utils_spec.rb +108 -0
  56. data/spec/writers/bibtex_writer_spec.rb +6 -0
  57. data/spec/writers/citeproc_writer_spec.rb +10 -0
  58. data/spec/writers/crosscite_writer_spec.rb +5 -1
  59. data/spec/writers/datacite_json_writer_spec.rb +5 -1
  60. data/spec/writers/datacite_writer_spec.rb +30 -6
  61. data/spec/writers/schema_org_writer_spec.rb +11 -0
  62. metadata +32 -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",
@@ -212,6 +212,12 @@ describe Bolognese::Metadata, vcr: true do
212
212
  expect(response).to eq("http://creativecommons.org/publicdomain/zero/1.0")
213
213
  end
214
214
 
215
+ it "with trailing slash and to https" do
216
+ url = "http://creativecommons.org/publicdomain/zero/1.0/"
217
+ response = subject.normalize_url(url, https: true)
218
+ expect(response).to eq("https://creativecommons.org/publicdomain/zero/1.0")
219
+ end
220
+
215
221
  it "uri" do
216
222
  url = "info:eu-repo/semantics/openAccess"
217
223
  response = subject.normalize_url(url)
@@ -219,6 +225,26 @@ describe Bolognese::Metadata, vcr: true do
219
225
  end
220
226
  end
221
227
 
228
+ context "normalize cc url" do
229
+ it "with trailing slash" do
230
+ url = "http://creativecommons.org/publicdomain/zero/1.0/"
231
+ response = subject.normalize_cc_url(url)
232
+ expect(response).to eq("https://creativecommons.org/publicdomain/zero/1.0/legalcode")
233
+ end
234
+
235
+ it "with trailing slash and to https" do
236
+ url = "http://creativecommons.org/publicdomain/zero/1.0/"
237
+ response = subject.normalize_cc_url(url)
238
+ expect(response).to eq("https://creativecommons.org/publicdomain/zero/1.0/legalcode")
239
+ end
240
+
241
+ it "not found" do
242
+ url = "http://creativecommons.org/publicdomain/zero/2.0/"
243
+ response = subject.normalize_cc_url(url)
244
+ expect(response).to eq("https://creativecommons.org/publicdomain/zero/2.0")
245
+ end
246
+ end
247
+
222
248
  context "normalize issn" do
223
249
  it "from array" do
224
250
  input = [{"media_type"=>"print", "__content__"=>"13040855"}, {"media_type"=>"electronic", "__content__"=>"21468427"}]
@@ -481,4 +507,86 @@ describe Bolognese::Metadata, vcr: true do
481
507
  expect(response).to eq("https://raw.githubusercontent.com/datacite/metadata-reports/master/software/codemeta.json")
482
508
  end
483
509
  end
510
+
511
+ context "spdx" do
512
+ it "name_to_spdx exists" do
513
+ name = "Creative Commons Attribution 4.0 International"
514
+ response = subject.name_to_spdx(name)
515
+ expect(response).to eq({"rights"=>"Creative Commons Attribution 4.0 International", "rightsUri"=>"https://creativecommons.org/licenses/by/4.0/legalcode", "rightsIdentifier"=>"CC-BY-4.0", "rightsIdentifierScheme"=>"SPDX", "schemeUri"=>"https://spdx.org/licenses/"})
516
+ end
517
+
518
+ it "name_to_spdx id" do
519
+ name = "CC-BY-4.0"
520
+ response = subject.name_to_spdx(name)
521
+ expect(response).to eq({"rights"=>"Creative Commons Attribution 4.0 International", "rightsUri"=>"https://creativecommons.org/licenses/by/4.0/legalcode", "rightsIdentifier"=>"CC-BY-4.0", "rightsIdentifierScheme"=>"SPDX", "schemeUri"=>"https://spdx.org/licenses/"})
522
+ end
523
+
524
+ it "hsh_to_spdx id" do
525
+ hsh = { "rightsIdentifier" => "CC-BY-4.0" }
526
+ response = subject.hsh_to_spdx(hsh)
527
+ expect(response).to eq({"rights"=>"Creative Commons Attribution 4.0 International", "rightsUri"=>"https://creativecommons.org/licenses/by/4.0/legalcode", "rightsIdentifier"=>"CC-BY-4.0", "rightsIdentifierScheme"=>"SPDX", "schemeUri"=>"https://spdx.org/licenses/"})
528
+ end
529
+
530
+ it "hsh_to_spdx url" do
531
+ hsh = { "rightsURI" => "http://creativecommons.org/licenses/by-nc/4.0/legalcode" }
532
+ response = subject.hsh_to_spdx(hsh)
533
+ expect(response).to eq("rights"=>"Creative Commons Attribution Non Commercial 4.0 International", "rightsUri"=>"https://creativecommons.org/licenses/by-nc/4.0/legalcode", "rightsIdentifier"=>"CC-BY-NC-4.0", "rightsIdentifierScheme"=>"SPDX", "schemeUri"=>"https://spdx.org/licenses/")
534
+ end
535
+
536
+ it "hsh_to_spdx not found" do
537
+ hsh = { "rightsURI" => "info:eu-repo/semantics/openAccess" }
538
+ response = subject.hsh_to_spdx(hsh)
539
+ expect(response).to eq({"rightsUri"=>"info:eu-repo/semantics/openAccess"})
540
+ end
541
+ end
542
+
543
+ context "fos" do
544
+ it "name_to_fos match" do
545
+ name = "Biological sciences"
546
+ response = subject.name_to_fos(name)
547
+ expect(response).to eq([{"subject"=>"Biological sciences"},
548
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
549
+ "subject"=>"FOS: Biological sciences",
550
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
551
+ end
552
+
553
+ it "name_to_fos for match" do
554
+ name = "Statistics"
555
+ response = subject.name_to_fos(name)
556
+ expect(response).to eq([{"subject"=>"Statistics"},
557
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
558
+ "subject"=>"FOS: Mathematics",
559
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
560
+ end
561
+
562
+ it "name_to_fos no match" do
563
+ name = "Random tag"
564
+ response = subject.name_to_fos(name)
565
+ expect(response).to eq([{"subject"=>"Random tag"}])
566
+ end
567
+
568
+ it "hsh_to_fos match" do
569
+ hsh = { "__content__" => "Biological sciences" }
570
+ response = subject.hsh_to_fos(hsh)
571
+ expect(response).to eq([{"subject"=>"Biological sciences"},
572
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
573
+ "subject"=>"FOS: Biological sciences",
574
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
575
+ end
576
+
577
+ it "hsh_to_fos for match" do
578
+ hsh = { "__content__" => "Statistics" }
579
+ response = subject.hsh_to_fos(hsh)
580
+ expect(response).to eq([{"subject"=>"Statistics"},
581
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
582
+ "subject"=>"FOS: Mathematics",
583
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
584
+ end
585
+
586
+ it "hsh_to_fos no match" do
587
+ hsh = { "__content__"=>"Random tag" }
588
+ response = subject.hsh_to_fos(hsh)
589
+ expect(response).to eq([{"subject"=>"Random tag"}])
590
+ end
591
+ end
484
592
  end
@@ -16,6 +16,7 @@ describe Bolognese::Metadata, vcr: true do
16
16
  expect(bibtex[:author]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
17
17
  expect(bibtex[:journal]).to eq("eLife")
18
18
  expect(bibtex[:year]).to eq("2014")
19
+ expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
19
20
  end
20
21
 
21
22
  it "with pages" do
@@ -31,6 +32,7 @@ describe Bolognese::Metadata, vcr: true do
31
32
  expect(bibtex[:journal]).to eq("Pulmonary Medicine")
32
33
  expect(bibtex[:pages]).to eq("1-7")
33
34
  expect(bibtex[:year]).to eq("2012")
35
+ expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
34
36
  end
35
37
 
36
38
  it "text" do
@@ -71,6 +73,7 @@ describe Bolognese::Metadata, vcr: true do
71
73
  expect(bibtex[:publisher]).to eq("DataCite")
72
74
  expect(bibtex[:keywords]).to eq("faraday, excon, net/http")
73
75
  expect(bibtex[:year]).to eq("2017")
76
+ expect(bibtex[:copyright]).to eq("MIT License")
74
77
  end
75
78
 
76
79
  it "BlogPosting from string" do
@@ -111,6 +114,7 @@ describe Bolognese::Metadata, vcr: true do
111
114
  expect(bibtex[:author]).to eq("Ollomo, Benjamin and Durand, Patrick and Prugnolle, Franck and Douzery, Emmanuel J. P. and Arnathau, Céline and Nkoghe, Dieudonné and Leroy, Eric and Renaud, François")
112
115
  expect(bibtex[:publisher]).to eq("Dryad Digital Repository")
113
116
  expect(bibtex[:year]).to eq("2011")
117
+ expect(bibtex[:copyright]).to eq("Creative Commons Zero v1.0 Universal")
114
118
  end
115
119
 
116
120
  it "from schema_org" do
@@ -139,6 +143,7 @@ describe Bolognese::Metadata, vcr: true do
139
143
  expect(bibtex[:publisher]).to eq("eyemovement.org")
140
144
  expect(bibtex[:keywords]).to eq("eye tracking; eye movements; scanpaths; eye movement sequence; web pages; visual elements; web pages; scanpath analysis techniques; scanpath analysis; pattern detection; common scanpaths")
141
145
  expect(bibtex[:year]).to eq("2015")
146
+ expect(bibtex[:copyright]).to eq("Creative Commons Attribution 4.0 International")
142
147
  end
143
148
 
144
149
  it "keywords subject scheme" do
@@ -150,6 +155,7 @@ describe Bolognese::Metadata, vcr: true do
150
155
  expect(bibtex[:doi]).to eq("10.1594/pangaea.721193")
151
156
  expect(bibtex[:keywords]).to eq("Animalia, Bottles or small containers/Aquaria ( 20 L), Calcification/Dissolution, Coast and continental shelf, Crassostrea gigas, Development, Growth/Morphology, Laboratory experiment, Mollusca, North Pacific, Pelagos, Single species, Temperate, Zooplankton, Experimental treatment, Carbonate system computation flag, Temperature, water, Salinity, pH, Alkalinity, total, Carbon, inorganic, dissolved, Carbon dioxide, Bicarbonate ion, Carbonate ion, Partial pressure of carbon dioxide (water) at sea surface temperature (wet air), Fugacity of carbon dioxide (water) at sea surface temperature (wet air), Aragonite saturation state, Calcite saturation state, Proportion, Crassostrea gigas, larvae length, Crassostrea gigas, larvae height, Crassostrea gigas, non mineralized, Crassostrea gigas, partially mineralized, Crassostrea gigas, fully mineralized, Calculated using seacarb after Nisumaa et al. (2010), Refractometer (Atago 100-S), pH meter (Mettler Toledo), pH meter (PHM290, Radiometer), Measured, European Project on Ocean Acidification (EPOCA), European network of excellence for Ocean Ecosystems Analysis (EUR-OCEANS), Ocean Acidification International Coordination Centre (OA-ICC)")
152
157
  expect(bibtex[:year]).to eq("2007")
158
+ expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
153
159
  end
154
160
 
155
161
  it "author is organization" do
@@ -24,6 +24,7 @@ describe Bolognese::Metadata, vcr: true do
24
24
  expect(json["publisher"]).to eq("Dryad Digital Repository")
25
25
  expect(json["issued"]).to eq("date-parts" => [[2011]])
26
26
  expect(json["submitted"]).to be_nil
27
+ expect(json["copyright"]).to eq("Creative Commons Zero v1.0 Universal")
27
28
  end
28
29
 
29
30
  it "BlogPosting" do
@@ -83,6 +84,7 @@ describe Bolognese::Metadata, vcr: true do
83
84
  expect(json["container-title"]).to eq("eLife")
84
85
  expect(json["volume"]).to eq("3")
85
86
  expect(json["issued"]).to eq("date-parts" => [[2014, 2, 11]])
87
+ expect(json["copyright"]).to eq("Creative Commons Attribution 3.0 Unported")
86
88
  end
87
89
 
88
90
  it "software" do
@@ -92,6 +94,7 @@ describe Bolognese::Metadata, vcr: true do
92
94
  expect(json["type"]).to eq("article")
93
95
  expect(json["DOI"]).to eq("10.6084/m9.figshare.4906367.v1")
94
96
  expect(json["title"]).to eq("Scimag catalogue of LibGen as of January 1st, 2014")
97
+ expect(json["copyright"]).to eq("Creative Commons Zero v1.0 Universal")
95
98
  end
96
99
 
97
100
  it "software w/version" do
@@ -101,6 +104,7 @@ describe Bolognese::Metadata, vcr: true do
101
104
  expect(json["type"]).to eq("article")
102
105
  expect(json["DOI"]).to eq("10.5281/zenodo.2598836")
103
106
  expect(json["version"]).to eq("1.0.0")
107
+ expect(json["copyright"]).to eq("Open Access")
104
108
  end
105
109
 
106
110
  it "software w/version from datacite_json" do
@@ -110,6 +114,7 @@ describe Bolognese::Metadata, vcr: true do
110
114
  expect(json["type"]).to eq("article")
111
115
  expect(json["DOI"]).to eq("10.5281/ZENODO.2598836")
112
116
  expect(json["version"]).to eq("1.0.0")
117
+ expect(json["copyright"]).to eq("Open Access")
113
118
  end
114
119
 
115
120
  it "multiple abstracts" do
@@ -141,6 +146,7 @@ describe Bolognese::Metadata, vcr: true do
141
146
  expect(json["volume"]).to eq("2012")
142
147
  expect(json["page"]).to eq("1-7")
143
148
  expect(json["issued"]).to eq("date-parts"=>[[2012]])
149
+ expect(json["copyright"]).to eq("Creative Commons Attribution 3.0 Unported")
144
150
  end
145
151
 
146
152
  it "with only first page" do
@@ -157,6 +163,7 @@ describe Bolognese::Metadata, vcr: true do
157
163
  expect(json["volume"]).to eq("14")
158
164
  expect(json["page"]).to eq("e0214986")
159
165
  expect(json["issued"]).to eq("date-parts"=>[[2019, 5, 8]])
166
+ expect(json["copyright"]).to eq("Creative Commons Zero v1.0 Universal")
160
167
  end
161
168
 
162
169
  it "missing creator" do
@@ -173,6 +180,7 @@ describe Bolognese::Metadata, vcr: true do
173
180
  expect(json["publisher"]).to eq("MDPI AG")
174
181
  expect(json["page"]).to eq("15")
175
182
  expect(json["issued"]).to eq("date-parts"=>[[2018, 4, 9]])
183
+ expect(json["copyright"]).to eq("Creative Commons Attribution 4.0 International")
176
184
  end
177
185
 
178
186
  it "container title" do
@@ -226,6 +234,7 @@ describe Bolognese::Metadata, vcr: true do
226
234
  expect(json["author"]).to eq([{"family"=>"Fenner", "given"=>"Martin"}])
227
235
  expect(json["publisher"]).to eq("DataCite")
228
236
  expect(json["issued"]).to eq("date-parts" => [[2017, 2, 24]])
237
+ expect(json["copyright"]).to eq("MIT License")
229
238
  end
230
239
 
231
240
  it "keywords subject scheme" do
@@ -236,6 +245,7 @@ describe Bolognese::Metadata, vcr: true do
236
245
  expect(json["id"]).to eq("https://doi.org/10.1594/pangaea.721193")
237
246
  expect(json["DOI"]).to eq("10.1594/pangaea.721193")
238
247
  expect(json["categories"]).to include("Animalia", "Bottles or small containers/Aquaria ( 20 L)", "Calcification/Dissolution", "Coast and continental shelf", "Development", "Growth/Morphology", "Laboratory experiment", "Mollusca", "Pelagos", "Single species", "Temperate", "Zooplankton", "Experimental treatment", "Carbonate system computation flag", "Temperature, water", "Salinity", "pH", "Alkalinity, total", "Carbon, inorganic, dissolved", "Carbon dioxide", "Bicarbonate ion", "Carbonate ion", "Partial pressure of carbon dioxide (water) at sea surface temperature (wet air)", "Fugacity of carbon dioxide (water) at sea surface temperature (wet air)", "Aragonite saturation state", "Calcite saturation state", "Proportion", "Crassostrea gigas, larvae length", "Crassostrea gigas, larvae height", "Crassostrea gigas, non mineralized", "Crassostrea gigas, partially mineralized", "Crassostrea gigas, fully mineralized", "Calculated using seacarb after Nisumaa et al. (2010)", "Refractometer (Atago 100-S)", "pH meter (Mettler Toledo)", "pH meter (PHM290, Radiometer)", "Measured", "European Project on Ocean Acidification (EPOCA)", "European network of excellence for Ocean Ecosystems Analysis (EUR-OCEANS)", "Ocean Acidification International Coordination Centre (OA-ICC)")
248
+ expect(json["copyright"]).to eq("Creative Commons Attribution 3.0 Unported")
239
249
  end
240
250
 
241
251
  it "organization author" do
@@ -14,7 +14,11 @@ describe Bolognese::Metadata, vcr: true do
14
14
  expect(crosscite.fetch("related_identifiers").length).to eq(27)
15
15
  expect(crosscite.fetch("related_identifiers").first).to eq("relatedIdentifier"=>"2050-084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection")
16
16
  expect(crosscite.fetch("related_identifiers").last).to eq("relatedIdentifier"=>"10.1038/ncb2764", "relatedIdentifierType"=>"DOI", "relationType"=>"References")
17
- expect(crosscite.fetch("rights_list")).to eq([{"rightsUri"=>"http://creativecommons.org/licenses/by/3.0"}])
17
+ expect(crosscite.fetch("rights_list")).to eq([{"rights"=>"Creative Commons Attribution 3.0 Unported",
18
+ "rightsIdentifier"=>"CC-BY-3.0",
19
+ "rightsIdentifierScheme"=>"SPDX",
20
+ "rightsUri"=>"https://creativecommons.org/licenses/by/3.0/legalcode",
21
+ "schemeUri"=>"https://spdx.org/licenses/"}])
18
22
  end
19
23
 
20
24
  it "with ORCID ID" do
@@ -13,7 +13,11 @@ describe Bolognese::Metadata, vcr: true do
13
13
  expect(datacite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
14
14
  expect(datacite.fetch("relatedIdentifiers").length).to eq(27)
15
15
  expect(datacite.fetch("relatedIdentifiers").first).to eq("relatedIdentifier"=>"2050-084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection")
16
- expect(datacite.fetch("rightsList")).to eq([{"rightsUri"=>"http://creativecommons.org/licenses/by/3.0"}])
16
+ expect(datacite.fetch("rightsList")).to eq([{"rights"=>"Creative Commons Attribution 3.0 Unported",
17
+ "rightsIdentifier"=>"CC-BY-3.0",
18
+ "rightsIdentifierScheme"=>"SPDX",
19
+ "rightsUri"=>"https://creativecommons.org/licenses/by/3.0/legalcode",
20
+ "schemeUri"=>"https://spdx.org/licenses/"}])
17
21
  end
18
22
 
19
23
  it "with ORCID ID" do
@@ -14,7 +14,7 @@ describe Bolognese::Metadata, vcr: true do
14
14
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
15
15
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X", "resourceTypeGeneral"=>"Collection")
16
16
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"10.1038/nature02100")
17
- expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
17
+ expect(datacite.dig("rightsList", "rights")).to eq("rightsURI"=>"https://creativecommons.org/licenses/by/3.0/legalcode", "rightsIdentifier"=>"CC-BY-3.0", "rightsIdentifierScheme"=>"SPDX", "schemeURI"=>"https://spdx.org/licenses/", "__content__"=>"Creative Commons Attribution 3.0 Unported")
18
18
  expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
19
19
  expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
20
20
  end
@@ -160,10 +160,18 @@ describe Bolognese::Metadata, vcr: true do
160
160
  expect(subject.creators.length).to eq(20)
161
161
  expect(subject.creators.first).to eq("nameType"=>"Personal", "familyName" => "Paglione", "givenName" => "Laura", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-3188-6273", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name" => "Paglione, Laura", "affiliation" => [])
162
162
  expect(subject.titles).to eq([{"title"=>"Recommendation of: ORCID Works Metadata Working Group"}])
163
- expect(subject.rights_list).to eq([{"rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0", "rights"=>"CC-0"}])
163
+ expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Zero v1.0 Universal",
164
+ "rightsIdentifier"=>"CC0-1.0",
165
+ "rightsIdentifierScheme"=>"SPDX",
166
+ "rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0/legalcode",
167
+ "schemeUri"=>"https://spdx.org/licenses/"}])
164
168
  expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
165
169
  expect(subject.publication_year).to eq("2017")
166
170
  expect(subject.publisher).to eq("Figshare")
171
+ expect(subject.subjects).to eq([{"subject"=>"Information Systems"},
172
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
173
+ "subject"=>"FOS: Computer and information sciences",
174
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
167
175
  expect(subject.agency).to eq("DataCite")
168
176
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
169
177
  expect(subject.datacite).to end_with("</resource>")
@@ -178,10 +186,18 @@ describe Bolognese::Metadata, vcr: true do
178
186
  expect(subject.creators.length).to eq(20)
179
187
  expect(subject.creators.first).to eq("nameType" => "Personal", "familyName" => "Paglione", "givenName" => "Laura", "name" => "Paglione, Laura", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-3188-6273", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],"affiliation" => [])
180
188
  expect(subject.titles).to eq([{"title"=>"Recommendation of: ORCID Works Metadata Working Group"}])
181
- expect(subject.rights_list).to eq([{"rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0", "rights"=>"CC-0"}])
189
+ expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Zero v1.0 Universal",
190
+ "rightsIdentifier"=>"CC0-1.0",
191
+ "rightsIdentifierScheme"=>"SPDX",
192
+ "rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0/legalcode",
193
+ "schemeUri"=>"https://spdx.org/licenses/"}])
182
194
  expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
183
195
  expect(subject.publication_year).to eq("2017")
184
196
  expect(subject.publisher).to eq("Figshare")
197
+ expect(subject.subjects).to eq([{"subject"=>"Information Systems"},
198
+ {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
199
+ "subject"=>"FOS: Computer and information sciences",
200
+ "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
185
201
  expect(subject.agency).to eq("DataCite")
186
202
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
187
203
  expect(subject.datacite).to end_with("</resource>")
@@ -199,7 +215,11 @@ describe Bolognese::Metadata, vcr: true do
199
215
  {"identifier"=>
200
216
  "Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.",
201
217
  "identifierType"=>"citation"}])
202
- expect(subject.rights_list).to eq([{"rightsUri"=>"http://creativecommons.org/publicdomain/zero/1.0"}])
218
+ expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Zero v1.0 Universal",
219
+ "rightsIdentifier"=>"CC0-1.0",
220
+ "rightsIdentifierScheme"=>"SPDX",
221
+ "rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0/legalcode",
222
+ "schemeUri"=>"https://spdx.org/licenses/"}])
203
223
  expect(subject.dates).to eq([{"date"=>"2011", "dateType"=>"Issued"}])
204
224
  expect(subject.publication_year).to eq("2011")
205
225
  expect(subject.related_identifiers.length).to eq(6)
@@ -222,7 +242,11 @@ describe Bolognese::Metadata, vcr: true do
222
242
  expect(subject.creators.first).to eq("affiliation"=>[{"name"=>"UC Merced"}, {"name"=>"NSF"}], "familyName"=>"Bales", "givenName"=>"Roger", "name"=>"Bales, Roger", "nameType"=>"Personal", "nameIdentifiers"=>[])
223
243
  expect(subject.titles).to eq([{"title"=>"Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature"}])
224
244
  expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.6071/z7wc73", "identifierType"=>"DOI"}])
225
- expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Attribution 4.0 International (CC BY 4.0)", "rightsUri"=>"https://creativecommons.org/licenses/by/4.0"}])
245
+ expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Attribution 4.0 International",
246
+ "rightsIdentifier"=>"CC-BY-4.0",
247
+ "rightsIdentifierScheme"=>"SPDX",
248
+ "rightsUri"=>"https://creativecommons.org/licenses/by/4.0/legalcode",
249
+ "schemeUri"=>"https://spdx.org/licenses/"}])
226
250
  expect(subject.dates).to eq([{"date"=>"2014-10-17", "dateType"=>"Updated"}, {"date"=>"2016-03-14T17:02:02Z", "dateType"=>"Available"}, {"date"=>"2013", "dateType"=>"Issued"}])
227
251
  expect(subject.publication_year).to eq("2013")
228
252
  expect(subject.publisher).to eq("UC Merced")
@@ -282,7 +306,7 @@ describe Bolognese::Metadata, vcr: true do
282
306
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
283
307
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("__content__"=>"2050-084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection")
284
308
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"10.1038/nature02100")
285
- expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
309
+ expect(datacite.dig("rightsList", "rights")).to eq("rightsURI"=>"https://creativecommons.org/licenses/by/3.0/legalcode", "rightsIdentifier"=>"CC-BY-3.0", "rightsIdentifierScheme"=>"SPDX", "schemeURI"=>"https://spdx.org/licenses/", "__content__"=>"Creative Commons Attribution 3.0 Unported")
286
310
  expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
287
311
  expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
288
312
  end
@@ -23,6 +23,7 @@ describe Bolognese::Metadata, vcr: true do
23
23
  {"name"=>"University of Lausanne",
24
24
  "@type"=>"Organization",
25
25
  "@id"=>"https://doi.org/10.13039/501100006390"}])
26
+ expect(json["license"]).to eq("https://creativecommons.org/licenses/by/3.0/legalcode")
26
27
  end
27
28
 
28
29
  it "maremma schema.org JSON" do
@@ -41,6 +42,7 @@ describe Bolognese::Metadata, vcr: true do
41
42
  json = JSON.parse(subject.schema_org)
42
43
  expect(json["@id"]).to eq("https://doi.org/10.5281/zenodo.48440")
43
44
  expect(json["name"]).to eq("Analysis Tools For Crossover Experiment Of Ui Using Choice Architecture")
45
+ expect(json["license"]).to eq(["https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode", "info:eu-repo/semantics/openAccess"])
44
46
  end
45
47
 
46
48
  it "Schema.org JSON isReferencedBy" do
@@ -50,6 +52,8 @@ describe Bolognese::Metadata, vcr: true do
50
52
  expect(json["@id"]).to eq("https://doi.org/10.5061/dryad.8515")
51
53
  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
54
  "isBasedOn" => [{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446", "@type"=>"ScholarlyArticle"}, {"@type"=>"ScholarlyArticle", "identifier"=>{"@type"=>"PropertyValue", "propertyID"=>"PMID", "value"=>"19478877"}}])
55
+ expect(json["license"]).to eq("https://creativecommons.org/publicdomain/zero/1.0/legalcode")
56
+ expect(json["keywords"]).to eq("Phylogeny, Malaria, Parasites, Taxonomy, Mitochondrial genome, Africa, Plasmodium")
53
57
  end
54
58
 
55
59
  it "Schema.org JSON IsSupplementTo" do
@@ -81,6 +85,7 @@ describe Bolognese::Metadata, vcr: true do
81
85
  "affiliation"=>{"@type"=>"Organization", "name"=>"NCEAS"}},
82
86
  {"name"=>"University Of California, Santa Barbara", "@type"=>"Organization"}])
83
87
  expect(json["version"]).to eq("2.0.0")
88
+ expect(json["keywords"]).to eq("data sharing, data repository, DataONE")
84
89
  end
85
90
 
86
91
  it "Funding" do
@@ -91,6 +96,7 @@ describe Bolognese::Metadata, vcr: true do
91
96
  expect(json["hasPart"].length).to eq(25)
92
97
  expect(json["hasPart"].first).to eq("@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5281/zenodo.30799")
93
98
  expect(json["funder"]).to eq("@id"=>"https://doi.org/10.13039/501100000780", "@type"=>"Organization", "name"=>"European Commission")
99
+ expect(json["license"]).to eq("https://creativecommons.org/licenses/by/4.0/legalcode")
94
100
  end
95
101
 
96
102
  it "Funding OpenAIRE" do
@@ -99,6 +105,7 @@ describe Bolognese::Metadata, vcr: true do
99
105
  json = JSON.parse(subject.schema_org)
100
106
  expect(json["@id"]).to eq("https://doi.org/10.5281/zenodo.1239")
101
107
  expect(json["funder"]).to eq("@id"=>"https://doi.org/10.13039/501100000780", "@type"=>"Organization", "name"=>"European Commission")
108
+ expect(json["license"]).to eq(["https://creativecommons.org/publicdomain/zero/1.0/legalcode", "info:eu-repo/semantics/openAccess"])
102
109
  end
103
110
 
104
111
  it "subject scheme" do
@@ -117,6 +124,7 @@ describe Bolognese::Metadata, vcr: true do
117
124
  expect(json["@id"]).to eq("https://doi.org/10.1594/pangaea.721193")
118
125
  expect(json["name"]).to eq("Seawater carbonate chemistry and processes during experiments with Crassostrea gigas, 2007, supplement to: Kurihara, Haruko; Kato, Shoji; Ishimatsu, Atsushi (2007): Effects of increased seawater pCO2 on early development of the oyster Crassostrea gigas. Aquatic Biology, 1(1), 91-98")
119
126
  expect(json["keywords"]).to eq("Animalia, Bottles or small containers/Aquaria ( 20 L), Calcification/Dissolution, Coast and continental shelf, Crassostrea gigas, Development, Growth/Morphology, Laboratory experiment, Mollusca, North Pacific, Pelagos, Single species, Temperate, Zooplankton, Experimental treatment, Carbonate system computation flag, Temperature, water, Salinity, pH, Alkalinity, total, Carbon, inorganic, dissolved, Carbon dioxide, Bicarbonate ion, Carbonate ion, Partial pressure of carbon dioxide (water) at sea surface temperature (wet air), Fugacity of carbon dioxide (water) at sea surface temperature (wet air), Aragonite saturation state, Calcite saturation state, Proportion, Crassostrea gigas, larvae length, Crassostrea gigas, larvae height, Crassostrea gigas, non mineralized, Crassostrea gigas, partially mineralized, Crassostrea gigas, fully mineralized, Calculated using seacarb after Nisumaa et al. (2010), Refractometer (Atago 100-S), pH meter (Mettler Toledo), pH meter (PHM290, Radiometer), Measured, European Project on Ocean Acidification (EPOCA), European network of excellence for Ocean Ecosystems Analysis (EUR-OCEANS), Ocean Acidification International Coordination Centre (OA-ICC)")
127
+ expect(json["license"]).to eq("https://creativecommons.org/licenses/by/3.0/legalcode")
120
128
  end
121
129
 
122
130
  it "author is organization" do
@@ -208,6 +216,7 @@ describe Bolognese::Metadata, vcr: true do
208
216
  "propertyID"=>"URL",
209
217
  "value"=>"https://schema.datacite.org/meta/kernel-4.2/example/datacite-example-full-v4.2.xml"}]
210
218
  )
219
+ expect(json["license"]).to eq("https://creativecommons.org/publicdomain/zero/1.0/legalcode")
211
220
  end
212
221
 
213
222
  it "geo_location_point" do
@@ -232,6 +241,7 @@ describe Bolognese::Metadata, vcr: true do
232
241
  {"@type"=>"GeoShape",
233
242
  "address"=>"Providence Creek (Lower, Upper and P301)",
234
243
  "box"=>"37.046 -119.211 37.075 -119.182"}}])
244
+ expect(json["license"]).to eq("https://creativecommons.org/licenses/by/4.0/legalcode")
235
245
  end
236
246
 
237
247
  it "geo_location_box" do
@@ -250,6 +260,7 @@ describe Bolognese::Metadata, vcr: true do
250
260
  expect(json["includedInDataCatalog"]).to be_nil
251
261
  expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.1594/pangaea.842237")
252
262
  expect(json["spatialCoverage"]).to eq("@type"=>"Place", "geo"=>{"@type"=>"GeoShape", "box"=>"-64.3088 -168.5182 79.6753 174.9006"})
263
+ expect(json["license"]).to eq("https://creativecommons.org/licenses/by/3.0/legalcode")
253
264
  end
254
265
 
255
266
  it "geo_location_polygon" do