bolognese 2.0.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +1 -1
  3. data/.github/workflows/release.yml +2 -2
  4. data/Gemfile.lock +13 -12
  5. data/bolognese.gemspec +4 -3
  6. data/lib/bolognese/author_utils.rb +4 -4
  7. data/lib/bolognese/metadata_utils.rb +2 -1
  8. data/lib/bolognese/readers/citeproc_reader.rb +6 -0
  9. data/lib/bolognese/readers/crossref_reader.rb +37 -3
  10. data/lib/bolognese/readers/datacite_reader.rb +1 -1
  11. data/lib/bolognese/readers/schema_org_reader.rb +26 -4
  12. data/lib/bolognese/utils.rb +14 -9
  13. data/lib/bolognese/version.rb +1 -1
  14. data/lib/bolognese/writers/datacite_json_writer.rb +1 -4
  15. data/lib/bolognese/writers/jats_writer.rb +4 -1
  16. data/lib/bolognese/writers/schema_org_writer.rb +5 -1
  17. data/resources/kernel-4/include/datacite-contributorType-v4.xsd +3 -1
  18. data/resources/kernel-4/include/datacite-dateType-v4.xsd +3 -1
  19. data/resources/kernel-4/include/datacite-relatedIdentifierType-v4.xsd +5 -2
  20. data/resources/kernel-4/include/datacite-relationType-v4.xsd +7 -3
  21. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +5 -1
  22. data/resources/kernel-4/include/datacite-titleType-v4.xsd +1 -1
  23. data/resources/kernel-4/metadata.xsd +2 -1
  24. data/resources/kernel-4.6/include/datacite-contributorType-v4.xsd +37 -0
  25. data/resources/kernel-4.6/include/datacite-dateType-v4.xsd +27 -0
  26. data/resources/kernel-4.6/include/datacite-descriptionType-v4.xsd +19 -0
  27. data/resources/kernel-4.6/include/datacite-funderIdentifierType-v4.xsd +16 -0
  28. data/resources/kernel-4.6/include/datacite-nameType-v4.xsd +10 -0
  29. data/resources/kernel-4.6/include/datacite-numberType-v4.xsd +12 -0
  30. data/resources/kernel-4.6/include/datacite-relatedIdentifierType-v4.xsd +37 -0
  31. data/resources/kernel-4.6/include/datacite-relationType-v4.xsd +57 -0
  32. data/resources/kernel-4.6/include/datacite-resourceType-v4.xsd +49 -0
  33. data/resources/kernel-4.6/include/datacite-titleType-v4.xsd +14 -0
  34. data/resources/kernel-4.6/include/xml.xsd +286 -0
  35. data/resources/kernel-4.6/metadata.xsd +712 -0
  36. data/spec/author_utils_spec.rb +8 -2
  37. data/spec/datacite_utils_spec.rb +109 -1
  38. data/spec/fixtures/citeproc.json +6 -2
  39. data/spec/fixtures/crossref_schema_4.6_values.xml +183 -0
  40. data/spec/fixtures/datacite-example-ROR-nameIdentifiers.xml +8 -0
  41. data/spec/fixtures/datacite-example-full-v4.6.xml +114 -0
  42. data/spec/fixtures/datacite-xml-lang.xml +1 -1
  43. data/spec/fixtures/datacite_blank_name_identifier.xml +22 -0
  44. data/spec/fixtures/datacite_blank_publisher.xml +18 -0
  45. data/spec/fixtures/datacite_journal_article.xml +64 -0
  46. data/spec/fixtures/schema_org.json +1 -0
  47. data/spec/fixtures/schema_org_4.6_attributes.json +108 -0
  48. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors_Translator/supports_Translator_contributorType.yml +71 -0
  49. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates_with_Coverage/inserts_date_with_dateType_Coverage.yml +71 -0
  50. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_CSTR/supports_CSTR_relatedIdentifierType.yml +71 -0
  51. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_HasTranslation/supports_HasTranslation_relationType.yml +71 -0
  52. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_RRID/supports_RRID_relatedIdentifierType.yml +71 -0
  53. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Award/supports_Award_as_resourceTypeGeneral.yml +71 -0
  54. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Project/supports_Project_as_resourceTypeGeneral.yml +71 -0
  55. data/spec/readers/citeproc_reader_spec.rb +1 -0
  56. data/spec/readers/crossref_reader_spec.rb +31 -0
  57. data/spec/readers/datacite_reader_spec.rb +91 -0
  58. data/spec/readers/schema_org_reader_spec.rb +28 -1
  59. data/spec/writers/citation_writer_spec.rb +9 -0
  60. data/spec/writers/citeproc_writer_spec.rb +9 -0
  61. data/spec/writers/datacite_json_writer_spec.rb +16 -32
  62. data/spec/writers/datacite_writer_spec.rb +71 -0
  63. data/spec/writers/jats_writer_spec.rb +8 -1
  64. data/spec/writers/schema_org_writer_spec.rb +49 -0
  65. metadata +55 -22
@@ -0,0 +1,71 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.datacite.org/dois/10.5061/dryad.8515?include=media,client
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Mozilla/5.0 (compatible; Maremma/5.0.0; mailto:info@datacite.org)
12
+ Accept:
13
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
14
+ Accept-Encoding:
15
+ - gzip,deflate
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Thu, 03 Oct 2024 10:58:32 GMT
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Connection:
26
+ - keep-alive
27
+ Status:
28
+ - 200 OK
29
+ X-Anonymous-Consumer:
30
+ - 'true'
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ Vary:
34
+ - Accept-Encoding
35
+ Content-Encoding:
36
+ - gzip
37
+ Referrer-Policy:
38
+ - strict-origin-when-cross-origin
39
+ X-Permitted-Cross-Domain-Policies:
40
+ - none
41
+ X-Xss-Protection:
42
+ - '0'
43
+ X-Request-Id:
44
+ - c752021c-462f-41cd-9744-bfed6a20f1b5
45
+ Etag:
46
+ - W/"355fb10eef74341acde571ef081292c3"
47
+ X-Frame-Options:
48
+ - SAMEORIGIN
49
+ X-Runtime:
50
+ - '0.037271'
51
+ X-Content-Type-Options:
52
+ - nosniff
53
+ X-Powered-By:
54
+ - Phusion Passenger(R) 6.0.23
55
+ Server:
56
+ - nginx/1.18.0 + Phusion Passenger(R) 6.0.23
57
+ Access-Control-Allow-Credentials:
58
+ - 'true'
59
+ Access-Control-Allow-Methods:
60
+ - GET, POST, PUT, PATCH, DELETE, OPTIONS
61
+ Access-Control-Allow-Headers:
62
+ - Accept,Access-Control-Allow-Origin,Access-Control-Expose-Headers,Access-Control-Allow-Methods,Access-Control-Allow-Headers,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With
63
+ Access-Control-Expose-Headers:
64
+ - Authorization
65
+ body:
66
+ encoding: ASCII-8BIT
67
+ string: !binary |-
68
+ H4sIANh4/mYAA+xc2W7rVrL9FcJP6ZtzbJKSbMtAP1iyLVGxZFuz2AkanExR2hzCQVNwvqfR35Efu6s2SYm0Zet0305wHxrIQSyqdu2qVauGTZP+7czUYu3s5rczxzy7OZPE85p4KV2Y4VYzz69rUu3sy1m8DSx8Z/pOhE9aHIeOnsRWRKtw8aNlQWi9OpvDt7gUJa/ppZKgY1pe7Lw6VgiVf/sFW7DYCj0ttpS33xihpcU+//Tbmae5ZNcTY77rfxEalrfQXMeDRvpmmFr9jLW+pzFctZ2V5fXSRQXhV/yfbXtFZeQmLGWOFju+h83OmjAktATFSy1zSKVgWkLfMuZWiH+R0P39n6ZjaAw/4ouHUPMMa+UwZp39klr0xptvX/Yu3CWQNr8IzxqwNZbf5cFBtuRAquq9Aw+h5RlzoZfbnjn06ofCwHBSwwy4E1ka3Dlt8nOY2J4P776krn6f0XvRks17XX+82Xd+srPC7Rfh3nU1L7GY0DkXns+/y/h3S8rAp5rfuXDSpFsi1FxLvgjN3//JHM/6LmMOsiUrcmV/PJK9pW/PEf07x0pM3/N+/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vcpXSu1a/kWp5WXhbA66/yuJQqlKNqVznQuXbVMdqwr+X2+nfMfkgO7M/bLJfmIkWU0CqScUMO8gQbX/59r8AAAD//wMA5Eul7IJFAAA=
69
+ http_version:
70
+ recorded_at: Thu, 03 Oct 2024 10:58:32 GMT
71
+ recorded_with: VCR 3.0.3
@@ -20,6 +20,7 @@ describe Bolognese::Metadata, vcr: true do
20
20
  expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
21
21
  expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
22
22
  expect(subject.creators).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}])
23
+ expect(subject.contributors).to eq([{"familyName"=>"Ross", "givenName"=>"Cody", "name"=>"Ross, Cody", "contributorType"=>"Translator"}])
23
24
  expect(subject.publisher).to eq({"name"=>"DataCite"})
24
25
  expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
25
26
  expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
@@ -1098,5 +1098,36 @@ describe Bolognese::Metadata, vcr: true do
1098
1098
  expect(subject.agency).to eq("crossref")
1099
1099
  expect(subject.state).to eq("not_found")
1100
1100
  end
1101
+
1102
+ it "with Schema 4.6 Translator contributor" do
1103
+ input = fixture_path + 'crossref_schema_4.6_values.xml'
1104
+ subject = Bolognese::Metadata.new(input: input)
1105
+
1106
+ expect(subject.contributors).to eq([
1107
+ {"givenName"=>"Ashwini", "familyName"=>"Sukale", "name"=>"Sukale, Ashwini", "nameType"=>"Personal", "affiliation"=>[{"name"=>"DataCite"}], "contributorType"=>"Editor"},
1108
+ {"givenName"=>"Cody", "familyName"=>"Ross", "name"=>"Ross, Cody", "nameType"=>"Personal", "affiliation"=>[{"name"=>"DataCite"}], "contributorType"=>"Translator"},
1109
+ ])
1110
+ end
1111
+
1112
+ it "with Schema 4.6 HasTranslation and IsTranslationOf" do
1113
+ input = fixture_path + 'crossref_schema_4.6_values.xml'
1114
+ subject = Bolognese::Metadata.new(input: input)
1115
+
1116
+ expect(subject.related_identifiers.count).to eq(7)
1117
+ expect(subject.related_identifiers).to include(
1118
+ {
1119
+ "relatedIdentifier"=>"10.32013/zll10oq",
1120
+ "relatedIdentifierType"=>"DOI",
1121
+ "relationType"=>"HasTranslation",
1122
+ }
1123
+ )
1124
+ expect(subject.related_identifiers).to include(
1125
+ {
1126
+ "relatedIdentifier"=>"10.5555/original_language",
1127
+ "relatedIdentifierType"=>"DOI",
1128
+ "relationType"=>"IsTranslationOf",
1129
+ }
1130
+ )
1131
+ end
1101
1132
  end
1102
1133
  end
@@ -1759,4 +1759,95 @@ describe Bolognese::Metadata, vcr: true do
1759
1759
  )
1760
1760
  end
1761
1761
  end
1762
+
1763
+ it "blank nameIdentifier" do
1764
+ input = fixture_path + "datacite_blank_name_identifier.xml"
1765
+ subject = Bolognese::Metadata.new(input: input)
1766
+ expect(subject.creators).to eq(
1767
+ [
1768
+ {
1769
+ "nameType" => "Personal",
1770
+ "name" => "KARST, SNO",
1771
+ "givenName" => "SNO",
1772
+ "familyName" => "KARST",
1773
+ "nameIdentifiers" =>
1774
+ [
1775
+ {
1776
+ "schemeUri" => "https://orcid.org",
1777
+ "nameIdentifierScheme" => "ORCID"
1778
+ }
1779
+ ],
1780
+ "affiliation" => []
1781
+ }
1782
+ ]
1783
+ )
1784
+ expect(subject.contributors).to eq(
1785
+ [
1786
+ {
1787
+ "nameType" => "Personal",
1788
+ "name" => "Manche, Yannick",
1789
+ "givenName" => "Yannick",
1790
+ "familyName" => "Manche",
1791
+ "nameIdentifiers" =>
1792
+ [
1793
+ {
1794
+ "schemeUri" => "https://orcid.org",
1795
+ "nameIdentifierScheme" => "ORCID"
1796
+ }
1797
+ ],
1798
+ "affiliation" => [],
1799
+ "contributorType" => "ProjectMember"
1800
+ }
1801
+ ]
1802
+ )
1803
+ end
1804
+
1805
+ it "blank publisher" do
1806
+ input = fixture_path + "datacite_blank_publisher.xml"
1807
+ subject = Bolognese::Metadata.new(input: input)
1808
+ expect(subject.publisher).to eq(
1809
+ { "publisherIdentifier" => "https://ror.org/04wxnsj81" }
1810
+ )
1811
+ end
1812
+
1813
+ describe "DataCite Schema 4.6" do
1814
+ it "handles all DataCite 4.6 features in one XML" do
1815
+ input = fixture_path + 'datacite-example-full-v4.6.xml'
1816
+ subject = Bolognese::Metadata.new(input: input)
1817
+
1818
+ expect(subject.valid?).to be true
1819
+
1820
+ # Test resourceTypeGeneral for Project
1821
+ expect(subject.types["resourceTypeGeneral"]).to eq("Project")
1822
+ expect(subject.types["resourceType"]).to eq("Research Project")
1823
+
1824
+ # Test relatedIdentifiers for RRID and CSTR
1825
+ expect(subject.related_identifiers.length).to eq(4)
1826
+ expect(subject.related_identifiers).to include(
1827
+ { "relatedIdentifier" => "RRID:AB_90755", "relatedIdentifierType" => "RRID", "relationType" => "References" },
1828
+ { "relatedIdentifier" => "CSTR:AB_12345", "relatedIdentifierType" => "CSTR", "relationType" => "References" }
1829
+ )
1830
+
1831
+ # Test relationType HasTranslation and IsTranslationOf
1832
+ expect(subject.related_identifiers).to include(
1833
+ { "relatedIdentifier" => "10.1234/translated-version", "relatedIdentifierType" => "DOI", "relationType" => "HasTranslation" },
1834
+ { "relatedIdentifier" => "10.1234/other-version", "relatedIdentifierType" => "DOI", "relationType" => "IsTranslationOf" }
1835
+ )
1836
+
1837
+ # Test contributorType for Translator
1838
+ expect(subject.contributors.length).to eq(2)
1839
+ expect(subject.contributors.first).to include(
1840
+ "contributorType" => "Translator",
1841
+ "familyName" => "Doe",
1842
+ "givenName" => "Jane"
1843
+ )
1844
+
1845
+ # Test dateType for Coverage
1846
+ expect(subject.dates).to include(
1847
+ { "dateType" => "Coverage", "date" => "2020-01-01" }
1848
+ )
1849
+
1850
+ end
1851
+ end
1762
1852
  end
1853
+
@@ -169,7 +169,7 @@ describe Bolognese::Metadata, vcr: true do
169
169
  expect(subject.publication_year).to eq("2016")
170
170
  expect(subject.related_identifiers.length).to eq(3)
171
171
  expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References")
172
- expect(subject.publisher).to eq({"name"=>"DataCite"})
172
+ expect(subject.publisher).to eq({"name"=>"DataCite", "publisherIdentifier"=>"https://ror.org/04wxnsj81"})
173
173
  end
174
174
 
175
175
  it "GTEx dataset" do
@@ -340,5 +340,32 @@ describe Bolognese::Metadata, vcr: true do
340
340
  "funderIdentifierType"=>"Crossref Funder ID",
341
341
  "funderName"=>"European Commission"}])
342
342
  end
343
+
344
+ it "Schema 4.6 attributes" do
345
+ input = fixture_path + 'schema_org_4.6_attributes.json'
346
+ subject = Bolognese::Metadata.new(input: input)
347
+
348
+ expect(subject.related_identifiers).to eq(
349
+ [
350
+ {"relatedIdentifier"=>"10.1234/translated-version", "relatedIdentifierType"=>"DOI", "relationType"=>"HasTranslation"},
351
+ {"relatedIdentifier"=>"10.1234/other-version", "relatedIdentifierType"=>"DOI", "relationType"=>"IsTranslationOf"},
352
+ ]
353
+ )
354
+ expect(subject.dates).to eq(
355
+ [
356
+ {"date"=>"2023-01-01", "dateType"=>"Issued"},
357
+ {"date"=>"2023-01-01", "dateType"=>"Created"},
358
+ {"date"=>"2023-01-01", "dateType"=>"Updated"},
359
+ {"date"=>"2020-01-01", "dateType"=>"Coverage"}
360
+ ]
361
+ )
362
+ expect(subject.contributors).to eq(
363
+ [
364
+ {"name"=>"Doe, Jane", "givenName"=>"Jane", "familyName"=>"Doe", "nameType"=>"Personal", "affiliation"=>[{"name"=>"ExampleAffiliation", "affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR"}], "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}]},
365
+ {"name"=>"Smith, John", "givenName"=>"John", "familyName"=>"Smith", "nameType"=>"Personal", "affiliation"=>[{"name"=>"ExampleAffiliation", "affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR"}]},
366
+ {"name"=>"Ross, Cody", "givenName"=>"Cody", "familyName"=>"Ross", "nameType"=>"Personal", "affiliation"=>[{"name"=>"ExampleAffiliation", "affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR"}], "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}], "contributorType"=>"Translator"},
367
+ ]
368
+ )
369
+ end
343
370
  end
344
371
  end
@@ -48,5 +48,14 @@ describe Bolognese::Metadata, vcr: true do
48
48
  expect(subject.locale).to eq("en-US")
49
49
  expect(subject.citation).to eq("Clark, D. (2019). <i>Exploring the \"Many analysts, one dataset\" project from COS</i>. Gigantum, Inc. https://doi.org/10.34747/g6yb-3412")
50
50
  end
51
+
52
+ it "journal article with container title" do
53
+ input = fixture_path + "datacite_journal_article.xml"
54
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
55
+ expect(subject.types["citeproc"]).to eq("article-journal")
56
+ expect(subject.style).to eq("apa")
57
+ expect(subject.locale).to eq("en-US")
58
+ expect(subject.citation).to eq('Feldman, H. L. (1995). Science and Uncertainty in Mass Exposure Litigation. <i>Texas Law Review</i>. https://doi.org/10.60843/5egy-vc42')
59
+ end
51
60
  end
52
61
  end
@@ -286,5 +286,14 @@ describe Bolognese::Metadata, vcr: true do
286
286
  expect(json["DOI"]).to eq("10.34747/g6yb-3412")
287
287
  expect(json["issued"]).to eq("date-parts"=>[[2019]])
288
288
  end
289
+
290
+ it "from Schema 4.6 with Translator contributor" do
291
+ input = fixture_path + 'datacite-example-full-v4.6.xml'
292
+ subject = Bolognese::Metadata.new(input: input)
293
+ json = JSON.parse(subject.citeproc)
294
+ expect(json["translator"]).to eq([
295
+ {"family"=>"Doe", "given"=>"Jane"},
296
+ ])
297
+ end
289
298
  end
290
299
  end
@@ -18,9 +18,7 @@ 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
+ expect(datacite.fetch("publisher")).to eq({"name"=>"eLife Sciences Publications, Ltd"})
24
22
  end
25
23
 
26
24
  it "with ORCID ID" do
@@ -31,9 +29,7 @@ describe Bolognese::Metadata, vcr: true do
31
29
  expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
32
30
  expect(datacite.fetch("creators").length).to eq(7)
33
31
  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")
32
+ expect(datacite.fetch("publisher")).to eq({"name"=>"Hindawi Limited"})
37
33
  end
38
34
 
39
35
  it "Crossref DOI" do
@@ -45,9 +41,7 @@ describe Bolognese::Metadata, vcr: true do
45
41
  expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
46
42
  expect(datacite.fetch("creators").length).to eq(5)
47
43
  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.")
44
+ expect(datacite.fetch("publisher")).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."})
51
45
  end
52
46
 
53
47
  it "BlogPosting Citeproc JSON" do
@@ -58,9 +52,7 @@ describe Bolognese::Metadata, vcr: true do
58
52
  expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}])
59
53
  expect(datacite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food")
60
54
  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")
55
+ expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"})
64
56
  end
65
57
 
66
58
  it "rdataone" do
@@ -72,9 +64,7 @@ describe Bolognese::Metadata, vcr: true do
72
64
  expect(datacite.fetch("creators").first).to eq("affiliation"=>[{"name"=>"NCEAS"}], "nameType"=>"Personal", "name" => "Jones, Matt",
73
65
  "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "givenName"=>"Matt", "familyName"=>"Jones")
74
66
  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")
67
+ expect(datacite.fetch("publisher")).to eq({"name"=>"https://cran.r-project.org"})
78
68
  end
79
69
 
80
70
  it "maremma" do
@@ -90,9 +80,7 @@ describe Bolognese::Metadata, vcr: true do
90
80
  [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738",
91
81
  "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
92
82
  "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")
83
+ expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"})
96
84
  end
97
85
 
98
86
  it "with data citation schema.org" do
@@ -103,26 +91,22 @@ describe Bolognese::Metadata, vcr: true do
103
91
  expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}])
104
92
  expect(datacite.fetch("relatedIdentifiers").count).to eq(3)
105
93
  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")
94
+ expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"})
109
95
  end
110
96
 
111
97
  it "DataCite DOI with Schema 4.5 publisher attributes" do
112
98
  input = fixture_path + "datacite-example-full-v4.5.xml"
113
99
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
114
100
  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")
101
+ expect(datacite.fetch("publisher")).to eq(
102
+ {
103
+ "name" => "Example Publisher",
104
+ "publisherIdentifier" => "https://ror.org/04z8jg394",
105
+ "publisherIdentifierScheme" => "ROR",
106
+ "schemeUri" => "https://ror.org/",
107
+ "lang" => "en",
108
+ },
109
+ )
126
110
  end
127
111
  end
128
112
  end
@@ -286,6 +286,77 @@ describe Bolognese::Metadata, vcr: true do
286
286
  )
287
287
  end
288
288
 
289
+ it "Schema 4.6" do
290
+ input = fixture_path + 'datacite-example-full-v4.6.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.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
297
+ expect(datacite.dig("contributors", "contributor").count).to eq(2)
298
+ expect(datacite.dig("contributors", "contributor")).to include(
299
+ {
300
+ "contributorType"=>"Translator",
301
+ "contributorName"=>{
302
+ "nameType"=>"Personal",
303
+ "__content__"=>"Doe, Jane"
304
+ },
305
+ "givenName"=>"Jane",
306
+ "familyName"=>"Doe",
307
+ "nameIdentifier"=>{
308
+ "nameIdentifierScheme"=>"ORCID",
309
+ "schemeURI"=>"https://orcid.org",
310
+ "__content__"=>"https://orcid.org/0000-0003-1419-2405"
311
+ },
312
+ "affiliation"=>{
313
+ "affiliationIdentifier"=>"https://ror.org/04wxnsj81",
314
+ "affiliationIdentifierScheme"=>"ROR",
315
+ "schemeURI"=>"https://ror.org",
316
+ "__content__"=>"ExampleAffiliation"
317
+ }
318
+ }
319
+ )
320
+ expect(datacite.dig("dates", "date").count).to eq(5)
321
+ expect(datacite.dig("dates", "date")).to include(
322
+ {
323
+ "dateType"=>"Coverage",
324
+ "__content__"=>"2020-01-01"
325
+ }
326
+ )
327
+ expect(datacite.dig("resourceType")).to eq(
328
+ {
329
+ "__content__"=>"Research Project",
330
+ "resourceTypeGeneral"=>"Project"
331
+ }
332
+ )
333
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(4)
334
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")).to eq(
335
+ [
336
+ {
337
+ "relatedIdentifierType"=>"RRID",
338
+ "relationType"=>"References",
339
+ "__content__"=>"RRID:AB_90755"
340
+ },
341
+ {
342
+ "relatedIdentifierType"=>"CSTR",
343
+ "relationType"=>"References",
344
+ "__content__"=>"CSTR:AB_12345"
345
+ },
346
+ {
347
+ "relatedIdentifierType"=>"DOI",
348
+ "relationType"=>"HasTranslation",
349
+ "__content__"=>"10.1234/translated-version"
350
+ },
351
+ {
352
+ "relatedIdentifierType"=>"DOI",
353
+ "relationType"=>"IsTranslationOf",
354
+ "__content__"=>"10.1234/other-version"
355
+ }
356
+ ]
357
+ )
358
+ end
359
+
289
360
  it "Geolocations" do
290
361
  input = fixture_path + 'datacite-example-full-v4.5.xml'
291
362
  doi = "10.82433/B09Z-4K37"
@@ -87,7 +87,7 @@ describe Bolognese::Metadata, vcr: true do
87
87
  expect(jats.dig("publication_type")).to be_nil
88
88
  expect(jats.dig("source")).to eq("Eating your own Dog Food")
89
89
  expect(jats.dig("publisher_name")).to eq("DataCite")
90
- expect(jats.dig("person_group", "name")).to eq("surname"=>"Fenner", "given_names"=>"Martin")
90
+ expect(jats.dig("person_group", 0, "name")).to eq("surname"=>"Fenner", "given_names"=>"Martin")
91
91
  expect(jats.dig("year")).to eq("iso_8601_date"=>"2016-12-20", "__content__"=>"2016")
92
92
  expect(jats.dig("month")).to eq("12")
93
93
  expect(jats.dig("day")).to eq("20")
@@ -179,6 +179,13 @@ describe Bolognese::Metadata, vcr: true do
179
179
  expect(jats.dig("day")).to be_nil
180
180
  expect(jats.dig("pub_id")).to eq("pub_id_type"=>"doi", "__content__"=>"10.34747/g6yb-3412")
181
181
  end
182
+
183
+ it "with publisher with language" do
184
+ input = fixture_path + 'datacite-xml-lang.xml'
185
+ subject = Bolognese::Metadata.new(input: input)
186
+ jats = Maremma.from_xml(subject.jats).fetch("element_citation", {})
187
+ expect(jats.dig("publisher_name")).to eq({"xml:lang"=>"en", "__content__"=>"OSI SAF"})
188
+ end
182
189
  end
183
190
 
184
191
  context "change metadata as datacite xml" do
@@ -365,5 +365,54 @@ describe Bolognese::Metadata, vcr: true do
365
365
  expect(json["@type"]).to eq("CreativeWork")
366
366
  expect(json["datePublished"]).to eq("2019")
367
367
  end
368
+
369
+ it "from Schema 4.5 with publisher attributes" do
370
+ input = fixture_path + 'datacite-example-full-v4.5.xml'
371
+ subject = Bolognese::Metadata.new(input: input)
372
+ json = JSON.parse(subject.schema_org)
373
+ expect(json["publisher"]).to eq(
374
+ {
375
+ "@type" => "Organization",
376
+ "@id" => "https://ror.org/04z8jg394",
377
+ "name" => "Example Publisher"
378
+ }
379
+ )
380
+ end
381
+
382
+ it "from Schema 4.6 with Translator contributor, workTranslation, translationOfWork, and temporalCoverage" do
383
+ input = fixture_path + 'datacite-example-full-v4.6.xml'
384
+ subject = Bolognese::Metadata.new(input: input)
385
+ json = JSON.parse(subject.schema_org)
386
+
387
+ expect(json["@type"]).to eq(
388
+ "Project"
389
+ )
390
+ expect(json["translator"]).to eq(
391
+ {
392
+ "name" => "Jane Doe",
393
+ "givenName" => "Jane",
394
+ "familyName" => "Doe",
395
+ "affiliation" => {
396
+ "@type" => "Organization",
397
+ "@id" => "https://ror.org/04wxnsj81",
398
+ "name" => "ExampleAffiliation"
399
+ },
400
+ "contributorType" => "Translator",
401
+ "@type" => "Person",
402
+ "@id" => "https://orcid.org/0000-0003-1419-2405"
403
+ }
404
+ )
405
+ expect(json["workTranslation"]).to eq(
406
+ "@id" => "https://doi.org/10.1234/translated-version",
407
+ "@type" => "CreativeWork"
408
+ )
409
+ expect(json["translationOfWork"]).to eq(
410
+ "@id" => "https://doi.org/10.1234/other-version",
411
+ "@type" => "CreativeWork"
412
+ )
413
+ expect(json["temporalCoverage"]).to eq(
414
+ "2020-01-01"
415
+ )
416
+ end
368
417
  end
369
418
  end