bolognese 1.9.18 → 2.0.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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +2 -30
  3. data/.github/workflows/ci.yml +22 -0
  4. data/.github/workflows/pull-request.yml +2 -14
  5. data/.github/workflows/release.yml +7 -22
  6. data/CHANGELOG.md +20 -11
  7. data/Gemfile.lock +65 -50
  8. data/bolognese.gemspec +3 -2
  9. data/lib/bolognese/author_utils.rb +14 -1
  10. data/lib/bolognese/datacite_utils.rb +18 -10
  11. data/lib/bolognese/doi_utils.rb +4 -0
  12. data/lib/bolognese/metadata.rb +1 -1
  13. data/lib/bolognese/metadata_utils.rb +1 -1
  14. data/lib/bolognese/readers/bibtex_reader.rb +2 -2
  15. data/lib/bolognese/readers/citeproc_reader.rb +1 -1
  16. data/lib/bolognese/readers/codemeta_reader.rb +2 -2
  17. data/lib/bolognese/readers/crosscite_reader.rb +4 -1
  18. data/lib/bolognese/readers/crossref_reader.rb +3 -4
  19. data/lib/bolognese/readers/datacite_json_reader.rb +4 -1
  20. data/lib/bolognese/readers/datacite_reader.rb +25 -9
  21. data/lib/bolognese/readers/npm_reader.rb +1 -1
  22. data/lib/bolognese/readers/ris_reader.rb +2 -2
  23. data/lib/bolognese/readers/schema_org_reader.rb +3 -2
  24. data/lib/bolognese/utils.rb +72 -14
  25. data/lib/bolognese/version.rb +1 -1
  26. data/lib/bolognese/writers/bibtex_writer.rb +1 -1
  27. data/lib/bolognese/writers/codemeta_writer.rb +1 -1
  28. data/lib/bolognese/writers/csv_writer.rb +1 -1
  29. data/lib/bolognese/writers/datacite_json_writer.rb +6 -1
  30. data/lib/bolognese/writers/jats_writer.rb +3 -3
  31. data/lib/bolognese/writers/ris_writer.rb +2 -2
  32. data/lib/bolognese/writers/schema_org_writer.rb +2 -2
  33. data/resources/kernel-4/include/datacite-relationType-v4.xsd +2 -0
  34. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +2 -0
  35. data/resources/kernel-4/metadata.xsd +11 -7
  36. data/resources/kernel-4.5/include/datacite-contributorType-v4.xsd +35 -0
  37. data/resources/kernel-4.5/include/datacite-dateType-v4.xsd +25 -0
  38. data/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd +19 -0
  39. data/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd +16 -0
  40. data/resources/kernel-4.5/include/datacite-nameType-v4.xsd +10 -0
  41. data/resources/kernel-4.5/include/datacite-numberType-v4.xsd +12 -0
  42. data/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd +34 -0
  43. data/resources/kernel-4.5/include/datacite-relationType-v4.xsd +53 -0
  44. data/resources/kernel-4.5/include/datacite-resourceType-v4.xsd +45 -0
  45. data/resources/kernel-4.5/include/datacite-titleType-v4.xsd +14 -0
  46. data/resources/kernel-4.5/include/xml.xsd +286 -0
  47. data/resources/kernel-4.5/metadata.xsd +711 -0
  48. data/spec/author_utils_spec.rb +52 -5
  49. data/spec/datacite_utils_spec.rb +5 -1
  50. data/spec/fixtures/citeproc.json +4 -2
  51. data/spec/fixtures/datacite-example-ROR-nameIdentifiers.xml +16 -1
  52. data/spec/fixtures/datacite-example-full-v4.5.xml +255 -0
  53. data/spec/fixtures/datacite-example-relateditems-with-attributes.xml +61 -0
  54. data/spec/fixtures/datacite-seriesinformation.xml +7 -2
  55. data/spec/fixtures/datacite.json +9 -3
  56. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_subjects/insert.yml +32 -14
  57. data/spec/readers/bibtex_reader_spec.rb +2 -0
  58. data/spec/readers/citeproc_reader_spec.rb +3 -0
  59. data/spec/readers/codemeta_reader_spec.rb +4 -4
  60. data/spec/readers/crosscite_reader_spec.rb +2 -0
  61. data/spec/readers/crossref_reader_spec.rb +41 -41
  62. data/spec/readers/datacite_json_reader_spec.rb +2 -0
  63. data/spec/readers/datacite_reader_spec.rb +118 -44
  64. data/spec/readers/npm_reader_spec.rb +2 -0
  65. data/spec/readers/ris_reader_spec.rb +3 -0
  66. data/spec/readers/schema_org_reader_spec.rb +11 -11
  67. data/spec/spec_helper.rb +1 -0
  68. data/spec/utils_spec.rb +53 -4
  69. data/spec/writers/crosscite_writer_spec.rb +7 -0
  70. data/spec/writers/datacite_json_writer_spec.rb +38 -0
  71. data/spec/writers/datacite_writer_spec.rb +84 -5
  72. data/spec/writers/jats_writer_spec.rb +8 -0
  73. data/spec/writers/rdf_xml_writer_spec.rb +7 -0
  74. data/spec/writers/turtle_writer_spec.rb +18 -0
  75. metadata +32 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53a45d740ac30bb235316e61ad8650ae88bd789ca1bafcc09a004b1ac9bf76cc
4
- data.tar.gz: 771f8867608f7b3984861f10ceecc0b48e8ac17763f1b936e1d9f79002e16f13
3
+ metadata.gz: 23ccf372b59b7d9c8919ec7ad7137eef6e99512eed488977e847f938f389aa2f
4
+ data.tar.gz: 390e56023d57e637a52776a98dcd0bea4fa0acd8b8459ced05cbc6785f69fe0a
5
5
  SHA512:
6
- metadata.gz: 1268a2e57636ec811b9004143c7092325e249050ffa4669119491e290604b5cc14c3e13983f2014196919b5bb97bb197e76c7620ced11dc34103e601b923ecb5
7
- data.tar.gz: fc1a9df23987eb69d5797102fb537bcbe65a5f565d19413e7b018af8442effa295cbaf5efeba04450ac8ae017d8b017141f009694aabde102114bfccafcba5d1
6
+ metadata.gz: 3a7364a75d69846ada1320bc0e8954b72695216d2807ec39ab1694ac4d120d97806addb9ceed8b9da8c1eb06ae28740cf6d2c118cb76a05e15ca993bf81ad470
7
+ data.tar.gz: 6281527f6b312d398a96b9f1df9be55de991f6ac939417131633b24ddaa24741c3b86c3b2e4e73408ca1350e0b17addf9439ae30dff998bc6dda07e8c4459db7
@@ -5,33 +5,5 @@ on:
5
5
  branches:
6
6
  - "master"
7
7
  jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
- env:
11
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
12
- steps:
13
- - uses: actions/checkout@v2
14
- - name: Set up Ruby 2.6
15
- uses: actions/setup-ruby@v1
16
- with:
17
- ruby-version: 2.6.x
18
-
19
- - name: Build and test
20
- run: |
21
- gem install bundler
22
- bundle install
23
- bundle exec rspec
24
-
25
- - name: Publish code coverage
26
- uses: paambaati/codeclimate-action@v2.7.4
27
- env:
28
- CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
29
-
30
- - name: Notify Slack
31
- uses: adamkdean/simple-slack-notify@1.0.4
32
- with:
33
- channel: '#ops'
34
- username: 'GitHub Actions'
35
- color: 'good'
36
- text: 'A new version of the bolognese gem has been built.'
37
-
8
+ ci:
9
+ uses: ./.github/workflows/ci.yml
@@ -0,0 +1,22 @@
1
+ name: Run Tests
2
+ on:
3
+ workflow_call:
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ ruby: ["2.6", "2.7", "3.0", "3.1"]
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Ruby ${{matrix.ruby}}
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{matrix.ruby}}
18
+ bundler-cache: true
19
+
20
+ - name: Run tests
21
+ run: |
22
+ bundle exec rspec
@@ -5,17 +5,5 @@ on:
5
5
  branches:
6
6
  - master
7
7
  jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v2
12
- - name: Set up Ruby 2.6
13
- uses: actions/setup-ruby@v1
14
- with:
15
- ruby-version: 2.6.x
16
-
17
- - name: Install and test
18
- run: |
19
- gem install bundler
20
- bundle install
21
- bundle exec rspec
8
+ ci:
9
+ uses: ./.github/workflows/ci.yml
@@ -4,28 +4,21 @@ on:
4
4
  release:
5
5
  types: [published]
6
6
  jobs:
7
+ ci:
8
+ uses: ./.github/workflows/ci.yml
7
9
  build:
10
+ needs: ci
8
11
  runs-on: ubuntu-latest
9
- env:
10
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
11
12
  steps:
12
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
13
14
  - name: Set up Ruby 2.6
14
- uses: actions/setup-ruby@v1
15
+ uses: ruby/setup-ruby@v1
15
16
  with:
16
- ruby-version: 2.6.x
17
+ ruby-version: "2.6"
17
18
 
18
- - name: Build and test
19
+ - name: Build
19
20
  run: |
20
- gem install bundler
21
21
  bundle install
22
- bundle exec rspec spec
23
-
24
- - name: Code Climate Test Reporter
25
- uses: aktions/codeclimate-test-reporter@v1
26
- with:
27
- codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
28
- command: after-build
29
22
 
30
23
  - name: Publish to RubyGems
31
24
  run: |
@@ -37,11 +30,3 @@ jobs:
37
30
  gem push *.gem
38
31
  env:
39
32
  GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
40
-
41
- - name: Notify Slack
42
- uses: adamkdean/simple-slack-notify@1.0.4
43
- with:
44
- channel: '#ops'
45
- username: 'GitHub Actions'
46
- color: 'good'
47
- text: 'A new version of the bolognese gem has been released.'
data/CHANGELOG.md CHANGED
@@ -1,20 +1,26 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/datacite/bolognese/tree/HEAD)
3
+ ## [1.10.0](https://github.com/datacite/bolognese/tree/1.10.0) (2022-10-14)
4
4
 
5
- [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.18...HEAD)
5
+ [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.18...1.10.0)
6
6
 
7
- **Fixed bugs:**
7
+ **Merged pull requests:**
8
8
 
9
- - Fix related items handling to not include elements when they are blank [\#140](https://github.com/datacite/bolognese/issues/140)
10
- - Related Items error out if RelatedItemIdentifier is nil [\#139](https://github.com/datacite/bolognese/issues/139)
9
+ - Add DFG-to-FOS mappings utility function [\#147](https://github.com/datacite/bolognese/pull/147) ([jrhoads](https://github.com/jrhoads))
10
+ - Test against multiple versions of ruby \(2.6, 2.7, 3.0, and 3.1\) [\#141](https://github.com/datacite/bolognese/pull/141) ([jrhoads](https://github.com/jrhoads))
11
11
 
12
12
  ## [1.9.18](https://github.com/datacite/bolognese/tree/1.9.18) (2022-10-11)
13
13
 
14
14
  [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.17...1.9.18)
15
15
 
16
+ **Fixed bugs:**
17
+
18
+ - Fix related items handling to not include elements when they are blank [\#140](https://github.com/datacite/bolognese/issues/140)
19
+ - Related Items error out if RelatedItemIdentifier is nil [\#139](https://github.com/datacite/bolognese/issues/139)
20
+
16
21
  **Merged pull requests:**
17
22
 
23
+ - bump version number [\#145](https://github.com/datacite/bolognese/pull/145) ([digitaldogsbody](https://github.com/digitaldogsbody))
18
24
  - Fix relatedItems handling [\#144](https://github.com/datacite/bolognese/pull/144) ([digitaldogsbody](https://github.com/digitaldogsbody))
19
25
  - Fixes normalization behavior that omitted non-URL funding identifiers when reading from DataCite XML. Adds normalization for Crossref Funder ID and ROR funderIdentifierTypes. [\#143](https://github.com/datacite/bolognese/pull/143) ([codycooperross](https://github.com/codycooperross))
20
26
  - Including a schemeURI with a nameIdentifier that is a URL will concat… [\#137](https://github.com/datacite/bolognese/pull/137) ([codycooperross](https://github.com/codycooperross))
@@ -130,6 +136,10 @@
130
136
 
131
137
  - Singular geoLocationPolygons are wrapped in additional array [\#110](https://github.com/datacite/bolognese/issues/110)
132
138
 
139
+ **Merged pull requests:**
140
+
141
+ - Support returning single geoLocationPolygon [\#111](https://github.com/datacite/bolognese/pull/111) ([richardhallett](https://github.com/richardhallett))
142
+
133
143
  ## [1.9.3](https://github.com/datacite/bolognese/tree/1.9.3) (2021-03-26)
134
144
 
135
145
  [Full Changelog](https://github.com/datacite/bolognese/compare/1.9.2...1.9.3)
@@ -159,7 +169,6 @@
159
169
 
160
170
  **Merged pull requests:**
161
171
 
162
- - Support returning single geoLocationPolygon [\#111](https://github.com/datacite/bolognese/pull/111) ([richardhallett](https://github.com/richardhallett))
163
172
  - Change detection for crosscite format [\#107](https://github.com/datacite/bolognese/pull/107) ([richardhallett](https://github.com/richardhallett))
164
173
  - Add support for multiple geolocation polygons [\#106](https://github.com/datacite/bolognese/pull/106) ([richardhallett](https://github.com/richardhallett))
165
174
  - Support schema 4 4 [\#105](https://github.com/datacite/bolognese/pull/105) ([richardhallett](https://github.com/richardhallett))
@@ -1380,15 +1389,15 @@
1380
1389
 
1381
1390
  ## [v.0.9.70](https://github.com/datacite/bolognese/tree/v.0.9.70) (2018-01-12)
1382
1391
 
1383
- [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.6.69...v.0.9.70)
1392
+ [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.9.69...v.0.9.70)
1384
1393
 
1385
- ## [v.0.6.69](https://github.com/datacite/bolognese/tree/v.0.6.69) (2018-01-11)
1394
+ ## [v.0.9.69](https://github.com/datacite/bolognese/tree/v.0.9.69) (2018-01-11)
1386
1395
 
1387
- [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.9.69...v.0.6.69)
1396
+ [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.6.69...v.0.9.69)
1388
1397
 
1389
- ## [v.0.9.69](https://github.com/datacite/bolognese/tree/v.0.9.69) (2018-01-11)
1398
+ ## [v.0.6.69](https://github.com/datacite/bolognese/tree/v.0.6.69) (2018-01-11)
1390
1399
 
1391
- [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.9.68...v.0.9.69)
1400
+ [Full Changelog](https://github.com/datacite/bolognese/compare/v.0.9.68...v.0.6.69)
1392
1401
 
1393
1402
  ## [v.0.9.68](https://github.com/datacite/bolognese/tree/v.0.9.68) (2018-01-11)
1394
1403
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.9.18)
4
+ bolognese (2.0.0)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -11,7 +11,6 @@ PATH
11
11
  concurrent-ruby (~> 1.1, >= 1.1.5)
12
12
  csl-styles (~> 1.0, >= 1.0.1.10)
13
13
  edtf (~> 3.0, >= 3.0.4)
14
- faraday (~> 0.17.3)
15
14
  gender_detector (~> 0.1.2)
16
15
  iso8601 (~> 0.9.1)
17
16
  json-ld-preloaded (~> 3.1, >= 3.1.3)
@@ -30,26 +29,26 @@ PATH
30
29
  GEM
31
30
  remote: https://rubygems.org/
32
31
  specs:
33
- activesupport (6.1.7)
32
+ activesupport (6.1.7.3)
34
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
35
34
  i18n (>= 1.6, < 2)
36
35
  minitest (>= 5.1)
37
36
  tzinfo (~> 2.0)
38
37
  zeitwerk (~> 2.3)
39
- addressable (2.8.0)
40
- public_suffix (>= 2.0.2, < 5.0)
41
- amazing_print (1.4.0)
38
+ addressable (2.8.1)
39
+ public_suffix (>= 2.0.2, < 6.0)
42
40
  benchmark_methods (0.7)
43
41
  bibtex-ruby (6.0.0)
44
42
  latex-decode (~> 0.0)
45
43
  builder (3.2.4)
44
+ byebug (11.1.3)
46
45
  citeproc (1.0.10)
47
46
  namae (~> 1.0)
48
47
  citeproc-ruby (1.1.14)
49
48
  citeproc (~> 1.0, >= 1.0.9)
50
49
  csl (~> 1.6)
51
50
  colorize (0.8.1)
52
- concurrent-ruby (1.1.10)
51
+ concurrent-ruby (1.2.2)
53
52
  crack (0.4.5)
54
53
  rexml
55
54
  crass (1.0.6)
@@ -60,22 +59,31 @@ GEM
60
59
  csl (~> 1.0)
61
60
  diff-lcs (1.5.0)
62
61
  docile (1.4.0)
63
- ebnf (2.3.1)
64
- amazing_print (~> 1.4)
62
+ ebnf (2.3.3)
65
63
  htmlentities (~> 4.3)
66
64
  rdf (~> 3.2)
67
65
  scanf (~> 1.0)
68
66
  sxp (~> 1.2)
69
- unicode-types (~> 1.7)
70
- edtf (3.1.0)
67
+ unicode-types (~> 1.8)
68
+ edtf (3.1.1)
71
69
  activesupport (>= 3.0, < 8.0)
72
70
  excon (0.71.1)
73
- faraday (0.17.5)
74
- multipart-post (>= 1.2, < 3)
71
+ faraday (2.7.6)
72
+ faraday-net_http (>= 2.0, < 3.1)
73
+ ruby2_keywords (>= 0.0.4)
75
74
  faraday-encoding (0.0.5)
76
75
  faraday
77
- faraday_middleware (0.14.0)
78
- faraday (>= 0.7.4, < 1.0)
76
+ faraday-excon (2.1.0)
77
+ excon (>= 0.27.4)
78
+ faraday (~> 2.0)
79
+ faraday-follow_redirects (0.3.0)
80
+ faraday (>= 1, < 3)
81
+ faraday-gzip (0.1.0)
82
+ faraday (>= 1.0)
83
+ zlib (~> 2.1)
84
+ faraday-multipart (1.0.4)
85
+ multipart-post (~> 2)
86
+ faraday-net_http (3.0.2)
79
87
  gender_detector (0.1.2)
80
88
  unicode_utils (>= 1.3.0)
81
89
  haml (5.2.2)
@@ -83,19 +91,19 @@ GEM
83
91
  tilt
84
92
  hashdiff (1.0.1)
85
93
  htmlentities (4.3.4)
86
- i18n (1.12.0)
94
+ i18n (1.14.1)
87
95
  concurrent-ruby (~> 1.0)
88
96
  iso8601 (0.9.1)
89
97
  json (2.6.2)
90
- json-canonicalization (0.3.0)
91
- json-ld (3.2.3)
98
+ json-canonicalization (0.3.2)
99
+ json-ld (3.2.5)
92
100
  htmlentities (~> 4.3)
93
- json-canonicalization (~> 0.3)
101
+ json-canonicalization (~> 0.3, >= 0.3.2)
94
102
  link_header (~> 0.0, >= 0.0.8)
95
103
  multi_json (~> 1.15)
96
- rack (~> 2.2)
97
- rdf (~> 3.2, >= 3.2.9)
98
- json-ld-preloaded (3.2.1)
104
+ rack (>= 2.2, < 4)
105
+ rdf (~> 3.2, >= 3.2.10)
106
+ json-ld-preloaded (3.2.2)
99
107
  json-ld (~> 3.2)
100
108
  rdf (~> 3.2)
101
109
  jsonlint (0.3.0)
@@ -103,30 +111,33 @@ GEM
103
111
  optimist (~> 3)
104
112
  latex-decode (0.4.0)
105
113
  link_header (0.0.8)
106
- loofah (2.19.0)
114
+ loofah (2.21.3)
107
115
  crass (~> 1.0.2)
108
- nokogiri (>= 1.5.9)
109
- maremma (4.9.8)
116
+ nokogiri (>= 1.12.0)
117
+ maremma (4.9.9)
110
118
  activesupport (>= 4.2.5)
111
119
  addressable (>= 2.3.6)
112
120
  builder (~> 3.2, >= 3.2.2)
113
121
  excon (~> 0.71.0)
114
- faraday (~> 0.17.3)
115
- faraday-encoding (~> 0.0.4)
116
- faraday_middleware (~> 0.14.0)
117
- nokogiri (>= 1.11.2, < 1.14.0)
122
+ faraday (>= 2.0)
123
+ faraday-encoding (~> 0.0.5)
124
+ faraday-excon (~> 2.1.0)
125
+ faraday-follow_redirects (~> 0.3.0)
126
+ faraday-gzip (~> 0.1.0)
127
+ faraday-multipart (~> 1.0.4)
128
+ nokogiri (>= 1.13.1, < 1.14.0)
118
129
  oj (>= 2.8.3)
119
130
  oj_mimic_json (~> 1.0, >= 1.0.1)
120
131
  matrix (0.4.2)
121
132
  mini_portile2 (2.8.0)
122
- minitest (5.16.3)
133
+ minitest (5.18.0)
123
134
  multi_json (1.15.0)
124
- multipart-post (2.2.3)
135
+ multipart-post (2.3.0)
125
136
  namae (1.1.1)
126
- nokogiri (1.13.6)
137
+ nokogiri (1.13.9)
127
138
  mini_portile2 (~> 2.8.0)
128
139
  racc (~> 1.4)
129
- oj (3.13.21)
140
+ oj (3.14.2)
130
141
  oj_mimic_json (1.0.1)
131
142
  optimist (3.0.1)
132
143
  postrank-uri (1.0.24)
@@ -135,22 +146,23 @@ GEM
135
146
  public_suffix (>= 2.0.0, < 2.1)
136
147
  public_suffix (2.0.5)
137
148
  racc (1.6.0)
138
- rack (2.2.3.1)
149
+ rack (2.2.4)
139
150
  rack-test (0.8.3)
140
151
  rack (>= 1.0, < 3)
141
152
  rake (12.3.3)
142
- rdf (3.2.9)
153
+ rdf (3.2.11)
143
154
  link_header (~> 0.0, >= 0.0.8)
144
155
  rdf-aggregate-repo (3.2.1)
145
156
  rdf (~> 3.2)
146
- rdf-rdfa (3.2.0)
147
- haml (~> 5.2)
157
+ rdf-rdfa (3.2.2)
158
+ haml (>= 5.2, < 7)
148
159
  htmlentities (~> 4.3)
149
160
  rdf (~> 3.2)
150
161
  rdf-aggregate-repo (~> 3.2)
151
162
  rdf-vocab (~> 3.2)
152
163
  rdf-xsd (~> 3.2)
153
- rdf-rdfxml (3.2.0)
164
+ rdf-rdfxml (3.2.1)
165
+ haml (~> 5.2)
154
166
  htmlentities (~> 4.3)
155
167
  rdf (~> 3.2)
156
168
  rdf-rdfa (~> 3.2)
@@ -158,7 +170,7 @@ GEM
158
170
  rdf-turtle (3.2.1)
159
171
  ebnf (~> 2.3)
160
172
  rdf (~> 3.2)
161
- rdf-vocab (3.2.2)
173
+ rdf-vocab (3.2.6)
162
174
  rdf (~> 3.2, >= 3.2.4)
163
175
  rdf-xsd (3.2.1)
164
176
  rdf (~> 3.2)
@@ -170,38 +182,40 @@ GEM
170
182
  rspec-mocks (~> 3.11.0)
171
183
  rspec-core (3.11.0)
172
184
  rspec-support (~> 3.11.0)
173
- rspec-expectations (3.11.0)
185
+ rspec-expectations (3.11.1)
174
186
  diff-lcs (>= 1.2.0, < 2.0)
175
187
  rspec-support (~> 3.11.0)
176
188
  rspec-mocks (3.11.1)
177
189
  diff-lcs (>= 1.2.0, < 2.0)
178
190
  rspec-support (~> 3.11.0)
179
- rspec-support (3.11.0)
191
+ rspec-support (3.11.1)
180
192
  rspec-xsd (0.1.0)
181
193
  nokogiri (~> 1.6)
182
194
  rspec (~> 3)
195
+ ruby2_keywords (0.0.5)
183
196
  scanf (1.0.0)
184
197
  simplecov (0.17.1)
185
198
  docile (~> 1.1)
186
199
  json (>= 1.8, < 3)
187
200
  simplecov-html (~> 0.10.0)
188
201
  simplecov-html (0.10.2)
189
- sxp (1.2.2)
190
- matrix
202
+ sxp (1.2.4)
203
+ matrix (~> 0.4)
191
204
  rdf (~> 3.2)
192
- temple (0.8.2)
193
- thor (1.2.1)
194
- tilt (2.0.11)
195
- tzinfo (2.0.5)
205
+ temple (0.10.2)
206
+ thor (1.2.2)
207
+ tilt (2.2.0)
208
+ tzinfo (2.0.6)
196
209
  concurrent-ruby (~> 1.0)
197
210
  unicode-types (1.8.0)
198
211
  unicode_utils (1.4.0)
199
212
  vcr (3.0.3)
200
- webmock (3.14.0)
213
+ webmock (3.18.1)
201
214
  addressable (>= 2.8.0)
202
215
  crack (>= 0.3.2)
203
216
  hashdiff (>= 0.4.0, < 2.0.0)
204
- zeitwerk (2.6.1)
217
+ zeitwerk (2.6.8)
218
+ zlib (2.1.1)
205
219
 
206
220
  PLATFORMS
207
221
  ruby
@@ -209,6 +223,7 @@ PLATFORMS
209
223
  DEPENDENCIES
210
224
  bolognese!
211
225
  bundler (>= 1.0)
226
+ byebug
212
227
  hashdiff (>= 1.0.0.beta1, < 2.0.0)
213
228
  rack-test (~> 0)
214
229
  rake (~> 12.0)
@@ -219,4 +234,4 @@ DEPENDENCIES
219
234
  webmock (~> 3.0, >= 3.0.1)
220
235
 
221
236
  BUNDLED WITH
222
- 2.3.23
237
+ 2.4.20
data/bolognese.gemspec CHANGED
@@ -13,11 +13,11 @@ 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 = ['>=2.3']
17
17
 
18
18
  # Declare dependencies here, rather than in the Gemfile
19
19
  s.add_dependency 'maremma', '>= 4.9.4', '< 5'
20
- s.add_dependency 'faraday', '~> 0.17.3'
20
+ #s.add_dependency 'faraday', '~> 0.17.3'
21
21
  s.add_dependency 'nokogiri', '>= 1.13.2', '< 1.14'
22
22
  s.add_dependency 'loofah', '~> 2.0', '>= 2.0.3'
23
23
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
49
49
  s.add_development_dependency 'webmock', '~> 3.0', '>= 3.0.1'
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
+ s.add_development_dependency 'byebug'
52
53
 
53
54
  s.require_paths = ["lib"]
54
55
  s.files = `git ls-files`.split($/)
@@ -30,6 +30,7 @@ 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
34
  if ni["nameIdentifierScheme"] == "ORCID"
34
35
  {
35
36
  "nameIdentifier" => normalize_orcid(ni["__content__"]),
@@ -144,16 +145,28 @@ module Bolognese
144
145
  affiliation_identifier_scheme = nil
145
146
  scheme_uri = nil
146
147
  else
148
+ scheme_uri = a["schemeURI"]
147
149
  if a["affiliationIdentifier"].present?
148
150
  affiliation_identifier = a["affiliationIdentifier"]
149
151
  if a["schemeURI"].present?
150
152
  schemeURI = a["schemeURI"].end_with?("/") ? a["schemeURI"] : a["schemeURI"] + "/"
151
153
  end
152
154
  affiliation_identifier = !affiliation_identifier.to_s.start_with?("https://") && schemeURI.present? ? normalize_id(schemeURI + affiliation_identifier) : normalize_id(affiliation_identifier)
155
+ # The normalize_id(affiliation_identifier) method currently discards affiliation identifiers that don't start with a URL,
156
+ # for example: affiliation_identifier = "05bp8ka05".
157
+ # To address this issue, we are introducing the following change to handle such affiliation identifiers.
158
+ # when `normalize_id` method could not normalize, it returns nil, hence we have following condition
159
+ if affiliation_identifier.nil?
160
+ if a["affiliationIdentifierScheme"] == "ROR"
161
+ scheme_uri = "https://ror.org"
162
+ affiliation_identifier = normalize_ror(a["affiliationIdentifier"])
163
+ else
164
+ affiliation_identifier = a["affiliationIdentifier"]
165
+ end
166
+ end
153
167
  end
154
168
  name = a["__content__"].to_s.squish.presence
155
169
  affiliation_identifier_scheme = a["affiliationIdentifierScheme"]
156
- scheme_uri = a["SchemeURI"]
157
170
  end
158
171
 
159
172
  { "name" => name,
@@ -106,9 +106,19 @@ module Bolognese
106
106
  end
107
107
  end
108
108
  end
109
-
109
+
110
110
  def insert_publisher(xml)
111
- xml.publisher(publisher || container && container["title"])
111
+ if publisher.is_a?(Hash)
112
+ attributes = {
113
+ 'publisherIdentifier' => publisher["publisherIdentifier"],
114
+ 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"],
115
+ 'schemeURI' => publisher["schemeUri"],
116
+ "xml:lang" => publisher["lang"]
117
+ }.compact
118
+ xml.publisher(publisher["name"] || container && container["title"], attributes)
119
+ else
120
+ xml.publisher(publisher || container && container["title"])
121
+ end
112
122
  end
113
123
 
114
124
  def insert_publication_year(xml)
@@ -171,7 +181,7 @@ module Bolognese
171
181
  s["subject"] = subject
172
182
  end
173
183
 
174
- attributes = { "subjectScheme" => s["subjectScheme"], "schemeURI" => s["schemeUri"], "valueURI" => s["valueUri"], "xml:lang" => s["lang"] }.compact
184
+ attributes = { "subjectScheme" => s["subjectScheme"], "schemeURI" => s["schemeUri"], "valueURI" => s["valueUri"], "classificationCode" => s["classificationCode"], "xml:lang" => s["lang"] }.compact
175
185
 
176
186
  xml.subject(s["subject"], attributes)
177
187
  end
@@ -375,13 +385,11 @@ module Bolognese
375
385
  end
376
386
  end
377
387
  if geo_location["geoLocationPolygon"]
378
- geo_location["geoLocationPolygon"].each do |geo_location_polygon|
379
- xml.geoLocationPolygon do
380
- geo_location_polygon.each do |polygon_point|
381
- xml.polygonPoint do
382
- xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude"))
383
- xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude"))
384
- end
388
+ xml.geoLocationPolygon do
389
+ Array.wrap(geo_location["geoLocationPolygon"]).each do |polygon_point|
390
+ xml.polygonPoint do
391
+ xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude"))
392
+ xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude"))
385
393
  end
386
394
  end
387
395
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Bolognese
4
4
  module DoiUtils
5
+ class << self
6
+ include DoiUtils
7
+ end
8
+
5
9
  def validate_doi(doi)
6
10
  doi = Array(/\A(?:(http|https):\/(\/)?(dx\.)?(doi.org|handle.stage.datacite.org|handle.test.datacite.org)\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(doi)).last
7
11
  # remove non-printing whitespace and downcase
@@ -217,7 +217,7 @@ module Bolognese
217
217
  end
218
218
 
219
219
  def publisher
220
- @publisher ||= meta.fetch("publisher", nil)
220
+ @publisher ||= normalize_publisher(meta["publisher"]) if meta.fetch("publisher", nil).present?
221
221
  end
222
222
 
223
223
  def identifiers
@@ -161,7 +161,7 @@ module Bolognese
161
161
  "volume" => container.to_h["volume"],
162
162
  "issue" => container.to_h["issue"],
163
163
  "page" => page,
164
- "publisher" => publisher,
164
+ "publisher" => publisher["name"],
165
165
  "title" => parse_attributes(titles, content: "title", first: true),
166
166
  "URL" => url,
167
167
  "copyright" => Array.wrap(rights_list).map { |l| l["rights"] }.first,
@@ -86,11 +86,11 @@ module Bolognese
86
86
  "titles" => meta.try(:title).present? ? [{ "title" => meta.try(:title).to_s }] : [],
87
87
  "creators" => creators,
88
88
  "container" => container,
89
- "publisher" => meta.try(:publisher).to_s.presence,
89
+ "publisher" => meta.try(:publisher).present? ? { "name" => meta.publisher.to_s } : nil,
90
90
  "related_identifiers" => related_identifiers,
91
91
  "dates" => dates,
92
92
  "publication_year" => publication_year,
93
- "descriptions" => meta.try(:abstract).present? ? [{ "description" => meta.try(:abstract) && sanitize(meta.abstract.to_s).presence, "descriptionType" => "Abstract" }] : [],
93
+ "descriptions" => meta.try(:abstract).present? ? [{ "description" => meta.try(:abstract) && sanitize(meta.abstract.to_s, new_line: true).presence, "descriptionType" => "Abstract" }] : [],
94
94
  "rights_list" => rights_list,
95
95
  "state" => state
96
96
  }.merge(read_options)
@@ -107,7 +107,7 @@ module Bolognese
107
107
  "related_identifiers" => related_identifiers,
108
108
  "dates" => dates,
109
109
  "publication_year" => publication_year,
110
- "descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract")), "descriptionType" => "Abstract" }] : [],
110
+ "descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract"), new_line: true), "descriptionType" => "Abstract" }] : [],
111
111
  "rights_list" => rights_list,
112
112
  "version_info" => meta.fetch("version", nil),
113
113
  "subjects" => subjects,
@@ -43,7 +43,7 @@ module Bolognese
43
43
  dates << { "date" => meta.fetch("dateCreated"), "dateType" => "Created" } if meta.fetch("dateCreated", nil).present?
44
44
  dates << { "date" => meta.fetch("dateModified"), "dateType" => "Updated" } if meta.fetch("dateModified", nil).present?
45
45
  publication_year = meta.fetch("datePublished")[0..3] if meta.fetch("datePublished", nil).present?
46
- publisher = meta.fetch("publisher", nil)
46
+ publisher = { "name" => meta.fetch("publisher", nil) } if meta.fetch("publisher", nil).present?
47
47
  state = meta.present? || read_options.present? ? "findable" : "not_found"
48
48
  schema_org = meta.fetch("@type", nil)
49
49
  types = {
@@ -76,7 +76,7 @@ module Bolognese
76
76
  #{}"is_part_of" => is_part_of,
77
77
  "dates" => dates,
78
78
  "publication_year" => publication_year,
79
- "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description")), "descriptionType" => "Abstract" }] : nil,
79
+ "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description"), new_line: true), "descriptionType" => "Abstract" }] : nil,
80
80
  "rights_list" => rights_list,
81
81
  "version_info" => meta.fetch("version", nil),
82
82
  "subjects" => subjects,