bolognese 2.0.0 → 2.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23ccf372b59b7d9c8919ec7ad7137eef6e99512eed488977e847f938f389aa2f
4
- data.tar.gz: 390e56023d57e637a52776a98dcd0bea4fa0acd8b8459ced05cbc6785f69fe0a
3
+ metadata.gz: ce52f2eb08396d0e56bdccf06702901fe7c04f1925cacafc71f315a1edda91c3
4
+ data.tar.gz: 29fb5a1d987a95220bbc7a3912aa24735f54924f47c8a74d61d1f51e25b75314
5
5
  SHA512:
6
- metadata.gz: 3a7364a75d69846ada1320bc0e8954b72695216d2807ec39ab1694ac4d120d97806addb9ceed8b9da8c1eb06ae28740cf6d2c118cb76a05e15ca993bf81ad470
7
- data.tar.gz: 6281527f6b312d398a96b9f1df9be55de991f6ac939417131633b24ddaa24741c3b86c3b2e4e73408ca1350e0b17addf9439ae30dff998bc6dda07e8c4459db7
6
+ metadata.gz: 4d528d2597900dfb90410504833a83e79b1bda1974d9f77102071cecd3f71c3e1f899d8e59abe24cf1110469807cc0c6382c50a5a62571ceceb9278e7cfa37b7
7
+ data.tar.gz: 341d76ed37284899ea1e74e331026ba6d042d92037a260d7591b9a48b38b7c8a0b06a6908e97917b2c345c5be8b3ac6475cc63a5478891589d624f248137b315
@@ -7,7 +7,7 @@ jobs:
7
7
  strategy:
8
8
  fail-fast: false
9
9
  matrix:
10
- ruby: ["2.6", "2.7", "3.0", "3.1"]
10
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v3
@@ -11,10 +11,10 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v3
14
- - name: Set up Ruby 2.6
14
+ - name: Set up Ruby 3.1.4
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: "2.6"
17
+ ruby-version: "3.1.4"
18
18
 
19
19
  - name: Build
20
20
  run: |
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (2.0.0)
4
+ bolognese (2.2.0)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -16,9 +16,9 @@ PATH
16
16
  json-ld-preloaded (~> 3.1, >= 3.1.3)
17
17
  jsonlint (~> 0.3.0)
18
18
  loofah (~> 2.0, >= 2.0.3)
19
- maremma (>= 4.9.4, < 5)
19
+ maremma (~> 5.0)
20
20
  namae (~> 1.0)
21
- nokogiri (>= 1.13.2, < 1.14)
21
+ nokogiri (~> 1.16, >= 1.16.2)
22
22
  oj (~> 3.10)
23
23
  oj_mimic_json (~> 1.0, >= 1.0.1)
24
24
  postrank-uri (~> 1.0, >= 1.0.18)
@@ -95,10 +95,10 @@ GEM
95
95
  concurrent-ruby (~> 1.0)
96
96
  iso8601 (0.9.1)
97
97
  json (2.6.2)
98
- json-canonicalization (0.3.2)
99
- json-ld (3.2.5)
98
+ json-canonicalization (0.3.1)
99
+ json-ld (3.2.4)
100
100
  htmlentities (~> 4.3)
101
- json-canonicalization (~> 0.3, >= 0.3.2)
101
+ json-canonicalization (~> 0.3)
102
102
  link_header (~> 0.0, >= 0.0.8)
103
103
  multi_json (~> 1.15)
104
104
  rack (>= 2.2, < 4)
@@ -114,7 +114,7 @@ GEM
114
114
  loofah (2.21.3)
115
115
  crass (~> 1.0.2)
116
116
  nokogiri (>= 1.12.0)
117
- maremma (4.9.9)
117
+ maremma (5.0.0)
118
118
  activesupport (>= 4.2.5)
119
119
  addressable (>= 2.3.6)
120
120
  builder (~> 3.2, >= 3.2.2)
@@ -125,17 +125,17 @@ GEM
125
125
  faraday-follow_redirects (~> 0.3.0)
126
126
  faraday-gzip (~> 0.1.0)
127
127
  faraday-multipart (~> 1.0.4)
128
- nokogiri (>= 1.13.1, < 1.14.0)
128
+ nokogiri (~> 1.16, >= 1.16.2)
129
129
  oj (>= 2.8.3)
130
130
  oj_mimic_json (~> 1.0, >= 1.0.1)
131
131
  matrix (0.4.2)
132
- mini_portile2 (2.8.0)
132
+ mini_portile2 (2.8.5)
133
133
  minitest (5.18.0)
134
134
  multi_json (1.15.0)
135
135
  multipart-post (2.3.0)
136
136
  namae (1.1.1)
137
- nokogiri (1.13.9)
138
- mini_portile2 (~> 2.8.0)
137
+ nokogiri (1.16.2)
138
+ mini_portile2 (~> 2.8.2)
139
139
  racc (~> 1.4)
140
140
  oj (3.14.2)
141
141
  oj_mimic_json (1.0.1)
@@ -225,6 +225,7 @@ DEPENDENCIES
225
225
  bundler (>= 1.0)
226
226
  byebug
227
227
  hashdiff (>= 1.0.0.beta1, < 2.0.0)
228
+ json-canonicalization (= 0.3.1)
228
229
  rack-test (~> 0)
229
230
  rake (~> 12.0)
230
231
  rspec (~> 3.4)
@@ -234,4 +235,4 @@ DEPENDENCIES
234
235
  webmock (~> 3.0, >= 3.0.1)
235
236
 
236
237
  BUNDLED WITH
237
- 2.4.20
238
+ 2.5.5
data/bolognese.gemspec CHANGED
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
13
13
  s.version = Bolognese::VERSION
14
14
  s.extra_rdoc_files = ["README.md"]
15
15
  s.license = 'MIT'
16
- s.required_ruby_version = ['>=2.3']
16
+ s.required_ruby_version = ['>=3.0']
17
17
 
18
18
  # Declare dependencies here, rather than in the Gemfile
19
- s.add_dependency 'maremma', '>= 4.9.4', '< 5'
19
+ s.add_dependency 'maremma', '~> 5.0'
20
20
  #s.add_dependency 'faraday', '~> 0.17.3'
21
- s.add_dependency 'nokogiri', '>= 1.13.2', '< 1.14'
21
+ s.add_dependency 'nokogiri', '~> 1.16', '>= 1.16.2'
22
22
  s.add_dependency 'loofah', '~> 2.0', '>= 2.0.3'
23
23
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
24
24
  s.add_dependency 'activesupport', '>= 4.2.5'
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.add_development_dependency 'simplecov', '0.17.1'
51
51
  s.add_development_dependency 'hashdiff', ['>= 1.0.0.beta1', '< 2.0.0']
52
52
  s.add_development_dependency 'byebug'
53
+ s.add_development_dependency 'json-canonicalization', '0.3.1'
53
54
 
54
55
  s.require_paths = ["lib"]
55
56
  s.files = `git ls-files`.split($/)
@@ -30,20 +30,20 @@ module Bolognese
30
30
  name_type = parse_attributes(author.fetch("creatorName", nil), content: "nameType", first: true) || parse_attributes(author.fetch("contributorName", nil), content: "nameType", first: true)
31
31
 
32
32
  name_identifiers = Array.wrap(author.fetch("nameIdentifier", nil)).map do |ni|
33
- ni["__content__"] = ni["__content__"].strip
33
+ name_identifier = ni["__content__"].strip if ni["__content__"].present?
34
34
  if ni["nameIdentifierScheme"] == "ORCID"
35
35
  {
36
- "nameIdentifier" => normalize_orcid(ni["__content__"]),
36
+ "nameIdentifier" => normalize_orcid(name_identifier),
37
37
  "schemeUri" => "https://orcid.org",
38
38
  "nameIdentifierScheme" => "ORCID" }.compact
39
39
  elsif ni["nameIdentifierScheme"] == "ROR"
40
40
  {
41
- "nameIdentifier" => normalize_ror(ni["__content__"]),
41
+ "nameIdentifier" => normalize_ror(name_identifier),
42
42
  "schemeUri" => "https://ror.org",
43
43
  "nameIdentifierScheme" => "ROR" }.compact
44
44
  else
45
45
  {
46
- "nameIdentifier" => ni["__content__"],
46
+ "nameIdentifier" => name_identifier,
47
47
  "schemeUri" => ni.fetch("schemeURI", nil),
48
48
  "nameIdentifierScheme" => ni["nameIdentifierScheme"] }.compact
49
49
  end
@@ -96,7 +96,7 @@ module Bolognese
96
96
  if container.present?
97
97
  container["title"]
98
98
  elsif types["citeproc"] == "article-journal"
99
- publisher
99
+ publisher["name"] if publisher.present?
100
100
  else
101
101
  nil
102
102
  end
@@ -101,7 +101,7 @@ module Bolognese
101
101
  { "name" => r.strip }
102
102
  elsif r.is_a?(Hash)
103
103
  {
104
- "name" => r["__content__"].strip,
104
+ "name" => r["__content__"].present? ? r["__content__"].strip : nil,
105
105
  "publisherIdentifier" => r["publisherIdentifierScheme"] == "ROR" ? normalize_ror(r["publisherIdentifier"]) : r["publisherIdentifier"],
106
106
  "publisherIdentifierScheme" => r["publisherIdentifierScheme"],
107
107
  "schemeUri" => r["schemeURI"],
@@ -74,8 +74,11 @@ module Bolognese
74
74
  creators = get_authors(from_schema_org_creators(Array.wrap(authors)))
75
75
  end
76
76
  contributors = get_authors(from_schema_org_contributors(Array.wrap(meta.fetch("editor", nil))))
77
- publisher_name = parse_attributes(meta.fetch("publisher", nil), content: "name", first: true)
78
- publisher = { "name" => publisher_name } if publisher_name.present?
77
+
78
+ publisher = {
79
+ "name" => parse_attributes(meta.fetch("publisher", nil), content: "name", first: true),
80
+ "publisherIdentifier" => parse_attributes(meta.fetch("publisher", nil), content: "@id", first: true),
81
+ }.compact if meta.fetch("publisher", nil).present?
79
82
 
80
83
  ct = (schema_org == "Dataset") ? "includedInDataCatalog" : "Periodical"
81
84
  container = if meta.fetch(ct, nil).present?
@@ -600,12 +600,12 @@ module Bolognese
600
600
  end
601
601
 
602
602
  def validate_orcid(orcid)
603
- orcid = Array(/\A(?:(?:http|https):\/\/(?:(?:www|sandbox)?\.)?orcid\.org\/)?(\d{4}[[:space:]-]\d{4}[[:space:]-]\d{4}[[:space:]-]\d{3}[0-9X]+)\z/.match(orcid)).last
603
+ orcid = Array(/\A(?:(?:http|https):\/\/(?:(?:www|sandbox)?\.)?orcid\.org\/)?(\d{4}[[:space:]-]\d{4}[[:space:]-]\d{4}[[:space:]-]\d{3}[0-9X]+)\/{0,1}\z/.match(orcid)).last
604
604
  orcid.gsub(/[[:space:]]/, "-") if orcid.present?
605
605
  end
606
606
 
607
607
  def validate_ror(ror)
608
- Array(/^(?:(?:(?:http|https):\/\/)?ror\.org\/)?(0\w{6}\d{2})$/.match(ror)).last
608
+ Array(/^(?:(?:(?:http|https):\/\/)?ror\.org\/)?(0\w{6}\d{2})\/{0,1}$/.match(ror)).last
609
609
  end
610
610
 
611
611
  def validate_orcid_scheme(orcid_scheme)
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "2.0.0"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -4,11 +4,8 @@ module Bolognese
4
4
  module Writers
5
5
  module DataciteJsonWriter
6
6
  def datacite_json
7
- # Remove the following change for the schema 4.5 release
8
7
  if crosscite_hsh.present?
9
- datacite_json_hsh = crosscite_hsh
10
- datacite_json_hsh['publisher'] = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank?
11
- JSON.pretty_generate datacite_json_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) }
8
+ JSON.pretty_generate crosscite_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) }
12
9
  end
13
10
  end
14
11
  end
@@ -86,7 +86,10 @@ module Bolognese
86
86
  end
87
87
 
88
88
  def insert_publisher_name(xml)
89
- xml.send("publisher-name", publisher["name"])
89
+ attributes = {
90
+ "xml:lang" => publisher["lang"]
91
+ }.compact
92
+ xml.send("publisher-name", attributes, publisher["name"])
90
93
  end
91
94
 
92
95
  def insert_publication_date(xml)
@@ -37,7 +37,7 @@ module Bolognese
37
37
  "schemaVersion" => schema_version,
38
38
  "periodical" => types.present? ? ((types["schemaOrg"] != "Dataset") && container.present? ? to_schema_org(container) : nil) : nil,
39
39
  "includedInDataCatalog" => types.present? ? ((types["schemaOrg"] == "Dataset") && container.present? ? to_schema_org_container(container, type: "Dataset") : nil) : nil,
40
- "publisher" => publisher.present? ? { "@type" => "Organization", "name" => publisher["name"] } : nil,
40
+ "publisher" => publisher.present? ? { "@type" => "Organization", "@id" => publisher["publisherIdentifier"], "name" => publisher["name"] }.compact : nil,
41
41
  "funder" => to_schema_org_funder(funding_references),
42
42
  "provider" => agency.present? ? { "@type" => "Organization", "name" => agency } : nil
43
43
  }.compact.presence
@@ -168,11 +168,12 @@ describe Bolognese::Metadata, vcr: true do
168
168
  expect(subject.creators[4]).to eq("nameType"=>"Organizational", "name"=>"University Of Kivu", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/01qfhxr31", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
169
169
  expect(subject.creators[5]).to eq("nameType"=>"Organizational", "name"=>"សាកលវិទ្យាល័យកម្ពុជា", "nameIdentifiers"=> [{"nameIdentifier"=>"http://ror.org/025e3rc84", "nameIdentifierScheme"=>"RORS"}], "affiliation"=>[])
170
170
  expect(subject.creators[6]).to eq("nameType"=>"Organizational", "name"=>"جامعة زاخۆ", "nameIdentifiers"=> [{"nameIdentifier"=>"05sd1pz50", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"RORS"}], "affiliation"=>[])
171
+ expect(subject.creators[9]).to eq("nameType"=>"Organizational", "name"=>"Gump South Pacific Research Station", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/04sk0et52", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
171
172
  expect(subject.contributors.first).to eq("nameType"=>"Organizational", "name"=>" Nawroz University ", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/04gp75d48", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[], "contributorType"=>"Producer")
172
173
  expect(subject.contributors.last).to eq("nameType"=>"Organizational", "name"=>"University Of Greenland (Https://Www.Uni.Gl/)", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/00t5j6b61", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}],"affiliation"=>[], "contributorType"=>"Sponsor")
173
174
  end
174
175
 
175
- context "affiliationIdentifier" do
176
+ context "affiliationIdentifier/nameIdentifier" do
176
177
  let(:input) { fixture_path + 'datacite-example-ROR-nameIdentifiers.xml' }
177
178
  subject { Bolognese::Metadata.new(input: input, from: "datacite") }
178
179
 
@@ -207,6 +208,11 @@ describe Bolognese::Metadata, vcr: true do
207
208
  expect(subject.creators[8]["nameIdentifiers"]).to eq([{"nameIdentifier"=>"https://orcid.org/0000-0001-9998-0118", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}])
208
209
  end
209
210
 
211
+ it "should normalize valid ORCID nameIdentifier with trailing slash" do
212
+ #" 0000-0001-9998-0118 ", # Valid ORCID with leading/trailing spaces
213
+ expect(subject.creators[10]["nameIdentifiers"]).to eq([{"nameIdentifier"=>"https://orcid.org/0000-0001-9998-0117", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}])
214
+ end
215
+
210
216
  it "should parse non ROR schema's without normalizing them" do
211
217
  input = fixture_path + 'datacite-example-ROR-nameIdentifiers.xml'
212
218
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
@@ -250,4 +256,4 @@ describe Bolognese::Metadata, vcr: true do
250
256
  expect(response).to eq("Matt Jones and Peter Slaughter and {University of California, Santa Barbara}")
251
257
  end
252
258
  end
253
- end
259
+ end
@@ -43,6 +43,14 @@
43
43
  <creatorName nameType="Personal">Mike B</creatorName>
44
44
  <nameIdentifier nameIdentifierScheme="ORCID"> 0000-0001-9998-0118 </nameIdentifier>
45
45
  </creator>
46
+ <creator>
47
+ <creatorName nameType="Organizational">Gump South Pacific Research Station</creatorName>
48
+ <nameIdentifier nameIdentifierScheme="ROR" schemeURI="https://ror.org/">https://ror.org/04sk0et52/</nameIdentifier>
49
+ </creator>
50
+ <creator>
51
+ <creatorName nameType="Personal">Ashwini Sukale</creatorName>
52
+ <nameIdentifier schemeURI="https://orcid.org/" nameIdentifierScheme="ORCID">https://orcid.org/0000-0001-9998-0117/</nameIdentifier>
53
+ </creator>
46
54
  </creators>
47
55
  <titles>
48
56
  <title xml:lang="en-US">Genomic Standards Consortium (GSC) Island Sampling Day: Moorea Reef to Ridges Genomic Transect</title>
@@ -15,7 +15,7 @@
15
15
  <title xml:lang="en">DOI Test 2 title content</title>
16
16
  <title xml:lang="en">AAPP</title>
17
17
  </titles>
18
- <publisher>OSI SAF</publisher>
18
+ <publisher xml:lang="en">OSI SAF</publisher>
19
19
  <publicationYear>2004</publicationYear>
20
20
  <resourceType resourceTypeGeneral="Collection">Climate Data Record</resourceType>
21
21
  <dates>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://schema.datacite.org/meta/kernel-4.3/metadata.xsd">
3
+ <identifier identifierType="DOI">10.15148/3b68dac4-7688-4fbb-ba64-5f9b3bbab954</identifier>
4
+ <creators>
5
+ <creator>
6
+ <creatorName>SNO KARST</creatorName>
7
+ <nameIdentifier nameIdentifierScheme="ORCID" schemeURI="https://orcid.org"/>
8
+ </creator>
9
+ </creators>
10
+ <publisher>OSU OREME</publisher>
11
+ <titles>
12
+ <title>Time series of type chemistry in Le Tarn basin - PARC NATIONAL CEVENNES observatory - KARST observatory network - OZCAR Critical Zone network Research Infrastructure</title>
13
+ </titles>
14
+ <publicationYear>2023</publicationYear>
15
+ <contributors>
16
+ <contributor contributorType="ProjectMember">
17
+ <contributorName>Manche, Yannick</contributorName>
18
+ <nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID"></nameIdentifier>
19
+ </contributor>
20
+ </contributors>
21
+ <resourceType resourceTypeGeneral="Dataset">Dataset</resourceType>
22
+ </resource>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
3
+ <identifier identifierType="DOI">10.81360/4DVP-KR57</identifier>
4
+ <creators>
5
+ <creator>
6
+ <creatorName nameType="Personal">Møller, Jørgen</creatorName>
7
+ <givenName>Jørgen</givenName>
8
+ <familyName>Møller</familyName>
9
+ </creator>
10
+ </creators>
11
+ <titles>
12
+ <title xml:lang="en">Economic Crisis and Democratic Breakdown in the Interwar Years: A Reassessment</title>
13
+ <title xml:lang="de">Wirtschaftskrise und demokratischer Zusammenbruch in der Zwischenkriegszeit: Eine Neubewertung</title>
14
+ </titles>
15
+ <publisher publisherIdentifier="https://ror.org/04wxnsj81"></publisher>
16
+ <publicationYear>2015</publicationYear>
17
+ <resourceType resourceTypeGeneral="JournalArticle"/>
18
+ </resource>
@@ -0,0 +1,64 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <resource
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
5
+ <identifier identifierType="DOI">10.60843/5EGY-VC42</identifier>
6
+ <creators>
7
+ <creator>
8
+ <creatorName nameType="Personal">Feldman, Heidi Li</creatorName>
9
+ <givenName>Heidi Li</givenName>
10
+ <familyName>Feldman</familyName>
11
+ <nameIdentifier nameIdentifierScheme="ORCID" schemeURI="https://orcid.org">https://orcid.org/0000-0003-1905-2698</nameIdentifier>
12
+ </creator>
13
+ </creators>
14
+ <titles>
15
+ <title xml:lang="en">Science and Uncertainty in Mass Exposure Litigation</title>
16
+ <title xml:lang="en">Science and Uncertainty in Mass Exposure Litigation, 74 Tex. L. Rev. 1 (1995)</title>
17
+ </titles>
18
+ <publisher>Texas Law Review</publisher>
19
+ <publicationYear>1995</publicationYear>
20
+ <resourceType resourceTypeGeneral="JournalArticle">Article</resourceType>
21
+ <subjects>
22
+ <subject subjectScheme="Fields of Science and Technology (FOS)" schemeURI="http://www.oecd.org/science/inno/38235147.pdf" classificationCode="5.5">FOS: Law</subject>
23
+ </subjects>
24
+ <contributors>
25
+ <contributor contributorType="HostingInstitution">
26
+ <contributorName nameType="Organizational">Georgetown Law Library</contributorName>
27
+ <nameIdentifier nameIdentifierScheme="" schemeURI=""/>
28
+ <affiliation affiliationIdentifier="https://ror.org/05vzafd60" affiliationIdentifierScheme="ROR" schemeURI="https://ror.org">Georgetown University</affiliation>
29
+ </contributor>
30
+ </contributors>
31
+ <dates>
32
+ <date dateType="Issued">1995-11</date>
33
+ <date dateType="Collected">2016-04-25</date>
34
+ </dates>
35
+ <language>en</language>
36
+ <relatedIdentifiers>
37
+ <relatedIdentifier relatedIdentifierType="ISSN" relationType="IsPublishedIn" resourceTypeGeneral="Journal">0040-4411</relatedIdentifier>
38
+ </relatedIdentifiers>
39
+ <relatedItems>
40
+ <relatedItem relatedItemType="Journal" relationType="IsSourceOf">
41
+ <relatedItemIdentifier relatedItemIdentifierType="ISSN">0040-4411</relatedItemIdentifier>
42
+ <creators>
43
+ <creator>
44
+ <creatorName>University of Texas School of Law</creatorName>
45
+ </creator>
46
+ </creators>
47
+ <titles>
48
+ <title>Texas Law Review</title>
49
+ </titles>
50
+ <publicationYear>1995</publicationYear>
51
+ <volume>74</volume>
52
+ <issue>1</issue>
53
+ </relatedItem>
54
+ </relatedItems>
55
+ <sizes/>
56
+ <formats>
57
+ <format>text/html</format>
58
+ <format>application/pdf</format>
59
+ </formats>
60
+ <version/>
61
+ <descriptions>
62
+ <description xml:lang="en" descriptionType="Abstract">Critics of the tort system have condemned courts for their alleged leniency in admitting scientific expert testimony, especially in mass exposure litigation. Claiming that this has resulted in an epidemic of "junk science" in the courtroom, these commentators have urged a more scientific approach to admissibility, intimating that employing more scientific standards would exclude scientific evidence favorable to plaintiffs, thereby demonstrating to factfinders that litigated substances are in fact safe or at least not unsafe.</description>
63
+ </descriptions>
64
+ </resource>
@@ -14,6 +14,7 @@
14
14
  }],
15
15
  "publisher": {
16
16
  "@type": "Organization",
17
+ "@id": "https://ror.org/04wxnsj81",
17
18
  "name": "DataCite"
18
19
  },
19
20
  "dateCreated": "2016-12-20",
@@ -1759,4 +1759,54 @@ 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
1762
1812
  end
@@ -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
@@ -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
@@ -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
@@ -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,18 @@ 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
368
381
  end
369
382
  end
metadata CHANGED
@@ -1,55 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
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-12-04 00:00:00.000000000 Z
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 4.9.4
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '5'
19
+ version: '5.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 4.9.4
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '5'
26
+ version: '5.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: nokogiri
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - ">="
31
+ - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: 1.13.2
40
- - - "<"
33
+ version: '1.16'
34
+ - - ">="
41
35
  - !ruby/object:Gem::Version
42
- version: '1.14'
36
+ version: 1.16.2
43
37
  type: :runtime
44
38
  prerelease: false
45
39
  version_requirements: !ruby/object:Gem::Requirement
46
40
  requirements:
47
- - - ">="
41
+ - - "~>"
48
42
  - !ruby/object:Gem::Version
49
- version: 1.13.2
50
- - - "<"
43
+ version: '1.16'
44
+ - - ">="
51
45
  - !ruby/object:Gem::Version
52
- version: '1.14'
46
+ version: 1.16.2
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: loofah
55
49
  requirement: !ruby/object:Gem::Requirement
@@ -556,6 +550,20 @@ dependencies:
556
550
  - - ">="
557
551
  - !ruby/object:Gem::Version
558
552
  version: '0'
553
+ - !ruby/object:Gem::Dependency
554
+ name: json-canonicalization
555
+ requirement: !ruby/object:Gem::Requirement
556
+ requirements:
557
+ - - '='
558
+ - !ruby/object:Gem::Version
559
+ version: 0.3.1
560
+ type: :development
561
+ prerelease: false
562
+ version_requirements: !ruby/object:Gem::Requirement
563
+ requirements:
564
+ - - '='
565
+ - !ruby/object:Gem::Version
566
+ version: 0.3.1
559
567
  description: Ruby gem and command-line utility for conversion of DOI metadata from
560
568
  and to different metadata formats, including schema.org.
561
569
  email: mfenner@datacite.org
@@ -814,7 +822,10 @@ files:
814
822
  - spec/fixtures/datacite-xml-lang.xml
815
823
  - spec/fixtures/datacite.json
816
824
  - spec/fixtures/datacite.xml
825
+ - spec/fixtures/datacite_blank_name_identifier.xml
826
+ - spec/fixtures/datacite_blank_publisher.xml
817
827
  - spec/fixtures/datacite_dataset.xml
828
+ - spec/fixtures/datacite_journal_article.xml
818
829
  - spec/fixtures/datacite_malformed_creator.xml
819
830
  - spec/fixtures/datacite_missing_creator.xml
820
831
  - spec/fixtures/datacite_schema_3.xml
@@ -1305,14 +1316,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
1305
1316
  requirements:
1306
1317
  - - ">="
1307
1318
  - !ruby/object:Gem::Version
1308
- version: '2.3'
1319
+ version: '3.0'
1309
1320
  required_rubygems_version: !ruby/object:Gem::Requirement
1310
1321
  requirements:
1311
1322
  - - ">="
1312
1323
  - !ruby/object:Gem::Version
1313
1324
  version: '0'
1314
1325
  requirements: []
1315
- rubygems_version: 3.0.3.1
1326
+ rubygems_version: 3.3.26
1316
1327
  signing_key:
1317
1328
  specification_version: 4
1318
1329
  summary: Ruby client library for conversion of DOI Metadata