bolognese 1.11.5 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -4
  3. data/bolognese.gemspec +1 -0
  4. data/lib/bolognese/datacite_utils.rb +17 -9
  5. data/lib/bolognese/metadata.rb +1 -1
  6. data/lib/bolognese/metadata_utils.rb +1 -1
  7. data/lib/bolognese/readers/bibtex_reader.rb +2 -2
  8. data/lib/bolognese/readers/citeproc_reader.rb +1 -1
  9. data/lib/bolognese/readers/codemeta_reader.rb +2 -2
  10. data/lib/bolognese/readers/crosscite_reader.rb +4 -1
  11. data/lib/bolognese/readers/crossref_reader.rb +3 -4
  12. data/lib/bolognese/readers/datacite_json_reader.rb +4 -1
  13. data/lib/bolognese/readers/datacite_reader.rb +19 -3
  14. data/lib/bolognese/readers/npm_reader.rb +1 -1
  15. data/lib/bolognese/readers/ris_reader.rb +2 -2
  16. data/lib/bolognese/readers/schema_org_reader.rb +3 -2
  17. data/lib/bolognese/utils.rb +16 -4
  18. data/lib/bolognese/version.rb +1 -1
  19. data/lib/bolognese/writers/bibtex_writer.rb +1 -1
  20. data/lib/bolognese/writers/codemeta_writer.rb +1 -1
  21. data/lib/bolognese/writers/csv_writer.rb +1 -1
  22. data/lib/bolognese/writers/datacite_json_writer.rb +6 -1
  23. data/lib/bolognese/writers/jats_writer.rb +3 -3
  24. data/lib/bolognese/writers/ris_writer.rb +1 -1
  25. data/lib/bolognese/writers/schema_org_writer.rb +1 -1
  26. data/resources/kernel-4/include/datacite-relationType-v4.xsd +2 -0
  27. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +2 -0
  28. data/resources/kernel-4/metadata.xsd +11 -7
  29. data/resources/kernel-4.5/include/datacite-contributorType-v4.xsd +35 -0
  30. data/resources/kernel-4.5/include/datacite-dateType-v4.xsd +25 -0
  31. data/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd +19 -0
  32. data/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd +16 -0
  33. data/resources/kernel-4.5/include/datacite-nameType-v4.xsd +10 -0
  34. data/resources/kernel-4.5/include/datacite-numberType-v4.xsd +12 -0
  35. data/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd +34 -0
  36. data/resources/kernel-4.5/include/datacite-relationType-v4.xsd +53 -0
  37. data/resources/kernel-4.5/include/datacite-resourceType-v4.xsd +45 -0
  38. data/resources/kernel-4.5/include/datacite-titleType-v4.xsd +14 -0
  39. data/resources/kernel-4.5/include/xml.xsd +286 -0
  40. data/resources/kernel-4.5/metadata.xsd +711 -0
  41. data/spec/fixtures/datacite-example-full-v4.5.xml +255 -0
  42. data/spec/fixtures/datacite-seriesinformation.xml +7 -2
  43. data/spec/readers/bibtex_reader_spec.rb +2 -0
  44. data/spec/readers/citeproc_reader_spec.rb +3 -0
  45. data/spec/readers/codemeta_reader_spec.rb +4 -4
  46. data/spec/readers/crosscite_reader_spec.rb +2 -0
  47. data/spec/readers/crossref_reader_spec.rb +41 -41
  48. data/spec/readers/datacite_json_reader_spec.rb +2 -0
  49. data/spec/readers/datacite_reader_spec.rb +73 -42
  50. data/spec/readers/npm_reader_spec.rb +2 -0
  51. data/spec/readers/ris_reader_spec.rb +3 -0
  52. data/spec/readers/schema_org_reader_spec.rb +11 -11
  53. data/spec/writers/crosscite_writer_spec.rb +7 -0
  54. data/spec/writers/datacite_json_writer_spec.rb +38 -0
  55. data/spec/writers/datacite_writer_spec.rb +84 -5
  56. data/spec/writers/jats_writer_spec.rb +8 -0
  57. data/spec/writers/rdf_xml_writer_spec.rb +7 -0
  58. data/spec/writers/turtle_writer_spec.rb +18 -0
  59. metadata +29 -2
@@ -18,6 +18,9 @@ describe Bolognese::Metadata, vcr: true do
18
18
  "rightsIdentifierScheme"=>"SPDX",
19
19
  "rightsUri"=>"https://creativecommons.org/licenses/by/3.0/legalcode",
20
20
  "schemeUri"=>"https://spdx.org/licenses/"}])
21
+ # REVERT the publisher line to the commented line for the schema 4.5 release
22
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"eLife Sciences Publications, Ltd"})
23
+ expect(datacite.fetch("publisher")).to eq("eLife Sciences Publications, Ltd")
21
24
  end
22
25
 
23
26
  it "with ORCID ID" do
@@ -28,6 +31,9 @@ describe Bolognese::Metadata, vcr: true do
28
31
  expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
29
32
  expect(datacite.fetch("creators").length).to eq(7)
30
33
  expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi", "affiliation" => [{"name"=>"Department of Medicine, Veterans Affairs Palo Alto Health Care System, 3801 Miranda Avenue MC-, Palo Alto, CA 94304-1207, USA"}, {"name"=>"Occupational Health Strategic Health Care Group, Office of Public Health, Veterans Health Administration, Washington, DC 20006, USA"}, {"name"=>"Division of Emergency Medicine, Stanford University School of Medicine, Stanford, CA 94304, USA"}, {"name"=>"War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA"}])
34
+ # REVERT the publisher line to the commented line for the schema 4.5 release
35
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"Hindawi Limited"})
36
+ expect(datacite.fetch("publisher")).to eq("Hindawi Limited")
31
37
  end
32
38
 
33
39
  it "Crossref DOI" do
@@ -39,6 +45,9 @@ describe Bolognese::Metadata, vcr: true do
39
45
  expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
40
46
  expect(datacite.fetch("creators").length).to eq(5)
41
47
  expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar")
48
+ # REVERT the publisher line to the commented line for the schema 4.5 release
49
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."})
50
+ expect(datacite.fetch("publisher")).to eq("{eLife} Sciences Organisation, Ltd.")
42
51
  end
43
52
 
44
53
  it "BlogPosting Citeproc JSON" do
@@ -49,6 +58,9 @@ describe Bolognese::Metadata, vcr: true do
49
58
  expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}])
50
59
  expect(datacite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food")
51
60
  expect(datacite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}])
61
+ # REVERT the publisher line to the commented line for the schema 4.5 release
62
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"})
63
+ expect(datacite.fetch("publisher")).to eq("DataCite")
52
64
  end
53
65
 
54
66
  it "rdataone" do
@@ -60,6 +72,9 @@ describe Bolognese::Metadata, vcr: true do
60
72
  expect(datacite.fetch("creators").first).to eq("affiliation"=>[{"name"=>"NCEAS"}], "nameType"=>"Personal", "name" => "Jones, Matt",
61
73
  "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "givenName"=>"Matt", "familyName"=>"Jones")
62
74
  expect(datacite.fetch("version")).to eq("2.0.0")
75
+ # REVERT the publisher line to the commented line for the schema 4.5 release
76
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"https://cran.r-project.org"})
77
+ expect(datacite.fetch("publisher")).to eq("https://cran.r-project.org")
63
78
  end
64
79
 
65
80
  it "maremma" do
@@ -75,6 +90,9 @@ describe Bolognese::Metadata, vcr: true do
75
90
  [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738",
76
91
  "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
77
92
  "nameType"=>"Personal"}])
93
+ # REVERT the publisher line to the commented line for the schema 4.5 release
94
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"})
95
+ expect(datacite.fetch("publisher")).to eq("DataCite")
78
96
  end
79
97
 
80
98
  it "with data citation schema.org" do
@@ -85,6 +103,26 @@ describe Bolognese::Metadata, vcr: true do
85
103
  expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}])
86
104
  expect(datacite.fetch("relatedIdentifiers").count).to eq(3)
87
105
  expect(datacite.fetch("relatedIdentifiers").first).to eq("relatedIdentifier"=>"10.5438/0000-00ss", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Text")
106
+ # REVERT the publisher line to the commented line for the schema 4.5 release
107
+ # expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"})
108
+ expect(datacite.fetch("publisher")).to eq("DataCite")
109
+ end
110
+
111
+ it "DataCite DOI with Schema 4.5 publisher attributes" do
112
+ input = fixture_path + "datacite-example-full-v4.5.xml"
113
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
114
+ datacite = JSON.parse(subject.datacite_json)
115
+ # REVERT the publisher line to the commented lines for the schema 4.5 release
116
+ # expect(datacite.fetch("publisher")).to eq(
117
+ # {
118
+ # "name" => "Example Publisher",
119
+ # "publisherIdentifier" => "https://ror.org/04z8jg394",
120
+ # "publisherIdentifierScheme" => "ROR",
121
+ # "schemeUri" => "https://ror.org/",
122
+ # "lang" => "en",
123
+ # },
124
+ # )
125
+ expect(datacite.fetch("publisher")).to eq("Example Publisher")
88
126
  end
89
127
  end
90
128
  end
@@ -17,6 +17,7 @@ describe Bolognese::Metadata, vcr: true do
17
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
+ expect(datacite.dig("publisher")).to eq("eLife Sciences Publications, Ltd")
20
21
  end
21
22
 
22
23
  it "with ORCID ID" do
@@ -31,6 +32,7 @@ describe Bolognese::Metadata, vcr: true do
31
32
  "givenName" => "Beatriz",
32
33
  "affiliation" => ["War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA", "Department of Psychiatry and Behavioral Sciences, Stanford University School of Medicine, Stanford, CA 94304, USA"],
33
34
  "nameIdentifier" => {"nameIdentifierScheme"=>"ORCID", "schemeURI"=>"https://orcid.org", "__content__"=>"https://orcid.org/0000-0003-2043-4925"})
35
+ expect(datacite.dig("publisher")).to eq("Hindawi Limited")
34
36
  end
35
37
 
36
38
  it "with editor" do
@@ -39,6 +41,7 @@ describe Bolognese::Metadata, vcr: true do
39
41
  expect(subject.valid?).to be true
40
42
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
41
43
  expect(datacite.dig("contributors", "contributor")).to eq("contributorName"=>{"__content__"=>"Janbon, Guilhem", "nameType"=>"Personal"}, "contributorType"=>"Editor", "familyName"=>"Janbon", "givenName"=>"Guilhem")
44
+ expect(datacite.dig("publisher")).to eq("Public Library of Science (PLoS)")
42
45
  end
43
46
 
44
47
  it "Crossref DOI" do
@@ -52,6 +55,7 @@ describe Bolognese::Metadata, vcr: true do
52
55
  expect(datacite.dig("descriptions", "description", 1, "__content__")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
53
56
  expect(datacite.dig("creators", "creator").count).to eq(5)
54
57
  expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>{"__content__"=>"Sankar, Martial", "nameType"=>"Personal"}, "familyName"=>"Sankar", "givenName"=>"Martial")
58
+ expect(datacite.dig("publisher")).to eq("{eLife} Sciences Organisation, Ltd.")
55
59
  end
56
60
 
57
61
  it "BlogPosting Citeproc JSON" do
@@ -64,6 +68,7 @@ describe Bolognese::Metadata, vcr: true do
64
68
  expect(datacite.dig("descriptions", "description").first).to eq("__content__"=>"DataCite Blog", "descriptionType"=>"SeriesInformation")
65
69
  expect(datacite.dig("descriptions", "description", 1, "__content__")).to start_with("Eating your own dog food")
66
70
  expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Fenner, Martin", "familyName"=>"Fenner", "givenName"=>"Martin")
71
+ expect(datacite.dig("publisher")).to eq("DataCite")
67
72
  end
68
73
 
69
74
  it "rdataone" do
@@ -88,6 +93,7 @@ describe Bolognese::Metadata, vcr: true do
88
93
  "__content__"=>"https://orcid.org/0000-0002-2192-403X"}},
89
94
  {"creatorName"=>{"__content__"=>"University Of California, Santa Barbara", "nameType"=>"Organizational"}}])
90
95
  expect(datacite.fetch("version")).to eq("2.0.0")
96
+ expect(datacite.dig("publisher")).to eq("https://cran.r-project.org")
91
97
  end
92
98
 
93
99
  it "rdataone and codemeta_v2" do
@@ -112,6 +118,7 @@ describe Bolognese::Metadata, vcr: true do
112
118
  "__content__"=>"https://orcid.org/0000-0002-2192-403X"}},
113
119
  {"creatorName"=>{"__content__"=>"University Of California, Santa Barbara", "nameType"=>"Organizational"}}])
114
120
  expect(datacite.fetch("version")).to eq("2.0.0")
121
+ expect(datacite.dig("publisher")).to eq("https://cran.r-project.org")
115
122
  end
116
123
 
117
124
  it "maremma" do
@@ -121,6 +128,7 @@ describe Bolognese::Metadata, vcr: true do
121
128
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
122
129
  expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls")
123
130
  expect(datacite.dig("creators", "creator")).to eq("affiliation"=>"DataCite", "creatorName"=> {"__content__"=>"Fenner, Martin", "nameType"=>"Personal"}, "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"__content__"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeURI"=>"https://orcid.org"})
131
+ expect(datacite.dig("publisher")).to eq("DataCite")
124
132
  end
125
133
 
126
134
  it "with version" do
@@ -146,7 +154,7 @@ describe Bolognese::Metadata, vcr: true do
146
154
  expect(subject.dates).to eq([{"date"=>"2015-08-19", "dateType"=>"Issued"}])
147
155
  expect(subject.publication_year).to eq("2015")
148
156
  expect(subject.version_info).to eq("v0.3.2")
149
- expect(subject.publisher).to eq("Zenodo")
157
+ expect(subject.publisher).to eq({"name"=>"Zenodo"})
150
158
  expect(subject.agency).to eq("datacite")
151
159
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
152
160
  expect(subject.datacite).to include("<version>v0.3.2</version>")
@@ -168,7 +176,7 @@ describe Bolognese::Metadata, vcr: true do
168
176
  "schemeUri"=>"https://spdx.org/licenses/"}])
169
177
  expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
170
178
  expect(subject.publication_year).to eq("2017")
171
- expect(subject.publisher).to eq("Figshare")
179
+ expect(subject.publisher).to eq({"name"=>"Figshare"})
172
180
  expect(subject.subjects).to eq([{"subject"=>"Information Systems"},
173
181
  {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
174
182
  "subject"=>"FOS: Computer and information sciences",
@@ -194,7 +202,7 @@ describe Bolognese::Metadata, vcr: true do
194
202
  "schemeUri"=>"https://spdx.org/licenses/"}])
195
203
  expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
196
204
  expect(subject.publication_year).to eq("2017")
197
- expect(subject.publisher).to eq("Figshare")
205
+ expect(subject.publisher).to eq({"name"=>"Figshare"})
198
206
  expect(subject.subjects).to eq([{"subject"=>"Information Systems"},
199
207
  {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
200
208
  "subject"=>"FOS: Computer and information sciences",
@@ -223,12 +231,13 @@ describe Bolognese::Metadata, vcr: true do
223
231
  expect(subject.related_identifiers.length).to eq(1)
224
232
  expect(subject.related_identifiers.last).to eq("relatedIdentifier" => "10.1371/journal.ppat.1000446",
225
233
  "relatedIdentifierType" => "DOI","relationType"=>"Cites")
226
- expect(subject.publisher).to eq("Dryad")
234
+ expect(subject.publisher).to eq({"name"=>"Dryad"})
227
235
  expect(subject.agency).to eq("datacite")
228
236
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
229
237
 
230
238
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
231
239
  expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
240
+ expect(datacite.dig("publisher")).to eq("Dryad")
232
241
  end
233
242
 
234
243
  it "Affiliation" do
@@ -248,13 +257,83 @@ describe Bolognese::Metadata, vcr: true do
248
257
  "schemeUri"=>"https://spdx.org/licenses/"}])
249
258
  expect(subject.dates).to eq([{"date"=>"2014-10-17", "dateType"=>"Updated"}, {"date"=>"2016-03-14T17:02:02Z", "dateType"=>"Available"}, {"date"=>"2013", "dateType"=>"Issued"}])
250
259
  expect(subject.publication_year).to eq("2013")
251
- expect(subject.publisher).to eq("UC Merced")
260
+ expect(subject.publisher).to eq({"name"=>"UC Merced"})
252
261
  expect(subject.agency).to eq("datacite")
253
262
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
254
263
 
255
264
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
256
265
  expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
257
266
  expect(datacite.dig("creators", "creator", 0, "affiliation")).to eq(["UC Merced", "NSF"])
267
+ expect(datacite.dig("publisher")).to eq("UC Merced")
268
+ end
269
+
270
+ it "Schema 4.5 publisher with attributes" do
271
+ input = fixture_path + 'datacite-example-full-v4.5.xml'
272
+ doi = "10.82433/B09Z-4K37"
273
+ subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true)
274
+ expect(subject.valid?).to be true
275
+
276
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
277
+ expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
278
+ expect(datacite.dig("publisher")).to eq(
279
+ {
280
+ "__content__" => "Example Publisher",
281
+ "publisherIdentifier" => "https://ror.org/04z8jg394",
282
+ "publisherIdentifierScheme" => "ROR",
283
+ "schemeURI" => "https://ror.org/",
284
+ "xml:lang" => "en",
285
+ }
286
+ )
287
+ end
288
+
289
+ it "Geolocations" do
290
+ input = fixture_path + 'datacite-example-full-v4.5.xml'
291
+ doi = "10.82433/B09Z-4K37"
292
+ subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true)
293
+ expect(subject.valid?).to be true
294
+
295
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
296
+ expect(datacite.dig("geoLocations", "geoLocation", "geoLocationPlace")).to eq("Vancouver, British Columbia, Canada")
297
+ expect(datacite.dig("geoLocations", "geoLocation", "geoLocationPoint")).to eq(
298
+ {
299
+ "pointLatitude" => "49.2827",
300
+ "pointLongitude" => "-123.1207",
301
+ }
302
+ )
303
+ expect(datacite.dig("geoLocations", "geoLocation", "geoLocationBox")).to eq(
304
+ {
305
+ "westBoundLongitude" => "-123.27",
306
+ "eastBoundLongitude" => "-123.02",
307
+ "southBoundLatitude" => "49.195",
308
+ "northBoundLatitude" => "49.315",
309
+ }
310
+ )
311
+ expect(datacite.dig("geoLocations", "geoLocation", "geoLocationPolygon")).to eq(
312
+ {
313
+ "polygonPoint" => [
314
+ {
315
+ "pointLatitude" => "41.991",
316
+ "pointLongitude" => "-71.032",
317
+ },
318
+ {
319
+ "pointLatitude" => "42.893",
320
+ "pointLongitude" => "-69.622",
321
+ },
322
+ {
323
+ "pointLatitude" => "41.991",
324
+ "pointLongitude" => "-68.211",
325
+ },
326
+ {
327
+ "pointLatitude" => "41.090",
328
+ "pointLongitude" => "-69.622",
329
+ },
330
+ {
331
+ "pointLatitude" => "41.991",
332
+ "pointLongitude" => "-71.032",
333
+ },
334
+ ]
335
+ }
336
+ )
258
337
  end
259
338
 
260
339
  it "with data citation schema.org" do
@@ -11,6 +11,7 @@ describe Bolognese::Metadata, vcr: true do
11
11
  expect(jats.dig("publication_type")).to eq("journal")
12
12
  expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
13
13
  expect(jats.dig("source")).to eq("eLife")
14
+ expect(jats.dig("publisher_name")).to eq("eLife Sciences Publications, Ltd")
14
15
  expect(jats.dig("person_group", "name").length).to eq(5)
15
16
  expect(jats.dig("person_group", "name").first).to eq("surname"=>"Sankar", "given_names"=>"Martial")
16
17
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2014-02-11", "__content__"=>"2014")
@@ -25,6 +26,7 @@ describe Bolognese::Metadata, vcr: true do
25
26
  expect(jats.dig("publication_type")).to eq("journal")
26
27
  expect(jats.dig("article_title")).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
27
28
  expect(jats.dig("source")).to eq("Pulmonary Medicine")
29
+ expect(jats.dig("publisher_name")).to eq("Hindawi Limited")
28
30
  expect(jats.dig("person_group", "name").length).to eq(7)
29
31
  expect(jats.dig("person_group", "name").first).to eq("surname"=>"Thanassi", "given_names"=>"Wendy")
30
32
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2012", "__content__"=>"2012")
@@ -37,6 +39,7 @@ describe Bolognese::Metadata, vcr: true do
37
39
  expect(jats.dig("publication_type")).to eq("journal")
38
40
  expect(jats.dig("article_title")).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization???Not Catalytic Inactivity???of the Mutant Enzymes")
39
41
  expect(jats.dig("source")).to eq("PLoS ONE")
42
+ expect(jats.dig("publisher_name")).to eq("Public Library of Science (PLoS)")
40
43
  expect(jats.dig("person_group", 0, "name").length).to eq(5)
41
44
  expect(jats.dig("person_group", 0, "name").first).to eq("surname"=>"Ralser", "given_names"=>"Markus")
42
45
  expect(jats.dig("person_group", 1, "name")).to eq("surname"=>"Janbon", "given_names"=>"Guilhem")
@@ -54,6 +57,7 @@ describe Bolognese::Metadata, vcr: true do
54
57
  expect(jats.dig("publication_type")).to eq("chapter")
55
58
  expect(jats.dig("chapter_title")).to eq("Physical Examinations")
56
59
  expect(jats.dig("source")).to eq("Jaypee Brothers Medical Publishing")
60
+ expect(jats.dig("publisher_name")).to eq("Jaypee Brothers Medical Publishing")
57
61
  expect(jats.dig("person_group", "name")).to eq("surname"=>"Saha", "given_names"=>"Ashis")
58
62
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2015", "__content__"=>"2015")
59
63
  expect(jats.dig("fpage")).to eq("27")
@@ -68,6 +72,7 @@ describe Bolognese::Metadata, vcr: true do
68
72
  expect(jats.dig("publication_type")).to eq("journal")
69
73
  expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
70
74
  expect(jats.dig("source")).to eq("eLife")
75
+ expect(jats.dig("publisher_name")).to eq("{eLife} Sciences Organisation, Ltd.")
71
76
  expect(jats.dig("person_group", "name").length).to eq(5)
72
77
  expect(jats.dig("person_group", "name").first).to eq("surname"=>"Sankar", "given_names"=>"Martial")
73
78
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2014", "__content__"=>"2014")
@@ -126,6 +131,7 @@ describe Bolognese::Metadata, vcr: true do
126
131
  expect(jats.dig("publication_type")).to eq("journal")
127
132
  expect(jats.dig("article_title")).to eq("Recommendation of: ORCID Works Metadata Working Group")
128
133
  expect(jats.dig("source")).to eq("Figshare")
134
+ expect(jats.dig("publisher_name")).to eq("Figshare")
129
135
  expect(jats.dig("person_group", "name").length).to eq(20)
130
136
  expect(jats.dig("person_group", "name").first).to eq("surname"=>"Paglione", "given_names"=>"Laura")
131
137
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2017", "__content__"=>"2017")
@@ -139,6 +145,7 @@ describe Bolognese::Metadata, vcr: true do
139
145
  expect(jats.dig("publication_type")).to eq("data")
140
146
  expect(jats.dig("data_title")).to eq("Data from: A new malaria agent in African hominids.")
141
147
  expect(jats.dig("source")).to eq("Dryad")
148
+ expect(jats.dig("publisher_name")).to eq(nil)
142
149
  expect(jats.dig("person_group", "name").length).to eq(8)
143
150
  expect(jats.dig("person_group", "name").first).to eq("surname"=>"Ollomo", "given_names"=>"Benjamin")
144
151
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2011", "__content__"=>"2011")
@@ -182,6 +189,7 @@ describe Bolognese::Metadata, vcr: true do
182
189
  expect(jats.dig("publication_type")).to eq("journal")
183
190
  expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
184
191
  expect(jats.dig("source")).to eq("eLife")
192
+ expect(jats.dig("publisher_name")).to eq("eLife Sciences Publications, Ltd")
185
193
  expect(jats.dig("person_group", "name").length).to eq(5)
186
194
  expect(jats.dig("person_group", "name").first).to eq("surname"=>"Sankar", "given_names"=>"Martial")
187
195
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2014-02-11", "__content__"=>"2014")
@@ -12,6 +12,7 @@ describe Bolognese::Metadata, vcr: true do
12
12
  expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.7554/elife.01567")
13
13
  expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
14
14
  expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014-02-11")
15
+ expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("eLife Sciences Publications, Ltd")
15
16
  end
16
17
 
17
18
  it "with pages" do
@@ -24,6 +25,7 @@ describe Bolognese::Metadata, vcr: true do
24
25
  expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2012")
25
26
  expect(rdf_xml.dig("ScholarlyArticle", "pageStart")).to eq("1")
26
27
  expect(rdf_xml.dig("ScholarlyArticle", "pageEnd")).to eq("7")
28
+ expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("Hindawi Limited")
27
29
  end
28
30
 
29
31
  it "Crossref DOI" do
@@ -36,6 +38,7 @@ describe Bolognese::Metadata, vcr: true do
36
38
  expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
37
39
  expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014")
38
40
  expect(rdf_xml.dig("ScholarlyArticle", "periodical", "Journal", "name")).to eq("eLife")
41
+ expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("{eLife} Sciences Organisation, Ltd.")
39
42
  end
40
43
 
41
44
  it "BlogPosting" do
@@ -47,6 +50,7 @@ describe Bolognese::Metadata, vcr: true do
47
50
  expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Eating your own Dog Food")
48
51
  expect(rdf_xml.dig("ScholarlyArticle", "keywords")).to eq("datacite, doi, metadata, FOS: Computer and information sciences, FOS: Computer and information sciences")
49
52
  expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2016-12-20")
53
+ expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("DataCite")
50
54
  end
51
55
 
52
56
  it "BlogPosting Citeproc JSON" do
@@ -56,6 +60,7 @@ describe Bolognese::Metadata, vcr: true do
56
60
  expect(rdf_xml.dig("BlogPosting", "rdf:about")).to eq("https://doi.org/10.5438/4k3m-nyvg")
57
61
  expect(rdf_xml.dig("BlogPosting", "name")).to eq("Eating your own Dog Food")
58
62
  expect(rdf_xml.dig("BlogPosting", "datePublished", "__content__")).to eq("2016-12-20")
63
+ expect(rdf_xml.dig("BlogPosting", "publisher", "Organization", "name")).to eq("DataCite")
59
64
  end
60
65
 
61
66
  it "maremma" do
@@ -68,6 +73,7 @@ describe Bolognese::Metadata, vcr: true do
68
73
  expect(rdf_xml.dig("SoftwareSourceCode", "name")).to eq("Maremma: a Ruby library for simplified network calls")
69
74
  expect(rdf_xml.dig("SoftwareSourceCode", "keywords")).to eq("faraday, excon, net/http")
70
75
  expect(rdf_xml.dig("SoftwareSourceCode", "datePublished", "__content__")).to eq("2017-02-24")
76
+ expect(rdf_xml.dig("SoftwareSourceCode", "publisher", "Organization", "name")).to eq("DataCite")
71
77
  end
72
78
 
73
79
  it "BlogPosting schema.org" do
@@ -81,6 +87,7 @@ describe Bolognese::Metadata, vcr: true do
81
87
  expect(rdf_xml.dig("BlogPosting", "name")).to eq("Eating your own Dog Food")
82
88
  expect(rdf_xml.dig("BlogPosting", "keywords")).to eq("datacite, doi, metadata, featured")
83
89
  expect(rdf_xml.dig("BlogPosting", "datePublished", "__content__")).to eq("2016-12-20")
90
+ expect(rdf_xml.dig("BlogPosting", "publisher", "Organization", "name")).to eq("DataCite")
84
91
  end
85
92
  end
86
93
  end
@@ -10,6 +10,8 @@ describe Bolognese::Metadata, vcr: true do
10
10
  ttl = subject.turtle.split("\n")
11
11
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
12
12
  expect(ttl[2]).to eq("<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;")
13
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
14
+ expect(ttl[publisher_line]).to eq(" schema:name \"{eLife} Sciences Organisation, Ltd.\"")
13
15
  end
14
16
 
15
17
  it "Dataset" do
@@ -19,6 +21,8 @@ describe Bolognese::Metadata, vcr: true do
19
21
  ttl = subject.turtle.split("\n")
20
22
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
21
23
  expect(ttl[2]).to eq("<https://doi.org/10.5061/dryad.8515> a schema:Dataset;")
24
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
25
+ expect(ttl[publisher_line]).to eq(" schema:name \"Dryad\"")
22
26
  end
23
27
 
24
28
  it "BlogPosting" do
@@ -28,6 +32,8 @@ describe Bolognese::Metadata, vcr: true do
28
32
  ttl = subject.turtle.split("\n")
29
33
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
30
34
  expect(ttl[2]).to eq("<https://doi.org/10.5438/4k3m-nyvg> a schema:ScholarlyArticle;")
35
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
36
+ expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"")
31
37
  end
32
38
 
33
39
  it "BlogPosting Citeproc JSON" do
@@ -36,6 +42,8 @@ describe Bolognese::Metadata, vcr: true do
36
42
  ttl = subject.turtle.split("\n")
37
43
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
38
44
  expect(ttl[2]).to eq("<https://doi.org/10.5438/4k3m-nyvg> a schema:BlogPosting;")
45
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
46
+ expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"")
39
47
  end
40
48
 
41
49
  it "BlogPosting DataCite JSON" do
@@ -44,6 +52,8 @@ describe Bolognese::Metadata, vcr: true do
44
52
  ttl = subject.turtle.split("\n")
45
53
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
46
54
  expect(ttl[2]).to eq("<https://doi.org/10.5438/4k3m-nyvg> a schema:ScholarlyArticle;")
55
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
56
+ expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"")
47
57
  end
48
58
 
49
59
  it "BlogPosting schema.org" do
@@ -53,6 +63,8 @@ describe Bolognese::Metadata, vcr: true do
53
63
  ttl = subject.turtle.split("\n")
54
64
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
55
65
  expect(ttl[2]).to eq("<https://doi.org/10.5438/4k3m-nyvg> a schema:BlogPosting;")
66
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
67
+ expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"")
56
68
  end
57
69
 
58
70
  it "DataONE" do
@@ -61,6 +73,8 @@ describe Bolognese::Metadata, vcr: true do
61
73
  ttl = subject.turtle.split("\n")
62
74
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
63
75
  expect(ttl[2]).to eq("<https://doi.org/10.5063/f1m61h5x> a schema:SoftwareSourceCode;")
76
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
77
+ expect(ttl[publisher_line]).to eq(" schema:name \"https://cran.r-project.org\"")
64
78
  end
65
79
 
66
80
  it "journal article" do
@@ -70,6 +84,8 @@ describe Bolognese::Metadata, vcr: true do
70
84
  ttl = subject.turtle.split("\n")
71
85
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
72
86
  expect(ttl[2]).to eq("<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;")
87
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
88
+ expect(ttl[publisher_line]).to eq(" schema:name \"eLife Sciences Publications, Ltd\"")
73
89
  end
74
90
 
75
91
  it "with pages" do
@@ -79,6 +95,8 @@ describe Bolognese::Metadata, vcr: true do
79
95
  ttl = subject.turtle.split("\n")
80
96
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
81
97
  expect(ttl[2]).to eq("<https://doi.org/10.1155/2012/291294> a schema:ScholarlyArticle;")
98
+ publisher_line = ttl.find_index(' schema:publisher [') + 2
99
+ expect(ttl[publisher_line]).to eq(" schema:name \"Hindawi Limited\"")
82
100
  end
83
101
  end
84
102
  end
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: 1.11.5
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-24 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -556,6 +556,20 @@ dependencies:
556
556
  - - ">="
557
557
  - !ruby/object:Gem::Version
558
558
  version: '0'
559
+ - !ruby/object:Gem::Dependency
560
+ name: json-canonicalization
561
+ requirement: !ruby/object:Gem::Requirement
562
+ requirements:
563
+ - - '='
564
+ - !ruby/object:Gem::Version
565
+ version: 0.3.1
566
+ type: :development
567
+ prerelease: false
568
+ version_requirements: !ruby/object:Gem::Requirement
569
+ requirements:
570
+ - - '='
571
+ - !ruby/object:Gem::Version
572
+ version: 0.3.1
559
573
  description: Ruby gem and command-line utility for conversion of DOI metadata from
560
574
  and to different metadata formats, including schema.org.
561
575
  email: mfenner@datacite.org
@@ -734,6 +748,18 @@ files:
734
748
  - resources/kernel-4.4/include/datacite-titleType-v4.xsd
735
749
  - resources/kernel-4.4/include/xml.xsd
736
750
  - resources/kernel-4.4/metadata.xsd
751
+ - resources/kernel-4.5/include/datacite-contributorType-v4.xsd
752
+ - resources/kernel-4.5/include/datacite-dateType-v4.xsd
753
+ - resources/kernel-4.5/include/datacite-descriptionType-v4.xsd
754
+ - resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd
755
+ - resources/kernel-4.5/include/datacite-nameType-v4.xsd
756
+ - resources/kernel-4.5/include/datacite-numberType-v4.xsd
757
+ - resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd
758
+ - resources/kernel-4.5/include/datacite-relationType-v4.xsd
759
+ - resources/kernel-4.5/include/datacite-resourceType-v4.xsd
760
+ - resources/kernel-4.5/include/datacite-titleType-v4.xsd
761
+ - resources/kernel-4.5/include/xml.xsd
762
+ - resources/kernel-4.5/metadata.xsd
737
763
  - resources/kernel-4/include/datacite-contributorType-v4.xsd
738
764
  - resources/kernel-4/include/datacite-dateType-v4.xsd
739
765
  - resources/kernel-4/include/datacite-descriptionType-v4.xsd
@@ -781,6 +807,7 @@ files:
781
807
  - spec/fixtures/datacite-example-dissertation-v4.4.xml
782
808
  - spec/fixtures/datacite-example-escaped-text.xml
783
809
  - spec/fixtures/datacite-example-full-v4.4.xml
810
+ - spec/fixtures/datacite-example-full-v4.5.xml
784
811
  - spec/fixtures/datacite-example-geolocation-2.xml
785
812
  - spec/fixtures/datacite-example-geolocation.xml
786
813
  - spec/fixtures/datacite-example-nameIdentifier-with-schemeURI.xml