bolognese 1.10.0 → 2.3.3

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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +0 -14
  3. data/.github/workflows/ci.yml +1 -1
  4. data/.github/workflows/release.yml +2 -12
  5. data/CHANGELOG.md +2 -2
  6. data/Gemfile.lock +69 -53
  7. data/bolognese.gemspec +6 -4
  8. data/lib/bolognese/author_utils.rb +17 -4
  9. data/lib/bolognese/datacite_utils.rb +19 -11
  10. data/lib/bolognese/metadata.rb +1 -1
  11. data/lib/bolognese/metadata_utils.rb +3 -2
  12. data/lib/bolognese/readers/bibtex_reader.rb +2 -2
  13. data/lib/bolognese/readers/citeproc_reader.rb +7 -1
  14. data/lib/bolognese/readers/codemeta_reader.rb +2 -2
  15. data/lib/bolognese/readers/crosscite_reader.rb +4 -1
  16. data/lib/bolognese/readers/crossref_reader.rb +40 -7
  17. data/lib/bolognese/readers/datacite_json_reader.rb +4 -1
  18. data/lib/bolognese/readers/datacite_reader.rb +25 -9
  19. data/lib/bolognese/readers/npm_reader.rb +1 -1
  20. data/lib/bolognese/readers/ris_reader.rb +2 -2
  21. data/lib/bolognese/readers/schema_org_reader.rb +27 -4
  22. data/lib/bolognese/utils.rb +36 -14
  23. data/lib/bolognese/version.rb +1 -1
  24. data/lib/bolognese/writers/bibtex_writer.rb +1 -1
  25. data/lib/bolognese/writers/codemeta_writer.rb +1 -1
  26. data/lib/bolognese/writers/csv_writer.rb +1 -1
  27. data/lib/bolognese/writers/datacite_json_writer.rb +3 -1
  28. data/lib/bolognese/writers/jats_writer.rb +6 -3
  29. data/lib/bolognese/writers/ris_writer.rb +2 -2
  30. data/lib/bolognese/writers/schema_org_writer.rb +6 -2
  31. data/resources/kernel-4/include/datacite-contributorType-v4.xsd +3 -1
  32. data/resources/kernel-4/include/datacite-dateType-v4.xsd +3 -1
  33. data/resources/kernel-4/include/datacite-relatedIdentifierType-v4.xsd +5 -2
  34. data/resources/kernel-4/include/datacite-relationType-v4.xsd +9 -3
  35. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +7 -1
  36. data/resources/kernel-4/include/datacite-titleType-v4.xsd +1 -1
  37. data/resources/kernel-4/metadata.xsd +12 -7
  38. data/resources/kernel-4.5/include/datacite-contributorType-v4.xsd +35 -0
  39. data/resources/kernel-4.5/include/datacite-dateType-v4.xsd +25 -0
  40. data/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd +19 -0
  41. data/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd +16 -0
  42. data/resources/kernel-4.5/include/datacite-nameType-v4.xsd +10 -0
  43. data/resources/kernel-4.5/include/datacite-numberType-v4.xsd +12 -0
  44. data/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd +34 -0
  45. data/resources/kernel-4.5/include/datacite-relationType-v4.xsd +53 -0
  46. data/resources/kernel-4.5/include/datacite-resourceType-v4.xsd +45 -0
  47. data/resources/kernel-4.5/include/datacite-titleType-v4.xsd +14 -0
  48. data/resources/kernel-4.5/include/xml.xsd +286 -0
  49. data/resources/kernel-4.5/metadata.xsd +711 -0
  50. data/resources/kernel-4.6/include/datacite-contributorType-v4.xsd +37 -0
  51. data/resources/kernel-4.6/include/datacite-dateType-v4.xsd +27 -0
  52. data/resources/kernel-4.6/include/datacite-descriptionType-v4.xsd +19 -0
  53. data/resources/kernel-4.6/include/datacite-funderIdentifierType-v4.xsd +16 -0
  54. data/resources/kernel-4.6/include/datacite-nameType-v4.xsd +10 -0
  55. data/resources/kernel-4.6/include/datacite-numberType-v4.xsd +12 -0
  56. data/resources/kernel-4.6/include/datacite-relatedIdentifierType-v4.xsd +37 -0
  57. data/resources/kernel-4.6/include/datacite-relationType-v4.xsd +57 -0
  58. data/resources/kernel-4.6/include/datacite-resourceType-v4.xsd +49 -0
  59. data/resources/kernel-4.6/include/datacite-titleType-v4.xsd +14 -0
  60. data/resources/kernel-4.6/include/xml.xsd +286 -0
  61. data/resources/kernel-4.6/metadata.xsd +712 -0
  62. data/spec/author_utils_spec.rb +59 -6
  63. data/spec/datacite_utils_spec.rb +156 -2
  64. data/spec/fixtures/citeproc.json +7 -1
  65. data/spec/fixtures/crossref_schema_4.6_values.xml +183 -0
  66. data/spec/fixtures/datacite-example-ROR-nameIdentifiers.xml +24 -1
  67. data/spec/fixtures/datacite-example-full-v4.5.xml +255 -0
  68. data/spec/fixtures/datacite-example-full-v4.6.xml +114 -0
  69. data/spec/fixtures/datacite-example-relateditems-with-attributes.xml +61 -0
  70. data/spec/fixtures/datacite-seriesinformation.xml +7 -2
  71. data/spec/fixtures/datacite-xml-lang.xml +1 -1
  72. data/spec/fixtures/datacite.json +9 -3
  73. data/spec/fixtures/datacite_blank_name_identifier.xml +22 -0
  74. data/spec/fixtures/datacite_blank_publisher.xml +18 -0
  75. data/spec/fixtures/datacite_journal_article.xml +64 -0
  76. data/spec/fixtures/schema_org.json +1 -0
  77. data/spec/fixtures/schema_org_4.6_attributes.json +108 -0
  78. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors_Translator/supports_Translator_contributorType.yml +71 -0
  79. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates_with_Coverage/inserts_date_with_dateType_Coverage.yml +71 -0
  80. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_CSTR/supports_CSTR_relatedIdentifierType.yml +71 -0
  81. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_HasTranslation/supports_HasTranslation_relationType.yml +71 -0
  82. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_RRID/supports_RRID_relatedIdentifierType.yml +71 -0
  83. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Award/supports_Award_as_resourceTypeGeneral.yml +71 -0
  84. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Project/supports_Project_as_resourceTypeGeneral.yml +71 -0
  85. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_subjects/insert.yml +32 -14
  86. data/spec/readers/bibtex_reader_spec.rb +2 -0
  87. data/spec/readers/citeproc_reader_spec.rb +4 -0
  88. data/spec/readers/codemeta_reader_spec.rb +4 -4
  89. data/spec/readers/crosscite_reader_spec.rb +2 -0
  90. data/spec/readers/crossref_reader_spec.rb +72 -41
  91. data/spec/readers/datacite_json_reader_spec.rb +2 -0
  92. data/spec/readers/datacite_reader_spec.rb +209 -44
  93. data/spec/readers/npm_reader_spec.rb +2 -0
  94. data/spec/readers/ris_reader_spec.rb +3 -0
  95. data/spec/readers/schema_org_reader_spec.rb +38 -11
  96. data/spec/spec_helper.rb +1 -0
  97. data/spec/writers/citation_writer_spec.rb +9 -0
  98. data/spec/writers/citeproc_writer_spec.rb +9 -0
  99. data/spec/writers/crosscite_writer_spec.rb +7 -0
  100. data/spec/writers/datacite_json_writer_spec.rb +22 -0
  101. data/spec/writers/datacite_writer_spec.rb +155 -5
  102. data/spec/writers/jats_writer_spec.rb +16 -1
  103. data/spec/writers/rdf_xml_writer_spec.rb +7 -0
  104. data/spec/writers/schema_org_writer_spec.rb +49 -0
  105. data/spec/writers/turtle_writer_spec.rb +18 -0
  106. metadata +84 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 532586fba70709be6c7581b595a2c0d72ad1000c9c54b951ad5e4758715e81c1
4
- data.tar.gz: 3029c21ac460e41479459df642e3d501b1195e6cc8a0e26d6a4ba5bba91ce13f
3
+ metadata.gz: 1a86efd4d59883de399bfae917077f97c5f5e33bd698bc70fc4a3daa40736acc
4
+ data.tar.gz: da3ac310e177b6ad9733ff56cb9893cfe107c0beb930167b7b8f392dfb2332f4
5
5
  SHA512:
6
- metadata.gz: 3893a351e49ad8e8acb0ef5265fb3acdc149e67a99174de0d0855d594e7d9c16f09baeda4d9b1aba7235aef661135e7d1bd1ac401df81601c99217e155153395
7
- data.tar.gz: f6225b13dae84dcc897fa1dda7aadb266e667f8bf6a3a2da2e3f6ad134f314f17c3c6613ef8c2dec54091d9f4b4f055023bdb00ace39baf018b1654820cf7eff
6
+ metadata.gz: ee269b568dd16e08da5c10f00155a3e0b55e9725c1d6aa114c6c3a5020dfe05c2df89388a9bc394a6274e86ca81567f4f756dd31bcaf5faa12dff2a7df275308
7
+ data.tar.gz: 26245d3b2e4553616ba0708047b542f4092240e4cc251ae578de502010ba69a3d6700a5df48f59cd427b7f0eaf498a15cc043cd78ad799572bd589dfcbad6784
@@ -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
-
@@ -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
@@ -9,14 +9,12 @@ 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
- - name: Set up Ruby 2.6
14
+ - name: Set up Ruby 3.1.4
17
15
  uses: ruby/setup-ruby@v1
18
16
  with:
19
- ruby-version: "2.6"
17
+ ruby-version: "3.1.4"
20
18
 
21
19
  - name: Build
22
20
  run: |
@@ -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.3.3)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -11,15 +11,14 @@ 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)
18
17
  jsonlint (~> 0.3.0)
19
18
  loofah (~> 2.0, >= 2.0.3)
20
- maremma (>= 4.9.4, < 5)
19
+ maremma (~> 5.0)
21
20
  namae (~> 1.0)
22
- nokogiri (>= 1.13.2, < 1.14)
21
+ nokogiri (~> 1.16, >= 1.16.2)
23
22
  oj (~> 3.10)
24
23
  oj_mimic_json (~> 1.0, >= 1.0.1)
25
24
  postrank-uri (~> 1.0, >= 1.0.18)
@@ -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.1)
99
+ json-ld (3.2.4)
92
100
  htmlentities (~> 4.3)
93
101
  json-canonicalization (~> 0.3)
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 (5.0.0)
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.16, >= 1.16.2)
118
129
  oj (>= 2.8.3)
119
130
  oj_mimic_json (~> 1.0, >= 1.0.1)
120
131
  matrix (0.4.2)
121
- mini_portile2 (2.8.0)
122
- minitest (5.16.3)
132
+ mini_portile2 (2.8.5)
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)
127
- mini_portile2 (~> 2.8.0)
137
+ nokogiri (1.16.2)
138
+ mini_portile2 (~> 2.8.2)
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,7 +223,9 @@ PLATFORMS
209
223
  DEPENDENCIES
210
224
  bolognese!
211
225
  bundler (>= 1.0)
226
+ byebug
212
227
  hashdiff (>= 1.0.0.beta1, < 2.0.0)
228
+ json-canonicalization (= 0.3.1)
213
229
  rack-test (~> 0)
214
230
  rake (~> 12.0)
215
231
  rspec (~> 3.4)
@@ -219,4 +235,4 @@ DEPENDENCIES
219
235
  webmock (~> 3.0, >= 3.0.1)
220
236
 
221
237
  BUNDLED WITH
222
- 2.3.12
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'
20
- s.add_dependency 'faraday', '~> 0.17.3'
21
- s.add_dependency 'nokogiri', '>= 1.13.2', '< 1.14'
19
+ s.add_dependency 'maremma', '~> 5.0'
20
+ #s.add_dependency 'faraday', '~> 0.17.3'
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'
@@ -49,6 +49,8 @@ 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'
53
+ s.add_development_dependency 'json-canonicalization', '0.3.1'
52
54
 
53
55
  s.require_paths = ["lib"]
54
56
  s.files = `git ls-files`.split($/)
@@ -30,19 +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
+ name_identifier = ni["__content__"].strip if ni["__content__"].present?
33
34
  if ni["nameIdentifierScheme"] == "ORCID"
34
35
  {
35
- "nameIdentifier" => normalize_orcid(ni["__content__"]),
36
+ "nameIdentifier" => normalize_orcid(name_identifier),
36
37
  "schemeUri" => "https://orcid.org",
37
38
  "nameIdentifierScheme" => "ORCID" }.compact
38
39
  elsif ni["nameIdentifierScheme"] == "ROR"
39
40
  {
40
- "nameIdentifier" => normalize_ror(ni["__content__"]),
41
+ "nameIdentifier" => normalize_ror(name_identifier),
41
42
  "schemeUri" => "https://ror.org",
42
43
  "nameIdentifierScheme" => "ROR" }.compact
43
44
  else
44
45
  {
45
- "nameIdentifier" => ni["__content__"],
46
+ "nameIdentifier" => name_identifier,
46
47
  "schemeUri" => ni.fetch("schemeURI", nil),
47
48
  "nameIdentifierScheme" => ni["nameIdentifierScheme"] }.compact
48
49
  end
@@ -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)
@@ -118,7 +128,7 @@ module Bolognese
118
128
  def insert_resource_type(xml)
119
129
  return xml unless types.is_a?(Hash) && (types["schemaOrg"].present? || types["resourceTypeGeneral"])
120
130
 
121
- xml.resourceType(types["resourceType"] || types["schemaOrg"],
131
+ xml.resourceType(types["resourceType"],
122
132
  'resourceTypeGeneral' => types["resourceTypeGeneral"] || Metadata::SO_TO_DC_TRANSLATIONS[types["schemaOrg"]] || "Other")
123
133
  end
124
134
 
@@ -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
@@ -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
@@ -153,6 +153,7 @@ module Bolognese
153
153
  "language" => language,
154
154
  "author" => author,
155
155
  "contributor" => to_citeproc(contributors),
156
+ "translator" => contributors ? to_citeproc(contributors.select { |c| c["contributorType"] == "Translator" }) : nil,
156
157
  "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year.to_s),
157
158
  "submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
158
159
  "abstract" => parse_attributes(descriptions, content: "description", first: true),
@@ -161,7 +162,7 @@ module Bolognese
161
162
  "volume" => container.to_h["volume"],
162
163
  "issue" => container.to_h["issue"],
163
164
  "page" => page,
164
- "publisher" => publisher,
165
+ "publisher" => publisher["name"],
165
166
  "title" => parse_attributes(titles, content: "title", first: true),
166
167
  "URL" => url,
167
168
  "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)
@@ -52,6 +52,12 @@ module Bolognese
52
52
  [{ "nameType" => "Organizational", "name" => ":(unav)" }]
53
53
  end
54
54
  contributors = get_authors(from_citeproc(Array.wrap(meta.fetch("editor", nil))))
55
+ translators = get_authors(from_citeproc(Array.wrap(meta.fetch("translator", nil))))
56
+ translators.each do |translator|
57
+ translator["contributorType"] = "Translator"
58
+ end
59
+ contributors += translators
60
+
55
61
  dates = if date = get_date_from_date_parts(meta.fetch("issued", nil))
56
62
  if Date.edtf(date).present?
57
63
  [{ "date" => date,
@@ -107,7 +113,7 @@ module Bolognese
107
113
  "related_identifiers" => related_identifiers,
108
114
  "dates" => dates,
109
115
  "publication_year" => publication_year,
110
- "descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract")), "descriptionType" => "Abstract" }] : [],
116
+ "descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract"), new_line: true), "descriptionType" => "Abstract" }] : [],
111
117
  "rights_list" => rights_list,
112
118
  "version_info" => meta.fetch("version", nil),
113
119
  "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