bolognese 1.10.0 → 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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +0 -14
  3. data/.github/workflows/release.yml +0 -10
  4. data/CHANGELOG.md +2 -2
  5. data/Gemfile.lock +65 -50
  6. data/bolognese.gemspec +2 -1
  7. data/lib/bolognese/author_utils.rb +14 -1
  8. data/lib/bolognese/datacite_utils.rb +18 -10
  9. data/lib/bolognese/metadata.rb +1 -1
  10. data/lib/bolognese/metadata_utils.rb +1 -1
  11. data/lib/bolognese/readers/bibtex_reader.rb +2 -2
  12. data/lib/bolognese/readers/citeproc_reader.rb +1 -1
  13. data/lib/bolognese/readers/codemeta_reader.rb +2 -2
  14. data/lib/bolognese/readers/crosscite_reader.rb +4 -1
  15. data/lib/bolognese/readers/crossref_reader.rb +3 -4
  16. data/lib/bolognese/readers/datacite_json_reader.rb +4 -1
  17. data/lib/bolognese/readers/datacite_reader.rb +25 -9
  18. data/lib/bolognese/readers/npm_reader.rb +1 -1
  19. data/lib/bolognese/readers/ris_reader.rb +2 -2
  20. data/lib/bolognese/readers/schema_org_reader.rb +3 -2
  21. data/lib/bolognese/utils.rb +22 -5
  22. data/lib/bolognese/version.rb +1 -1
  23. data/lib/bolognese/writers/bibtex_writer.rb +1 -1
  24. data/lib/bolognese/writers/codemeta_writer.rb +1 -1
  25. data/lib/bolognese/writers/csv_writer.rb +1 -1
  26. data/lib/bolognese/writers/datacite_json_writer.rb +6 -1
  27. data/lib/bolognese/writers/jats_writer.rb +3 -3
  28. data/lib/bolognese/writers/ris_writer.rb +2 -2
  29. data/lib/bolognese/writers/schema_org_writer.rb +2 -2
  30. data/resources/kernel-4/include/datacite-relationType-v4.xsd +2 -0
  31. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +2 -0
  32. data/resources/kernel-4/metadata.xsd +11 -7
  33. data/resources/kernel-4.5/include/datacite-contributorType-v4.xsd +35 -0
  34. data/resources/kernel-4.5/include/datacite-dateType-v4.xsd +25 -0
  35. data/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd +19 -0
  36. data/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd +16 -0
  37. data/resources/kernel-4.5/include/datacite-nameType-v4.xsd +10 -0
  38. data/resources/kernel-4.5/include/datacite-numberType-v4.xsd +12 -0
  39. data/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd +34 -0
  40. data/resources/kernel-4.5/include/datacite-relationType-v4.xsd +53 -0
  41. data/resources/kernel-4.5/include/datacite-resourceType-v4.xsd +45 -0
  42. data/resources/kernel-4.5/include/datacite-titleType-v4.xsd +14 -0
  43. data/resources/kernel-4.5/include/xml.xsd +286 -0
  44. data/resources/kernel-4.5/metadata.xsd +711 -0
  45. data/spec/author_utils_spec.rb +52 -5
  46. data/spec/datacite_utils_spec.rb +5 -1
  47. data/spec/fixtures/citeproc.json +4 -2
  48. data/spec/fixtures/datacite-example-ROR-nameIdentifiers.xml +16 -1
  49. data/spec/fixtures/datacite-example-full-v4.5.xml +255 -0
  50. data/spec/fixtures/datacite-example-relateditems-with-attributes.xml +61 -0
  51. data/spec/fixtures/datacite-seriesinformation.xml +7 -2
  52. data/spec/fixtures/datacite.json +9 -3
  53. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_subjects/insert.yml +32 -14
  54. data/spec/readers/bibtex_reader_spec.rb +2 -0
  55. data/spec/readers/citeproc_reader_spec.rb +3 -0
  56. data/spec/readers/codemeta_reader_spec.rb +4 -4
  57. data/spec/readers/crosscite_reader_spec.rb +2 -0
  58. data/spec/readers/crossref_reader_spec.rb +41 -41
  59. data/spec/readers/datacite_json_reader_spec.rb +2 -0
  60. data/spec/readers/datacite_reader_spec.rb +118 -44
  61. data/spec/readers/npm_reader_spec.rb +2 -0
  62. data/spec/readers/ris_reader_spec.rb +3 -0
  63. data/spec/readers/schema_org_reader_spec.rb +11 -11
  64. data/spec/spec_helper.rb +1 -0
  65. data/spec/writers/crosscite_writer_spec.rb +7 -0
  66. data/spec/writers/datacite_json_writer_spec.rb +38 -0
  67. data/spec/writers/datacite_writer_spec.rb +84 -5
  68. data/spec/writers/jats_writer_spec.rb +8 -0
  69. data/spec/writers/rdf_xml_writer_spec.rb +7 -0
  70. data/spec/writers/turtle_writer_spec.rb +18 -0
  71. metadata +30 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 532586fba70709be6c7581b595a2c0d72ad1000c9c54b951ad5e4758715e81c1
4
- data.tar.gz: 3029c21ac460e41479459df642e3d501b1195e6cc8a0e26d6a4ba5bba91ce13f
3
+ metadata.gz: 23ccf372b59b7d9c8919ec7ad7137eef6e99512eed488977e847f938f389aa2f
4
+ data.tar.gz: 390e56023d57e637a52776a98dcd0bea4fa0acd8b8459ced05cbc6785f69fe0a
5
5
  SHA512:
6
- metadata.gz: 3893a351e49ad8e8acb0ef5265fb3acdc149e67a99174de0d0855d594e7d9c16f09baeda4d9b1aba7235aef661135e7d1bd1ac401df81601c99217e155153395
7
- data.tar.gz: f6225b13dae84dcc897fa1dda7aadb266e667f8bf6a3a2da2e3f6ad134f314f17c3c6613ef8c2dec54091d9f4b4f055023bdb00ace39baf018b1654820cf7eff
6
+ metadata.gz: 3a7364a75d69846ada1320bc0e8954b72695216d2807ec39ab1694ac4d120d97806addb9ceed8b9da8c1eb06ae28740cf6d2c118cb76a05e15ca993bf81ad470
7
+ data.tar.gz: 6281527f6b312d398a96b9f1df9be55de991f6ac939417131633b24ddaa24741c3b86c3b2e4e73408ca1350e0b17addf9439ae30dff998bc6dda07e8c4459db7
@@ -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/CHANGELOG.md CHANGED
@@ -7,6 +7,7 @@
7
7
  **Merged pull requests:**
8
8
 
9
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))
10
11
 
11
12
  ## [1.9.18](https://github.com/datacite/bolognese/tree/1.9.18) (2022-10-11)
12
13
 
@@ -64,6 +65,7 @@
64
65
  **Merged pull requests:**
65
66
 
66
67
  - update nokogiri to latest, including updating maremma [\#130](https://github.com/datacite/bolognese/pull/130) ([orangewolf](https://github.com/orangewolf))
68
+ - mapping for DFG-to-OECD [\#125](https://github.com/datacite/bolognese/pull/125) ([kjgarza](https://github.com/kjgarza))
67
69
 
68
70
  ## [1.9.12](https://github.com/datacite/bolognese/tree/1.9.12) (2021-08-19)
69
71
 
@@ -79,7 +81,6 @@
79
81
 
80
82
  **Merged pull requests:**
81
83
 
82
- - 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))
83
84
  - Allow Orcid URLs to have been issued from the sandbox [\#121](https://github.com/datacite/bolognese/pull/121) ([prdanelli](https://github.com/prdanelli))
84
85
 
85
86
  ## [1.9.10](https://github.com/datacite/bolognese/tree/1.9.10) (2021-07-20)
@@ -115,7 +116,6 @@
115
116
 
116
117
  **Merged pull requests:**
117
118
 
118
- - mapping for DFG-to-OECD [\#125](https://github.com/datacite/bolognese/pull/125) ([kjgarza](https://github.com/kjgarza))
119
119
  - Fix missing affiliation identifier [\#117](https://github.com/datacite/bolognese/pull/117) ([richardhallett](https://github.com/richardhallett))
120
120
  - Add support for book title and additional metadata when reading Crossref Book Chapter DOI [\#115](https://github.com/datacite/bolognese/pull/115) ([prdanelli](https://github.com/prdanelli))
121
121
  - Valid Funder DOIs are being rejected for not starting with a 5 [\#114](https://github.com/datacite/bolognese/pull/114) ([prdanelli](https://github.com/prdanelli))
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.10.0)
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.12
237
+ 2.4.20
data/bolognese.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
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
@@ -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,
@@ -7,7 +7,10 @@ module Bolognese
7
7
  errors = jsonlint(string)
8
8
  return { "errors" => errors } if errors.present?
9
9
 
10
- string.present? ? Maremma.from_json(string) : {}
10
+ crosscite = string.present? ? Maremma.from_json(string) : {}
11
+ crosscite["publisher"] = normalize_publisher(crosscite["publisher"]) if crosscite.fetch("publisher", nil).present?
12
+
13
+ crosscite
11
14
  end
12
15
  end
13
16
  end
@@ -40,8 +40,7 @@ module Bolognese
40
40
  journal_metadata = nil
41
41
  journal_issue = {}
42
42
  journal_metadata = nil
43
- publisher = query.dig("crm_item", 0)
44
- publisher = nil unless publisher.is_a?(String)
43
+ publisher = query.dig("crm_item", 0).is_a?(String) ? { "name" => query.dig("crm_item", 0) } : nil
45
44
 
46
45
  case model
47
46
  when "book"
@@ -232,11 +231,11 @@ module Bolognese
232
231
 
233
232
  def crossref_description(bibliographic_metadata)
234
233
  abstract = Array.wrap(bibliographic_metadata.dig("abstract")).map do |r|
235
- { "descriptionType" => "Abstract", "description" => sanitize(parse_attributes(r, content: 'p')) }.compact
234
+ { "descriptionType" => "Abstract", "description" => sanitize(parse_attributes(r, content: 'p'), new_line: true) }.compact
236
235
  end
237
236
 
238
237
  description = Array.wrap(bibliographic_metadata.dig("description")).map do |r|
239
- { "descriptionType" => "Other", "description" => sanitize(parse_attributes(r)) }.compact
238
+ { "descriptionType" => "Other", "description" => sanitize(parse_attributes(r), new_line: true) }.compact
240
239
  end
241
240
 
242
241
  (abstract + description)
@@ -7,7 +7,10 @@ module Bolognese
7
7
  errors = jsonlint(string)
8
8
  return { "errors" => errors } if errors.present?
9
9
 
10
- string.present? ? Maremma.from_json(string).transform_keys! { |key| key.underscore } : {}
10
+ datacite_json = string.present? ? Maremma.from_json(string).transform_keys! { |key| key.underscore } : {}
11
+ datacite_json["publisher"] = normalize_publisher(datacite_json["publisher"]) if datacite_json.fetch("publisher", nil).present?
12
+
13
+ datacite_json
11
14
  end
12
15
  end
13
16
  end
@@ -94,13 +94,29 @@ module Bolognese
94
94
 
95
95
  titles = get_titles(meta)
96
96
 
97
+ publisher = Array.wrap(meta.dig("publisher")).map do |r|
98
+ if r.blank?
99
+ nil
100
+ elsif r.is_a?(String)
101
+ { "name" => r.strip }
102
+ elsif r.is_a?(Hash)
103
+ {
104
+ "name" => r["__content__"].strip,
105
+ "publisherIdentifier" => r["publisherIdentifierScheme"] == "ROR" ? normalize_ror(r["publisherIdentifier"]) : r["publisherIdentifier"],
106
+ "publisherIdentifierScheme" => r["publisherIdentifierScheme"],
107
+ "schemeUri" => r["schemeURI"],
108
+ "lang" => r["lang"],
109
+ }.compact
110
+ end
111
+ end.compact.first
112
+
97
113
  descriptions = Array.wrap(meta.dig("descriptions", "description")).map do |r|
98
114
  if r.blank?
99
115
  nil
100
116
  elsif r.is_a?(String)
101
- { "description" => sanitize(r), "descriptionType" => "Abstract" }
117
+ { "description" => sanitize(r, new_line: true), "descriptionType" => "Abstract" }
102
118
  elsif r.is_a?(Hash)
103
- { "description" => sanitize(r["__content__"]), "descriptionType" => r["descriptionType"], "lang" => r["lang"] }.compact
119
+ { "description" => sanitize(r["__content__"], new_line: true), "descriptionType" => r["descriptionType"], "lang" => r["lang"] }.compact
104
120
  end
105
121
  end.compact
106
122
  rights_list = Array.wrap(meta.dig("rightsList", "rights")).map do |r|
@@ -230,14 +246,14 @@ module Bolognese
230
246
  "creators" => get_authors(Array.wrap(ri.dig("creators", "creator"))),
231
247
  "titles" => get_titles(ri),
232
248
  "publicationYear" => ri["publicationYear"],
233
- "volume" => ri["volume"],
234
- "issue" => ri["issue"],
249
+ "volume" => parse_attributes(ri["volume"]),
250
+ "issue" => parse_attributes(ri["issue"]),
235
251
  "number" => number,
236
252
  "numberType" => numberType,
237
- "firstPage" => ri["firstPage"],
238
- "lastPage" => ri["lastPage"],
239
- "publisher" => ri["publisher"],
240
- "edition" => ri["edition"],
253
+ "firstPage" => parse_attributes(ri["firstPage"]),
254
+ "lastPage" => parse_attributes(ri["lastPage"]),
255
+ "publisher" => parse_attributes(ri["publisher"]),
256
+ "edition" => parse_attributes(ri["edition"]),
241
257
  "contributors" => get_authors(Array.wrap(ri.dig("contributors", "contributor"))),
242
258
  }.compact
243
259
  end
@@ -287,7 +303,7 @@ module Bolognese
287
303
  "creators" => get_authors(Array.wrap(meta.dig("creators", "creator"))),
288
304
  "contributors" => get_authors(Array.wrap(meta.dig("contributors", "contributor"))),
289
305
  "container" => set_container(meta),
290
- "publisher" => parse_attributes(meta.fetch("publisher", nil), first: true).to_s.strip.presence,
306
+ "publisher" => publisher,
291
307
  "agency" => "datacite",
292
308
  "funding_references" => funding_references,
293
309
  "dates" => dates,
@@ -103,7 +103,7 @@ module Bolognese
103
103
  #"related_identifiers" => related_identifiers,
104
104
  #"dates" => dates,
105
105
  #"publication_year" => publication_year,
106
- "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description")), "descriptionType" => "Abstract" }] : [],
106
+ "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description"), new_line: true), "descriptionType" => "Abstract" }] : [],
107
107
  "rights_list" => rights_list,
108
108
  "version_info" => meta.fetch("version", nil),
109
109
  "subjects" => subjects