bolognese 1.11.2 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55d900e332741ad66b6b4bc1d0abd62fc7f2f8fff4e3800fa80c9745d5366cce
4
- data.tar.gz: 8d646dcaa3e7224387b49bb76102d979e2e8cd89f07e390a4b5ab296b5cbe907
3
+ metadata.gz: 84e06f3ca24650902cd1d96f777b2103a242fc44346d9995667961f090c1e300
4
+ data.tar.gz: 047d14ab54b8a9aa0569bdaeb90806a8a835809f399693c2b29c0a97e9eb0658
5
5
  SHA512:
6
- metadata.gz: 5b9b9e267bab3ffcbdd4b866867ca98e395b9222ce5bd396ac559a8133736562a31b382d2ddce0d75255ba6099ebcdd203f440a2c83ff20b86fd4072f0eda44e
7
- data.tar.gz: 913398d14852b68b6e4c82cb373f288a8746bb39b80586cba43960657ab63dd367efeedb8bb8e507fa68ecd2bdbd4d0a54945e3765a1115bea7e1ea5fe63ee4c
6
+ metadata.gz: 2547f9e0c41915163269e3802c32c2f73abf6977987748eb70eec7d324585487585a3952a8874bb40e35e4d65d748e6968c0d1f7d92f76992ee3068b2cd718dd
7
+ data.tar.gz: 3beb48ca299e9b0a1ab95e7e74fabd99e127c374a513b9b775644695e12ac489f3d35851bc1553bc01a593c2ce3c84bc37e8f5e2bd452f6ac561d431edd4f669
@@ -7,17 +7,3 @@ on:
7
7
  jobs:
8
8
  ci:
9
9
  uses: ./.github/workflows/ci.yml
10
- build:
11
- needs: ci
12
- runs-on: ubuntu-latest
13
- env:
14
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
15
- steps:
16
- - name: Notify Slack
17
- uses: adamkdean/simple-slack-notify@1.0.4
18
- with:
19
- channel: '#ops'
20
- username: 'GitHub Actions'
21
- color: 'good'
22
- text: 'A new version of the bolognese gem is ready for release.'
23
-
@@ -9,8 +9,6 @@ jobs:
9
9
  build:
10
10
  needs: ci
11
11
  runs-on: ubuntu-latest
12
- env:
13
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
14
12
  steps:
15
13
  - uses: actions/checkout@v3
16
14
  - name: Set up Ruby 2.6
@@ -32,11 +30,3 @@ jobs:
32
30
  gem push *.gem
33
31
  env:
34
32
  GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
35
-
36
- - name: Notify Slack
37
- uses: adamkdean/simple-slack-notify@1.0.4
38
- with:
39
- channel: '#ops'
40
- username: 'GitHub Actions'
41
- color: 'good'
42
- text: 'A new version of the bolognese gem has been released.'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.11.2)
4
+ bolognese (1.11.3)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -232,4 +232,4 @@ DEPENDENCIES
232
232
  webmock (~> 3.0, >= 3.0.1)
233
233
 
234
234
  BUNDLED WITH
235
- 2.3.12
235
+ 2.4.10
@@ -144,16 +144,28 @@ module Bolognese
144
144
  affiliation_identifier_scheme = nil
145
145
  scheme_uri = nil
146
146
  else
147
+ scheme_uri = a["schemeURI"]
147
148
  if a["affiliationIdentifier"].present?
148
149
  affiliation_identifier = a["affiliationIdentifier"]
149
150
  if a["schemeURI"].present?
150
151
  schemeURI = a["schemeURI"].end_with?("/") ? a["schemeURI"] : a["schemeURI"] + "/"
151
152
  end
152
153
  affiliation_identifier = !affiliation_identifier.to_s.start_with?("https://") && schemeURI.present? ? normalize_id(schemeURI + affiliation_identifier) : normalize_id(affiliation_identifier)
154
+ # The normalize_id(affiliation_identifier) method currently discards affiliation identifiers that don't start with a URL,
155
+ # for example: affiliation_identifier = "05bp8ka05".
156
+ # To address this issue, we are introducing the following change to handle such affiliation identifiers.
157
+ # when `normalize_id` method could not normalize, it returns nil, hence we have following condition
158
+ if affiliation_identifier.nil?
159
+ if a["affiliationIdentifierScheme"] == "ROR"
160
+ scheme_uri = "https://ror.org"
161
+ affiliation_identifier = normalize_ror(a["affiliationIdentifier"])
162
+ else
163
+ affiliation_identifier = a["affiliationIdentifier"]
164
+ end
165
+ end
153
166
  end
154
167
  name = a["__content__"].to_s.squish.presence
155
168
  affiliation_identifier_scheme = a["affiliationIdentifierScheme"]
156
- scheme_uri = a["SchemeURI"]
157
169
  end
158
170
 
159
171
  { "name" => name,
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.11.2"
2
+ VERSION = "1.11.3"
3
3
  end
@@ -163,15 +163,39 @@ describe Bolognese::Metadata, vcr: true do
163
163
  it "has ROR nameIdentifiers" do
164
164
  input = fixture_path + 'datacite-example-ROR-nameIdentifiers.xml'
165
165
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
166
- expect(subject.creators[1]).to eq("nameType"=>"Organizational", "name"=>"Gump South Pacific Research Station", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/04sk0et52", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
167
- expect(subject.creators[2]).to eq("nameType"=>"Organizational", "name"=>"University Of Vic", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/006zjws59", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
168
- expect(subject.creators[3]).to eq("nameType"=>"Organizational", "name"=>"University Of Kivu", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/01qfhxr31", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
169
- expect(subject.creators[4]).to eq("nameType"=>"Organizational", "name"=>"សាកលវិទ្យាល័យកម្ពុជា", "nameIdentifiers"=> [{"nameIdentifier"=>"http://ror.org/025e3rc84", "nameIdentifierScheme"=>"RORS"}], "affiliation"=>[])
170
- expect(subject.creators[5]).to eq("nameType"=>"Organizational", "name"=>"جامعة زاخۆ", "nameIdentifiers"=> [{"nameIdentifier"=>"05sd1pz50", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"RORS"}], "affiliation"=>[])
166
+ expect(subject.creators[2]).to eq("nameType"=>"Organizational", "name"=>"Gump South Pacific Research Station", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/04sk0et52", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
167
+ expect(subject.creators[3]).to eq("nameType"=>"Organizational", "name"=>"University Of Vic", "nameIdentifiers"=> [{"nameIdentifier"=>"https://ror.org/006zjws59", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"ROR"}], "affiliation"=>[])
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
+ expect(subject.creators[5]).to eq("nameType"=>"Organizational", "name"=>"សាកលវិទ្យាល័យកម្ពុជា", "nameIdentifiers"=> [{"nameIdentifier"=>"http://ror.org/025e3rc84", "nameIdentifierScheme"=>"RORS"}], "affiliation"=>[])
170
+ expect(subject.creators[6]).to eq("nameType"=>"Organizational", "name"=>"جامعة زاخۆ", "nameIdentifiers"=> [{"nameIdentifier"=>"05sd1pz50", "schemeUri"=>"https://ror.org", "nameIdentifierScheme"=>"RORS"}], "affiliation"=>[])
171
171
  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
172
  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
173
  end
174
174
 
175
+ context "affiliationIdentifier" do
176
+ it "should normalize ROR affiliationIdentifier with and without URL" do
177
+ input = fixture_path + 'datacite-example-ROR-nameIdentifiers.xml'
178
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
179
+ # without URL inside affiliationIdentifier="05bp8ka77"
180
+ ror_affiliater0 = subject.creators[0]["affiliation"].select { |r| r["affiliationIdentifierScheme"] == "ROR" }
181
+ expect(ror_affiliater0[0]["affiliationIdentifier"]).to eq("https://ror.org/05bp8ka77")
182
+ # with URL "affiliationIdentifier"=>"https://ror.org/05bp8ka05"
183
+ ror_affiliater1 = subject.creators[1]["affiliation"].select { |r| r["affiliationIdentifierScheme"] == "ROR" }
184
+ expect(ror_affiliater1[0]["affiliationIdentifier"]).to eq("https://ror.org/05bp8ka05")
185
+ end
186
+
187
+ it "should parse non ROR schema's without normalizing them" do
188
+ input = fixture_path + 'datacite-example-ROR-nameIdentifiers.xml'
189
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
190
+ # without "schemeURI"
191
+ grid_affiliater0 = subject.creators[0]["affiliation"].select { |r| r["affiliationIdentifierScheme"] == "GRID" }
192
+ expect(grid_affiliater0[0]["affiliationIdentifier"]).to eq("grid.268117.b")
193
+ # with "schemeURI"=>"https://grid.ac/institutes/"
194
+ grid_affiliater1 = subject.creators[1]["affiliation"].select { |r| r["affiliationIdentifierScheme"] == "GRID" }
195
+ expect(grid_affiliater1[0]["affiliationIdentifier"]).to eq("https://grid.ac/institutes/grid.268117.b")
196
+ end
197
+ end
198
+
175
199
  context "authors_as_string" do
176
200
  let(:author_with_organization) { [{"type"=>"Person",
177
201
  "id"=>"http://orcid.org/0000-0003-0077-4738",
@@ -3,10 +3,17 @@
3
3
  xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-%s http://schema.datacite.org/meta/kernel-4/metadata.xsd">
4
4
  <identifier identifierType="DOI">10.48321/D1Z60Q</identifier>
5
5
  <creators>
6
+ <creator>
7
+ <creatorName nameType="Personal">Ashwini Sukale</creatorName>
8
+ <nameIdentifier schemeURI="https://orcid.org/" nameIdentifierScheme="ORCID"> https://orcid.org/0000-0001-9998-0117 </nameIdentifier>
9
+ <affiliation affiliationIdentifier="05bp8ka77" affiliationIdentifierScheme="ROR"> Metadata Game Changers </affiliation>
10
+ <affiliation affiliationIdentifier="grid.268117.b" affiliationIdentifierScheme="GRID">Wesleyan University</affiliation>
11
+ </creator>
6
12
  <creator>
7
13
  <creatorName nameType="Personal">Erin Robinson</creatorName>
8
14
  <nameIdentifier schemeURI="https://orcid.org/" nameIdentifierScheme="ORCID"> https://orcid.org/0000-0001-9998-0114 </nameIdentifier>
9
15
  <affiliation schemeURI="https://ror.org" affiliationIdentifier="https://ror.org/05bp8ka05" affiliationIdentifierScheme="ROR"> Metadata Game Changers </affiliation>
16
+ <affiliation affiliationIdentifier="grid.268117.b" affiliationIdentifierScheme="GRID" schemeURI="https://grid.ac/institutes/">Wesleyan University</affiliation>
10
17
  </creator>
11
18
  <creator>
12
19
  <creatorName nameType="Organizational">Gump South Pacific Research Station</creatorName>
@@ -121,7 +121,7 @@ describe Bolognese::Metadata, vcr: true do
121
121
  "name"=>"Brown University"},
122
122
  {"affiliationIdentifier"=>"https://grid.ac/institutes/grid.268117.b",
123
123
  "affiliationIdentifierScheme"=>"GRID",
124
- "name"=>"Wesleyan University"}])
124
+ "name"=>"Wesleyan University", "schemeUri"=>"https://grid.ac/institutes/"}])
125
125
  expect(subject.creators.dig(2, "affiliation")).to eq([{"affiliationIdentifier"=>"https://ror.org/05gq02987",
126
126
  "affiliationIdentifierScheme"=>"ROR", "name"=>"Brown University"}])
127
127
  expect(subject.titles).to eq([{"lang"=>"en-US", "title"=>"Full DataCite XML Example"}, {"lang"=>"en-US", "title"=>"Demonstration of DataCite Properties.", "titleType"=>"Subtitle"}])
@@ -950,7 +950,7 @@ describe Bolognese::Metadata, vcr: true do
950
950
  expect(subject.types["ris"]).to eq("DATA")
951
951
  expect(subject.types["bibtex"]).to eq("misc")
952
952
  expect(subject.creators.length).to eq(1)
953
- expect(subject.creators.first).to eq("affiliation" => [{"affiliationIdentifier"=>"https://ror.org/04zt3wx35", "affiliationIdentifierScheme"=>"ROR", "name"=>"Canada Mortgage and Housing Corporation"}],
953
+ expect(subject.creators.first).to eq("affiliation" => [{"affiliationIdentifier"=>"https://ror.org/04zt3wx35", "affiliationIdentifierScheme"=>"ROR", "name"=>"Canada Mortgage and Housing Corporation", "schemeUri"=>"https://ror.org"}],
954
954
  "name" => "Statistique Canada",
955
955
  "nameIdentifiers" => [],
956
956
  "nameType" => "Organizational")
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.2
4
+ version: 1.11.3
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-06-08 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma