bolognese 1.9.5 → 1.9.6

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: b05a742623de63d8886a0537b8c967bddcec647de85d65897153bd1639524a78
4
- data.tar.gz: adc7f82baf4a99cf8a4c3978a1b9b06278c1284127375d78fccba2c5d120dbb9
3
+ metadata.gz: ff3bcf60b444241f656e22e8b8af9c56596c76ac9962f1820e7a60325e03dc32
4
+ data.tar.gz: e4ed9204eeb068c97aadb672f74eb9605bb706f373b78c200e251a3e355f7296
5
5
  SHA512:
6
- metadata.gz: 13fbe8970222b3de01236c11f5d0b7cb5c8fc639be3b39ece95e60a9eda1d21c25873acfece64b7805c73754a5b2e841306c1c59bda6244d98ce0b297e3b278c
7
- data.tar.gz: 8a297ae52be86a370b4249f0be999696c70ab039e4d1f4303eb7d25a27541ab37c161864667d233223bbb3aefda967281a428ff6ce99de95e6b3789b445d126e
6
+ metadata.gz: 24a0093e1aa36d52a90b2e4db7ba125e3616f26c5f6420570d62ecc750d4a5b075bddc8d159a19e8a8305039066e9f1df27f3e68471a65261712044bcaaf4d1b
7
+ data.tar.gz: 82c64252ca5f03153aeecbac2d3f3d5f4dc29e50a2ef963fb80ae96271858f9e5e16856865eb0a43eb1686d0de7869f8089bea8395d74fa625e593cf6be0aee0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased](https://github.com/datacite/bolognese/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.5...HEAD)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Missing affiliationIdentiifer when used with schemaURI raises an error [\#116](https://github.com/datacite/bolognese/issues/116)
10
+ - Optional numberType being treated as required generating error [\#112](https://github.com/datacite/bolognese/issues/112)
11
+
12
+ **Closed issues:**
13
+
14
+ - Book metadata seems to be ignored [\#113](https://github.com/datacite/bolognese/issues/113)
15
+ - Namespaced XML Tags [\#109](https://github.com/datacite/bolognese/issues/109)
16
+
17
+ **Merged pull requests:**
18
+
19
+ - Fix missing affiliation identifier [\#117](https://github.com/datacite/bolognese/pull/117) ([richardhallett](https://github.com/richardhallett))
20
+
21
+ ## [1.9.5](https://github.com/datacite/bolognese/tree/1.9.5) (2021-04-20)
22
+
23
+ [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.4...1.9.5)
24
+
3
25
  ## [1.9.4](https://github.com/datacite/bolognese/tree/1.9.4) (2021-04-13)
4
26
 
5
27
  [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.3...1.9.4)
@@ -997,14 +1019,14 @@
997
1019
 
998
1020
  [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.11.15...v.0.11.16)
999
1021
 
1000
- ## [v.0.11.15](https://github.com/datacite/bolognese/tree/v.0.11.15) (2018-08-01)
1001
-
1002
- [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.11.14...v.0.11.15)
1003
-
1004
1022
  **Fixed bugs:**
1005
1023
 
1006
1024
  - Handle xs:string attribute [\#32](https://github.com/datacite/bolognese/issues/32)
1007
1025
 
1026
+ ## [v.0.11.15](https://github.com/datacite/bolognese/tree/v.0.11.15) (2018-08-01)
1027
+
1028
+ [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.11.14...v.0.11.15)
1029
+
1008
1030
  ## [v.0.11.14](https://github.com/datacite/bolognese/tree/v.0.11.14) (2018-07-28)
1009
1031
 
1010
1032
  [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.11.3...v.0.11.14)
@@ -1489,6 +1511,7 @@
1489
1511
  - Error displaying container-title [\#13](https://github.com/datacite/bolognese/issues/13)
1490
1512
  - Error parsing funding information [\#12](https://github.com/datacite/bolognese/issues/12)
1491
1513
  - crossref author id to orcid id? [\#10](https://github.com/datacite/bolognese/issues/10)
1514
+ - Support funding information [\#7](https://github.com/datacite/bolognese/issues/7)
1492
1515
  - datacite: support subjectScheme and subjectURI [\#4](https://github.com/datacite/bolognese/issues/4)
1493
1516
 
1494
1517
  ## [v.0.9.21](https://github.com/datacite/bolognese/tree/v.0.9.21) (2017-06-03)
@@ -1499,7 +1522,6 @@
1499
1522
 
1500
1523
  - Abstract should be a string in Citeproc writer [\#11](https://github.com/datacite/bolognese/issues/11)
1501
1524
  - the Bolognese gem doesn't properly handle the optional language attribute. [\#8](https://github.com/datacite/bolognese/issues/8)
1502
- - Support funding information [\#7](https://github.com/datacite/bolognese/issues/7)
1503
1525
  - datacite: support xml:lang in title [\#3](https://github.com/datacite/bolognese/issues/3)
1504
1526
 
1505
1527
  ## [v.0.9.20](https://github.com/datacite/bolognese/tree/v.0.9.20) (2017-05-13)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.9.5)
4
+ bolognese (1.9.6)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -30,7 +30,7 @@ PATH
30
30
  GEM
31
31
  remote: https://rubygems.org/
32
32
  specs:
33
- activesupport (6.1.3.1)
33
+ activesupport (6.1.3.2)
34
34
  concurrent-ruby (~> 1.0, >= 1.0.2)
35
35
  i18n (>= 1.6, < 2)
36
36
  minitest (>= 5.1)
@@ -38,6 +38,7 @@ GEM
38
38
  zeitwerk (~> 2.3)
39
39
  addressable (2.7.0)
40
40
  public_suffix (>= 2.0.2, < 5.0)
41
+ amazing_print (1.3.0)
41
42
  benchmark_methods (0.7)
42
43
  bibtex-ruby (6.0.0)
43
44
  latex-decode (~> 0.0)
@@ -54,15 +55,17 @@ GEM
54
55
  crass (1.0.6)
55
56
  csl (1.5.2)
56
57
  namae (~> 1.0)
57
- csl-styles (1.0.1.10)
58
+ csl-styles (1.0.1.11)
58
59
  csl (~> 1.0)
59
60
  diff-lcs (1.4.4)
60
61
  docile (1.3.5)
61
- ebnf (2.1.2)
62
+ ebnf (2.1.3)
63
+ amazing_print (~> 1.2)
62
64
  htmlentities (~> 4.3)
63
65
  rdf (~> 3.1)
64
66
  scanf (~> 1.0)
65
67
  sxp (~> 1.1)
68
+ unicode-types (~> 1.6)
66
69
  edtf (3.0.6)
67
70
  activesupport (>= 3.0, < 7.0)
68
71
  excon (0.71.1)
@@ -191,6 +194,7 @@ GEM
191
194
  tilt (2.0.10)
192
195
  tzinfo (2.0.4)
193
196
  concurrent-ruby (~> 1.0)
197
+ unicode-types (1.6.0)
194
198
  unicode_utils (1.4.0)
195
199
  vcr (3.0.3)
196
200
  webmock (3.12.1)
@@ -215,4 +219,4 @@ DEPENDENCIES
215
219
  webmock (~> 3.0, >= 3.0.1)
216
220
 
217
221
  BUNDLED WITH
218
- 2.2.16
222
+ 2.2.18
@@ -138,14 +138,19 @@ module Bolognese
138
138
 
139
139
  def get_affiliations(affiliations)
140
140
  Array.wrap(affiliations).map do |a|
141
+ affiliation_identifier = nil
141
142
  if a.is_a?(String)
142
143
  name = a.squish
143
- affiliation_identifier = nil
144
144
  affiliation_identifier_scheme = nil
145
145
  scheme_uri = nil
146
146
  else
147
- affiliation_identifier = a["affiliationIdentifier"]
148
- affiliation_identifier = !affiliation_identifier.to_s.start_with?("https://") && a["schemeURI"].present? ? normalize_id(a["schemeURI"] + affiliation_identifier) : normalize_id(affiliation_identifier)
147
+ if a["affiliationIdentifier"].present?
148
+ affiliation_identifier = a["affiliationIdentifier"]
149
+ if a["schemeURI"].present?
150
+ schemeURI = a["schemeURI"].end_with?("/") ? a["schemeURI"] : a["schemeURI"] + "/"
151
+ end
152
+ affiliation_identifier = !affiliation_identifier.to_s.start_with?("https://") && schemeURI.present? ? normalize_id(schemeURI + affiliation_identifier) : normalize_id(affiliation_identifier)
153
+ end
149
154
  name = a["__content__"].to_s.squish.presence
150
155
  affiliation_identifier_scheme = a["affiliationIdentifierScheme"]
151
156
  scheme_uri = a["SchemeURI"]
@@ -9,10 +9,11 @@ module Bolognese
9
9
  end
10
10
 
11
11
  def validate_funder_doi(doi)
12
- doi = Array(/\A(?:(http|https):\/(\/)?(dx\.)?(doi.org|handle.test.datacite.org)\/)?(doi:)?(10\.13039\/)?(5.+)\z/.match(doi)).last
12
+ doi = Array(/\A(?:(http|https):\/(\/)?(dx\.)?(doi.org|handle.test.datacite.org)\/)?(doi:)?(10\.13039\/)?([1-9]\d+)\z/.match(doi)).last
13
+
13
14
  # remove non-printing whitespace and downcase
14
15
  if doi.present?
15
- doi.delete("\u200B").downcase
16
+ doi.delete("\u200B").downcase
16
17
  "https://doi.org/10.13039/#{doi}"
17
18
  end
18
19
  end
@@ -56,10 +56,10 @@ module Bolognese
56
56
  # book_series_metadata.dig("publisher", "publisher_name")
57
57
  # end
58
58
  when "conference"
59
- event_metadata = meta.dig("crossref", "conference", "event_metadata") || {}
59
+ event_metadata = meta.dig("crossref", "conference", "event_metadata") || {}
60
60
  bibliographic_metadata = meta.dig("crossref", "conference", "conference_paper").to_h
61
61
  when "journal"
62
- journal_metadata = meta.dig("crossref", "journal", "journal_metadata") || {}
62
+ journal_metadata = meta.dig("crossref", "journal", "journal_metadata") || {}
63
63
  journal_issue = meta.dig("crossref", "journal", "journal_issue") || {}
64
64
  journal_article = meta.dig("crossref", "journal", "journal_article") || {}
65
65
  bibliographic_metadata = journal_article.presence || journal_issue.presence || journal_metadata
@@ -140,7 +140,8 @@ module Bolognese
140
140
  state = meta.present? || read_options.present? ? "findable" : "not_found"
141
141
 
142
142
  related_identifiers = Array.wrap(crossref_is_part_of(journal_metadata)) + Array.wrap(crossref_references(bibliographic_metadata))
143
- container = if journal_metadata.present? || book_metadata.present?
143
+
144
+ container = if journal_metadata.present?
144
145
  issn = normalize_issn(journal_metadata.to_h.fetch("issn", nil))
145
146
 
146
147
  { "type" => "Journal",
@@ -151,6 +152,19 @@ module Bolognese
151
152
  "issue" => parse_attributes(journal_issue.dig("issue")),
152
153
  "firstPage" => bibliographic_metadata.dig("pages", "first_page") || parse_attributes(journal_article.to_h.dig("publisher_item", "item_number"), first: true),
153
154
  "lastPage" => bibliographic_metadata.dig("pages", "last_page") }.compact
155
+
156
+ # By using book_metadata, we can account for where resource_type is `BookChapter` and not assume its a whole book
157
+ elsif book_metadata.present?
158
+ identifiers = crossref_alternate_identifiers(book_metadata)
159
+
160
+ {
161
+ "type" => "Book",
162
+ "title" => book_metadata.dig("titles", "title"),
163
+ "firstPage" => bibliographic_metadata.dig("pages", "first_page"),
164
+ "lastPage" => bibliographic_metadata.dig("pages", "last_page"),
165
+ "identifiers" => identifiers,
166
+ }.compact
167
+
154
168
  elsif book_series_metadata.to_h.fetch("series_metadata", nil).present?
155
169
  issn = normalize_issn(book_series_metadata.dig("series_metadata", "issn"))
156
170
 
@@ -162,7 +176,10 @@ module Bolognese
162
176
  end
163
177
 
164
178
  id = normalize_doi(options[:doi] || options[:id] || bibliographic_metadata.dig("doi_data", "doi"))
165
- identifiers = crossref_alternate_identifiers(bibliographic_metadata)
179
+
180
+ # Let sections override this in case of alternative metadata structures, such as book chapters, which
181
+ # have their meta inside `content_item`, but the main book indentifers inside of `book_metadata`
182
+ identifiers ||= crossref_alternate_identifiers(bibliographic_metadata)
166
183
 
167
184
  { "id" => id,
168
185
  "types" => types,
@@ -1306,8 +1306,8 @@ module Bolognese
1306
1306
  return [{
1307
1307
  "subject" => sanitize(hsh["__content__"] || hsh["subject"]),
1308
1308
  "subjectScheme" => hsh["subjectScheme"],
1309
- "schemeUri" => hsh["schemeURI"],
1310
- "valueUri" => hsh["valueURI"],
1309
+ "schemeUri" => hsh["schemeURI"] || hsh["schemeURI"],
1310
+ "valueUri" => hsh["valueURI"] || hsh["valueURI"],
1311
1311
  "classificationCode" => hsh["classificationCode"],
1312
1312
  "lang" => hsh["lang"] }.compact,
1313
1313
  {
@@ -1339,8 +1339,8 @@ module Bolognese
1339
1339
  "subject" => sanitize(hsh["__content__"] || hsh["subject"]),
1340
1340
  "subjectScheme" => hsh["subjectScheme"],
1341
1341
  "classificationCode" => hsh["classificationCode"],
1342
- "schemeUri" => hsh["schemeURI"],
1343
- "valueUri" => hsh["valueURI"],
1342
+ "schemeUri" => hsh["schemeURI"] || hsh["schemeURI"],
1343
+ "valueUri" => hsh["valueURI"] || hsh["valueURI"],
1344
1344
  "lang" => hsh["lang"] }.compact,
1345
1345
  {
1346
1346
  "subject" => "FOS: " + subject["fosLabel"],
@@ -1352,8 +1352,8 @@ module Bolognese
1352
1352
  "subject" => sanitize(hsh["__content__"] || hsh["subject"]),
1353
1353
  "subjectScheme" => hsh["subjectScheme"],
1354
1354
  "classificationCode" => hsh["classificationCode"],
1355
- "schemeUri" => hsh["schemeURI"],
1356
- "valueUri" => hsh["valueURI"],
1355
+ "schemeUri" => hsh["schemeURI"] || hsh["schemeURI"],
1356
+ "valueUri" => hsh["valueURI"] || hsh["valueURI"],
1357
1357
  "lang" => hsh["lang"] }.compact]
1358
1358
  end
1359
1359
  end
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.9.5"
2
+ VERSION = "1.9.6"
3
3
  end
@@ -76,7 +76,9 @@ module Bolognese
76
76
  end
77
77
 
78
78
  def insert_source(xml)
79
- if is_article? || is_data? || is_chapter?
79
+ if is_chapter?
80
+ xml.source(publisher)
81
+ elsif is_article? || is_data?
80
82
  xml.source(container && container["title"] || publisher)
81
83
  else
82
84
  xml.source(parse_attributes(titles, content: "title", first: true))
@@ -272,6 +272,18 @@ describe Bolognese::Metadata, vcr: true do
272
272
  response = subject.validate_funder_doi(doi)
273
273
  expect(response).to be_nil
274
274
  end
275
+
276
+ it { expect(subject.validate_funder_doi("10.13039/100000050")).to eq "https://doi.org/10.13039/100000050" }
277
+ it { expect(subject.validate_funder_doi("10.13039/100006492")).to eq "https://doi.org/10.13039/100006492" }
278
+ it { expect(subject.validate_funder_doi('http://handle.test.datacite.org/10.13039/100000080')).to eq "https://doi.org/10.13039/100000080" }
279
+ it { expect(subject.validate_funder_doi('https://doi.org/10.13039/100000001')).to eq "https://doi.org/10.13039/100000001" }
280
+ it { expect(subject.validate_funder_doi('http://doi.org/10.13039/501100001711')).to eq "https://doi.org/10.13039/501100001711" }
281
+ it { expect(subject.validate_funder_doi('https://dx.doi.org/10.13039/501100001711')).to eq "https://doi.org/10.13039/501100001711" }
282
+ it { expect(subject.validate_funder_doi('doi:10.13039/501100001711')).to eq "https://doi.org/10.13039/501100001711" }
283
+ it { expect(subject.validate_funder_doi('10.13039/501100001711')).to eq "https://doi.org/10.13039/501100001711" }
284
+ it { expect(subject.validate_funder_doi('501100001711')).to eq "https://doi.org/10.13039/501100001711" }
285
+ it { expect(subject.validate_funder_doi("https://doi.org/10.13039/5monkeymonkey")).to be_nil }
286
+ it { expect(subject.validate_funder_doi('10.13039/5monkeymonkey')).to be_nil }
275
287
  end
276
288
 
277
289
  context "validate prefix" do
@@ -372,6 +372,11 @@ describe Bolognese::Metadata, vcr: true do
372
372
  expect(subject.publication_year).to eq("2015")
373
373
  expect(subject.publisher).to eq("Springer Science and Business Media LLC")
374
374
  expect(subject.agency).to eq("crossref")
375
+ expect(subject.container["type"]).to eq("Book")
376
+ expect(subject.container["title"]).to eq("Shoulder Stiffness")
377
+ expect(subject.container["firstPage"]).to eq("155")
378
+ expect(subject.container["lastPage"]).to eq("158")
379
+ expect(subject.container["identifiers"]).to eq([{"identifier"=>"978-3-662-46369-7", "identifierType"=>"ISBN"}])
375
380
  end
376
381
 
377
382
  it "another book chapter" do
@@ -387,6 +392,10 @@ describe Bolognese::Metadata, vcr: true do
387
392
  expect(subject.publication_year).to eq("2018")
388
393
  expect(subject.publisher).to eq("Springer Science and Business Media LLC")
389
394
  expect(subject.agency).to eq("crossref")
395
+ expect(subject.container["type"]).to eq("Book Series")
396
+ expect(subject.container["title"]).to eq("SpringerBriefs in Medical Earth Sciences")
397
+ expect(subject.container["identifier"]).to eq("2523-3629")
398
+ expect(subject.container["identifierType"]).to eq("ISSN")
390
399
  end
391
400
 
392
401
  it "yet another book chapter" do
@@ -402,6 +411,11 @@ describe Bolognese::Metadata, vcr: true do
402
411
  expect(subject.publication_year).to eq("2012")
403
412
  expect(subject.publisher).to eq("IGI Global")
404
413
  expect(subject.agency).to eq("crossref")
414
+ expect(subject.container["type"]).to eq("Book")
415
+ expect(subject.container["title"]).to eq("Graph-Based Methods in Computer Vision")
416
+ expect(subject.container["firstPage"]).to eq("72")
417
+ expect(subject.container["lastPage"]).to eq("94")
418
+ expect(subject.container["identifiers"]).to eq([{"identifier"=>"9781466618916", "identifierType"=>"ISBN"}])
405
419
  end
406
420
 
407
421
  it "missing creator" do
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.9.5
4
+ version: 1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-20 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma