bolognese 1.8.12 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +37 -0
- data/.github/workflows/changelog.yml +36 -0
- data/.github/workflows/release.yml +47 -0
- data/CHANGELOG.md +1716 -0
- data/Gemfile.lock +63 -59
- data/README.md +1 -1
- data/bolognese.gemspec +1 -1
- data/lib/bolognese/author_utils.rb +6 -5
- data/lib/bolognese/datacite_utils.rb +76 -9
- data/lib/bolognese/metadata.rb +10 -5
- data/lib/bolognese/metadata_utils.rb +3 -2
- data/lib/bolognese/readers/bibtex_reader.rb +5 -4
- data/lib/bolognese/readers/citeproc_reader.rb +1 -1
- data/lib/bolognese/readers/crossref_reader.rb +4 -5
- data/lib/bolognese/readers/datacite_reader.rb +57 -11
- data/lib/bolognese/readers/ris_reader.rb +3 -3
- data/lib/bolognese/utils.rb +163 -46
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/bibtex_writer.rb +1 -1
- data/resources/kernel-4.4/include/datacite-contributorType-v4.xsd +35 -0
- data/resources/kernel-4.4/include/datacite-dateType-v4.xsd +25 -0
- data/resources/kernel-4.4/include/datacite-descriptionType-v4.xsd +19 -0
- data/resources/kernel-4.4/include/datacite-funderIdentifierType-v4.xsd +16 -0
- data/resources/kernel-4.4/include/datacite-nameType-v4.xsd +10 -0
- data/resources/kernel-4.4/include/datacite-numberType-v4.xsd +12 -0
- data/resources/kernel-4.4/include/datacite-relatedIdentifierType-v4.xsd +34 -0
- data/resources/kernel-4.4/include/datacite-relationType-v4.xsd +51 -0
- data/resources/kernel-4.4/include/datacite-resourceType-v4.xsd +43 -0
- data/resources/kernel-4.4/include/datacite-titleType-v4.xsd +14 -0
- data/resources/kernel-4.4/include/xml.xsd +286 -0
- data/resources/kernel-4.4/metadata.xsd +707 -0
- data/resources/kernel-4/include/datacite-contributorType-v4.xsd +21 -21
- data/resources/kernel-4/include/datacite-dateType-v4.xsd +11 -11
- data/resources/kernel-4/include/datacite-descriptionType-v4.xsd +6 -6
- data/resources/kernel-4/include/datacite-funderIdentifierType-v4.xsd +5 -5
- data/resources/kernel-4/include/datacite-nameType-v4.xsd +2 -2
- data/resources/kernel-4/include/datacite-numberType-v4.xsd +12 -0
- data/resources/kernel-4/include/datacite-relatedIdentifierType-v4.xsd +19 -19
- data/resources/kernel-4/include/datacite-relationType-v4.xsd +36 -34
- data/resources/kernel-4/include/datacite-resourceType-v4.xsd +32 -17
- data/resources/kernel-4/include/datacite-titleType-v4.xsd +4 -4
- data/resources/kernel-4/metadata.xsd +297 -105
- data/spec/fixtures/datacite-example-dissertation-v4.4.xml +56 -0
- data/spec/fixtures/datacite-example-full-v4.4.xml +114 -0
- data/spec/fixtures/datacite-example-relateditems.xml +61 -0
- data/spec/fixtures/datacite-example-xs-string.xml +28 -0
- data/spec/fixtures/datacite-geolocationpolygons-multiple.xml +56 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/article_id_as_page_number.yml +100 -0
- data/spec/metadata_spec.rb +1 -1
- data/spec/readers/bibtex_reader_spec.rb +2 -2
- data/spec/readers/crossref_reader_spec.rb +56 -38
- data/spec/readers/datacite_json_reader_spec.rb +1 -1
- data/spec/readers/datacite_reader_spec.rb +255 -4
- data/spec/readers/ris_reader_spec.rb +3 -3
- data/spec/writers/bibtex_writer_spec.rb +1 -1
- data/spec/writers/citation_writer_spec.rb +2 -2
- data/spec/writers/crosscite_writer_spec.rb +3 -3
- data/spec/writers/csv_writer_spec.rb +4 -4
- data/spec/writers/datacite_json_writer_spec.rb +3 -3
- data/spec/writers/datacite_writer_spec.rb +5 -5
- data/spec/writers/ris_writer_spec.rb +3 -2
- data/spec/writers/schema_org_writer_spec.rb +4 -4
- metadata +30 -8
- data/.travis.yml +0 -35
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (1.
|
4
|
+
bolognese (1.9.2)
|
5
5
|
activesupport (>= 4.2.5)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (>= 5.1.0)
|
@@ -30,42 +30,43 @@ PATH
|
|
30
30
|
GEM
|
31
31
|
remote: https://rubygems.org/
|
32
32
|
specs:
|
33
|
-
activesupport (6.
|
33
|
+
activesupport (6.1.3)
|
34
34
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
35
|
-
i18n (>=
|
36
|
-
minitest (
|
37
|
-
tzinfo (~>
|
38
|
-
zeitwerk (~> 2.
|
35
|
+
i18n (>= 1.6, < 2)
|
36
|
+
minitest (>= 5.1)
|
37
|
+
tzinfo (~> 2.0)
|
38
|
+
zeitwerk (~> 2.3)
|
39
39
|
addressable (2.7.0)
|
40
40
|
public_suffix (>= 2.0.2, < 5.0)
|
41
41
|
benchmark_methods (0.7)
|
42
|
-
bibtex-ruby (
|
42
|
+
bibtex-ruby (6.0.0)
|
43
43
|
latex-decode (~> 0.0)
|
44
44
|
builder (3.2.4)
|
45
45
|
citeproc (1.0.10)
|
46
46
|
namae (~> 1.0)
|
47
|
-
citeproc-ruby (1.1.
|
47
|
+
citeproc-ruby (1.1.13)
|
48
48
|
citeproc (~> 1.0, >= 1.0.9)
|
49
49
|
csl (~> 1.5)
|
50
50
|
colorize (0.8.1)
|
51
|
-
concurrent-ruby (1.1.
|
52
|
-
crack (0.4.
|
51
|
+
concurrent-ruby (1.1.8)
|
52
|
+
crack (0.4.5)
|
53
|
+
rexml
|
53
54
|
crass (1.0.6)
|
54
|
-
csl (1.5.
|
55
|
+
csl (1.5.2)
|
55
56
|
namae (~> 1.0)
|
56
57
|
csl-styles (1.0.1.10)
|
57
58
|
csl (~> 1.0)
|
58
59
|
diff-lcs (1.4.4)
|
59
|
-
docile (1.3.
|
60
|
-
ebnf (2.1.
|
60
|
+
docile (1.3.5)
|
61
|
+
ebnf (2.1.2)
|
61
62
|
htmlentities (~> 4.3)
|
62
63
|
rdf (~> 3.1)
|
63
64
|
scanf (~> 1.0)
|
64
65
|
sxp (~> 1.1)
|
65
|
-
edtf (3.0.
|
66
|
+
edtf (3.0.6)
|
66
67
|
activesupport (>= 3.0, < 7.0)
|
67
68
|
excon (0.71.1)
|
68
|
-
faraday (0.17.
|
69
|
+
faraday (0.17.4)
|
69
70
|
multipart-post (>= 1.2, < 3)
|
70
71
|
faraday-encoding (0.0.5)
|
71
72
|
faraday
|
@@ -73,33 +74,34 @@ GEM
|
|
73
74
|
faraday (>= 0.7.4, < 1.0)
|
74
75
|
gender_detector (0.1.2)
|
75
76
|
unicode_utils (>= 1.3.0)
|
76
|
-
haml (5.2.
|
77
|
+
haml (5.2.1)
|
77
78
|
temple (>= 0.8.0)
|
78
79
|
tilt
|
79
80
|
hamster (3.0.0)
|
80
81
|
concurrent-ruby (~> 1.0)
|
81
82
|
hashdiff (1.0.1)
|
82
83
|
htmlentities (4.3.4)
|
83
|
-
i18n (1.8.
|
84
|
+
i18n (1.8.9)
|
84
85
|
concurrent-ruby (~> 1.0)
|
85
86
|
iso8601 (0.9.1)
|
86
|
-
json
|
87
|
-
json-
|
87
|
+
json (2.5.1)
|
88
|
+
json-canonicalization (0.2.1)
|
89
|
+
json-ld (3.1.9)
|
88
90
|
htmlentities (~> 4.3)
|
89
91
|
json-canonicalization (~> 0.2)
|
90
92
|
link_header (~> 0.0, >= 0.0.8)
|
91
93
|
multi_json (~> 1.14)
|
92
94
|
rack (~> 2.0)
|
93
95
|
rdf (~> 3.1)
|
94
|
-
json-ld-preloaded (3.1.
|
96
|
+
json-ld-preloaded (3.1.5)
|
95
97
|
json-ld (~> 3.1)
|
96
98
|
rdf (~> 3.1)
|
97
99
|
jsonlint (0.3.0)
|
98
100
|
oj (~> 3)
|
99
101
|
optimist (~> 3)
|
100
|
-
latex-decode (0.3.
|
102
|
+
latex-decode (0.3.2)
|
101
103
|
link_header (0.0.8)
|
102
|
-
loofah (2.
|
104
|
+
loofah (2.9.0)
|
103
105
|
crass (~> 1.0.2)
|
104
106
|
nokogiri (>= 1.5.9)
|
105
107
|
maremma (4.7.2)
|
@@ -114,13 +116,13 @@ GEM
|
|
114
116
|
oj (>= 2.8.3)
|
115
117
|
oj_mimic_json (~> 1.0, >= 1.0.1)
|
116
118
|
mini_portile2 (2.4.0)
|
117
|
-
minitest (5.14.
|
119
|
+
minitest (5.14.4)
|
118
120
|
multi_json (1.15.0)
|
119
121
|
multipart-post (2.1.1)
|
120
|
-
namae (1.
|
122
|
+
namae (1.1.1)
|
121
123
|
nokogiri (1.10.10)
|
122
124
|
mini_portile2 (~> 2.4.0)
|
123
|
-
oj (3.
|
125
|
+
oj (3.11.3)
|
124
126
|
oj_mimic_json (1.0.1)
|
125
127
|
optimist (3.0.1)
|
126
128
|
postrank-uri (1.0.24)
|
@@ -132,66 +134,68 @@ GEM
|
|
132
134
|
rack-test (0.8.3)
|
133
135
|
rack (>= 1.0, < 3)
|
134
136
|
rake (12.3.3)
|
135
|
-
rdf (3.1.
|
137
|
+
rdf (3.1.13)
|
136
138
|
hamster (~> 3.0)
|
137
139
|
link_header (~> 0.0, >= 0.0.8)
|
138
140
|
rdf-aggregate-repo (3.1.0)
|
139
141
|
rdf (~> 3.1)
|
140
|
-
rdf-rdfa (3.1.
|
141
|
-
haml (~> 5.
|
142
|
+
rdf-rdfa (3.1.3)
|
143
|
+
haml (~> 5.2)
|
142
144
|
htmlentities (~> 4.3)
|
143
|
-
rdf (~> 3.1, >= 3.1.
|
145
|
+
rdf (~> 3.1, >= 3.1.13)
|
144
146
|
rdf-aggregate-repo (~> 3.1)
|
145
|
-
rdf-vocab (~> 3.1, >= 3.1.
|
147
|
+
rdf-vocab (~> 3.1, >= 3.1.11)
|
146
148
|
rdf-xsd (~> 3.1)
|
147
|
-
rdf-rdfxml (3.1.
|
149
|
+
rdf-rdfxml (3.1.1)
|
148
150
|
htmlentities (~> 4.3)
|
149
151
|
rdf (~> 3.1)
|
150
152
|
rdf-rdfa (~> 3.1)
|
151
153
|
rdf-xsd (~> 3.1)
|
152
|
-
rdf-turtle (3.1.
|
153
|
-
ebnf (~> 2.
|
154
|
-
rdf (~> 3.1, >= 3.1.
|
155
|
-
rdf-vocab (3.1.
|
156
|
-
rdf (~> 3.1, >= 3.1.
|
157
|
-
rdf-xsd (3.1.
|
154
|
+
rdf-turtle (3.1.3)
|
155
|
+
ebnf (~> 2.1)
|
156
|
+
rdf (~> 3.1, >= 3.1.8)
|
157
|
+
rdf-vocab (3.1.12)
|
158
|
+
rdf (~> 3.1, >= 3.1.12)
|
159
|
+
rdf-xsd (3.1.1)
|
158
160
|
rdf (~> 3.1)
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
rspec-
|
163
|
-
|
164
|
-
rspec-
|
165
|
-
rspec-
|
161
|
+
rexml (~> 3.2)
|
162
|
+
rexml (3.2.4)
|
163
|
+
rspec (3.10.0)
|
164
|
+
rspec-core (~> 3.10.0)
|
165
|
+
rspec-expectations (~> 3.10.0)
|
166
|
+
rspec-mocks (~> 3.10.0)
|
167
|
+
rspec-core (3.10.1)
|
168
|
+
rspec-support (~> 3.10.0)
|
169
|
+
rspec-expectations (3.10.1)
|
166
170
|
diff-lcs (>= 1.2.0, < 2.0)
|
167
|
-
rspec-support (~> 3.
|
168
|
-
rspec-mocks (3.
|
171
|
+
rspec-support (~> 3.10.0)
|
172
|
+
rspec-mocks (3.10.2)
|
169
173
|
diff-lcs (>= 1.2.0, < 2.0)
|
170
|
-
rspec-support (~> 3.
|
171
|
-
rspec-support (3.
|
174
|
+
rspec-support (~> 3.10.0)
|
175
|
+
rspec-support (3.10.2)
|
172
176
|
rspec-xsd (0.1.0)
|
173
177
|
nokogiri (~> 1.6)
|
174
178
|
rspec (~> 3)
|
175
179
|
scanf (1.0.0)
|
176
|
-
simplecov (0.
|
180
|
+
simplecov (0.17.1)
|
177
181
|
docile (~> 1.1)
|
178
|
-
|
179
|
-
|
182
|
+
json (>= 1.8, < 3)
|
183
|
+
simplecov-html (~> 0.10.0)
|
184
|
+
simplecov-html (0.10.2)
|
180
185
|
sxp (1.1.0)
|
181
186
|
rdf (~> 3.1)
|
182
187
|
temple (0.8.2)
|
183
|
-
thor (1.0
|
184
|
-
thread_safe (0.3.6)
|
188
|
+
thor (1.1.0)
|
185
189
|
tilt (2.0.10)
|
186
|
-
tzinfo (
|
187
|
-
|
190
|
+
tzinfo (2.0.4)
|
191
|
+
concurrent-ruby (~> 1.0)
|
188
192
|
unicode_utils (1.4.0)
|
189
193
|
vcr (3.0.3)
|
190
|
-
webmock (3.
|
194
|
+
webmock (3.12.1)
|
191
195
|
addressable (>= 2.3.6)
|
192
196
|
crack (>= 0.3.2)
|
193
197
|
hashdiff (>= 0.4.0, < 2.0.0)
|
194
|
-
zeitwerk (2.4.
|
198
|
+
zeitwerk (2.4.2)
|
195
199
|
|
196
200
|
PLATFORMS
|
197
201
|
ruby
|
@@ -204,9 +208,9 @@ DEPENDENCIES
|
|
204
208
|
rake (~> 12.0)
|
205
209
|
rspec (~> 3.4)
|
206
210
|
rspec-xsd (~> 0.1.0)
|
207
|
-
simplecov (
|
211
|
+
simplecov (= 0.17.1)
|
208
212
|
vcr (~> 3.0, >= 3.0.3)
|
209
213
|
webmock (~> 3.0, >= 3.0.1)
|
210
214
|
|
211
215
|
BUNDLED WITH
|
212
|
-
2.
|
216
|
+
2.2.15
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[![Identifier](https://img.shields.io/badge/doi-10.5438%2Fn138--z3mk-fca709.svg)](https://doi.org/10.5438/n138-z3mk)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/bolognese.svg)](https://badge.fury.io/rb/bolognese)
|
3
|
-
|
3
|
+
![Build Ruby Gem](https://github.com/datacite/bolognese/workflows/Build%20Ruby%20Gem/badge.svg)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/datacite/bolognese/badges/gpa.svg)](https://codeclimate.com/github/datacite/bolognese)
|
5
5
|
[![Test Coverage](https://codeclimate.com/github/datacite/bolognese/badges/coverage.svg)](https://codeclimate.com/github/datacite/bolognese/coverage)
|
6
6
|
|
data/bolognese.gemspec
CHANGED
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_development_dependency 'rack-test', '~> 0'
|
48
48
|
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
|
49
49
|
s.add_development_dependency 'webmock', '~> 3.0', '>= 3.0.1'
|
50
|
-
s.add_development_dependency 'simplecov', '
|
50
|
+
s.add_development_dependency 'simplecov', '0.17.1'
|
51
51
|
s.add_development_dependency 'hashdiff', ['>= 1.0.0.beta1', '< 2.0.0']
|
52
52
|
|
53
53
|
s.require_paths = ["lib"]
|
@@ -15,7 +15,7 @@ module Bolognese
|
|
15
15
|
def get_one_author(author)
|
16
16
|
# author is a string
|
17
17
|
author = { "creatorName" => author } if author.is_a?(String)
|
18
|
-
|
18
|
+
|
19
19
|
# malformed XML
|
20
20
|
return nil if author.fetch("creatorName", nil).is_a?(Array)
|
21
21
|
|
@@ -31,17 +31,17 @@ module Bolognese
|
|
31
31
|
|
32
32
|
name_identifiers = Array.wrap(author.fetch("nameIdentifier", nil)).map do |ni|
|
33
33
|
if ni["nameIdentifierScheme"] == "ORCID"
|
34
|
-
{
|
34
|
+
{
|
35
35
|
"nameIdentifier" => normalize_orcid(ni["__content__"]),
|
36
36
|
"schemeUri" => "https://orcid.org",
|
37
37
|
"nameIdentifierScheme" => "ORCID" }.compact
|
38
38
|
elsif ni["schemeURI"].present?
|
39
|
-
{
|
39
|
+
{
|
40
40
|
"nameIdentifier" => ni["schemeURI"].to_s + ni["__content__"].to_s,
|
41
41
|
"schemeUri" => ni["schemeURI"].to_s,
|
42
42
|
"nameIdentifierScheme" => ni["nameIdentifierScheme"] }.compact
|
43
43
|
else
|
44
|
-
{
|
44
|
+
{
|
45
45
|
"nameIdentifier" => ni["__content__"],
|
46
46
|
"schemeUri" => nil,
|
47
47
|
"nameIdentifierScheme" => ni["nameIdentifierScheme"] }.compact
|
@@ -59,6 +59,7 @@ module Bolognese
|
|
59
59
|
return author if family_name.present?
|
60
60
|
|
61
61
|
if is_personal_name?(author)
|
62
|
+
Namae.options[:include_particle_in_family] = true
|
62
63
|
names = Namae.parse(name)
|
63
64
|
parsed_name = names.first
|
64
65
|
|
@@ -79,7 +80,7 @@ module Bolognese
|
|
79
80
|
"affiliation" => Array.wrap(author.fetch("affiliation", nil)),
|
80
81
|
"contributorType" => contributor_type }.compact
|
81
82
|
else
|
82
|
-
{ "nameType" => name_type,
|
83
|
+
{ "nameType" => name_type,
|
83
84
|
"name" => name,
|
84
85
|
"nameIdentifiers" => Array.wrap(name_identifiers),
|
85
86
|
"affiliation" => Array.wrap(author.fetch("affiliation", nil)),
|
@@ -40,6 +40,7 @@ module Bolognese
|
|
40
40
|
insert_language(xml)
|
41
41
|
insert_alternate_identifiers(xml)
|
42
42
|
insert_related_identifiers(xml)
|
43
|
+
insert_related_items(xml)
|
43
44
|
insert_sizes(xml)
|
44
45
|
insert_formats(xml)
|
45
46
|
insert_version(xml)
|
@@ -86,7 +87,7 @@ module Bolognese
|
|
86
87
|
end
|
87
88
|
Array.wrap(person["affiliation"]).each do |affiliation|
|
88
89
|
attributes = { "affiliationIdentifier" => affiliation["affiliationIdentifier"], "affiliationIdentifierScheme" => affiliation["affiliationIdentifierScheme"], "schemeURI" => affiliation["schemeUri"] }.compact
|
89
|
-
xml.affiliation(affiliation["name"], attributes)
|
90
|
+
xml.affiliation(affiliation["name"], attributes)
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
@@ -209,6 +210,71 @@ module Bolognese
|
|
209
210
|
end
|
210
211
|
end
|
211
212
|
|
213
|
+
def insert_related_items(xml)
|
214
|
+
return xml unless related_items.present?
|
215
|
+
|
216
|
+
xml.relatedItems do
|
217
|
+
related_items.each do |related_item|
|
218
|
+
attributes = {
|
219
|
+
'relatedItemType' => related_item["relatedItemType"],
|
220
|
+
'relationType' => related_item["relationType"],
|
221
|
+
}.compact
|
222
|
+
|
223
|
+
xml.relatedItem(related_item["relatedItem"], attributes) do
|
224
|
+
|
225
|
+
xml.relatedItemIdentifier(related_item["relatedItemIdentifier"]['relatedItemIdentifier'],
|
226
|
+
{
|
227
|
+
'relatedItemIdentifierType' => related_item["relatedItemIdentifier"]["relatedItemIdentifierType"],
|
228
|
+
'relatedMetadataScheme' => related_item["relatedItemIdentifier"]["relatedMetadataScheme"],
|
229
|
+
'schemeURI' => related_item["relatedItemIdentifier"]["schemeURI"],
|
230
|
+
'schemeType' => related_item["relatedItemIdentifier"]["schemeType"],
|
231
|
+
}.compact
|
232
|
+
)
|
233
|
+
|
234
|
+
xml.creators do
|
235
|
+
Array.wrap(related_item['creators']).each do |au|
|
236
|
+
xml.creator do
|
237
|
+
insert_person(xml, au, "creator")
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
xml.titles do
|
243
|
+
Array.wrap(related_item['titles']).each do |title|
|
244
|
+
if title.is_a?(Hash)
|
245
|
+
t = title
|
246
|
+
else
|
247
|
+
t = {}
|
248
|
+
t["title"] = title
|
249
|
+
end
|
250
|
+
|
251
|
+
attributes = { 'titleType' => t["titleType"], 'xml:lang' => t["lang"] }.compact
|
252
|
+
xml.title(t["title"], attributes)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
xml.publicationYear(related_item['publicationYear'])
|
257
|
+
xml.volume(related_item['volume'])
|
258
|
+
xml.issue(related_item['issue'])
|
259
|
+
xml.number(related_item['number'], {'numberType' => related_item['numberType']}.compact)
|
260
|
+
xml.firstPage(related_item['firstPage'])
|
261
|
+
xml.lastPage(related_item['lastPage'])
|
262
|
+
xml.publisher(related_item['publisher'])
|
263
|
+
xml.edition(related_item['edition'])
|
264
|
+
|
265
|
+
xml.contributors do
|
266
|
+
Array.wrap(related_item["contributors"]).each do |con|
|
267
|
+
xml.contributor("contributorType" => con["contributorType"] || "Other") do
|
268
|
+
insert_person(xml, con, "contributor")
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
212
278
|
def insert_sizes(xml)
|
213
279
|
xml.sizes do
|
214
280
|
Array.wrap(sizes).each do |s|
|
@@ -238,12 +304,12 @@ module Bolognese
|
|
238
304
|
r["rightsUri"] = normalize_id(rights)
|
239
305
|
end
|
240
306
|
|
241
|
-
attributes = {
|
307
|
+
attributes = {
|
242
308
|
"rightsURI" => r["rightsUri"],
|
243
309
|
"rightsIdentifier" => r["rightsIdentifier"],
|
244
310
|
"rightsIdentifierScheme" => r["rightsIdentifierScheme"],
|
245
311
|
"schemeURI" => r["schemeUri"],
|
246
|
-
"xml:lang" => r["lang"]
|
312
|
+
"xml:lang" => r["lang"]
|
247
313
|
}.compact
|
248
314
|
|
249
315
|
xml.rights(r["rights"], attributes)
|
@@ -302,13 +368,14 @@ module Bolognese
|
|
302
368
|
xml.northBoundLatitude(geo_location.dig("geoLocationBox", "northBoundLatitude"))
|
303
369
|
end
|
304
370
|
end
|
305
|
-
|
306
371
|
if geo_location["geoLocationPolygon"]
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
xml.
|
311
|
-
|
372
|
+
geo_location["geoLocationPolygon"].each do |geo_location_polygon|
|
373
|
+
xml.geoLocationPolygon do
|
374
|
+
geo_location_polygon.each do |polygon_point|
|
375
|
+
xml.polygonPoint do
|
376
|
+
xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude"))
|
377
|
+
xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude"))
|
378
|
+
end
|
312
379
|
end
|
313
380
|
end
|
314
381
|
end
|
data/lib/bolognese/metadata.rb
CHANGED
@@ -8,12 +8,12 @@ module Bolognese
|
|
8
8
|
|
9
9
|
attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue, :show_errors
|
10
10
|
attr_reader :doc, :page_start, :page_end
|
11
|
-
attr_writer :id, :provider_id, :client_id, :doi, :identifiers, :creators, :contributors, :titles, :publisher,
|
11
|
+
attr_writer :id, :provider_id, :client_id, :doi, :identifiers, :creators, :contributors, :titles, :publisher,
|
12
12
|
:rights_list, :dates, :publication_year, :volume, :url, :version_info,
|
13
13
|
:subjects, :contributor, :descriptions, :language, :sizes,
|
14
14
|
:formats, :schema_version, :meta, :container, :agency,
|
15
15
|
:format, :funding_references, :state, :geo_locations,
|
16
|
-
:types, :content_url, :related_identifiers, :style, :locale, :date_registered
|
16
|
+
:types, :content_url, :related_identifiers, :related_items, :style, :locale, :date_registered
|
17
17
|
|
18
18
|
def initialize(options={})
|
19
19
|
options.symbolize_keys!
|
@@ -42,7 +42,7 @@ module Bolognese
|
|
42
42
|
filename = File.basename(options[:input])
|
43
43
|
ext = File.extname(options[:input])
|
44
44
|
if %w(.bib .ris .xml .json).include?(ext)
|
45
|
-
hsh = {
|
45
|
+
hsh = {
|
46
46
|
"url" => options[:url],
|
47
47
|
"state" => options[:state],
|
48
48
|
"date_registered" => options[:date_registered],
|
@@ -57,7 +57,7 @@ module Bolognese
|
|
57
57
|
exit 1
|
58
58
|
end
|
59
59
|
else
|
60
|
-
hsh = {
|
60
|
+
hsh = {
|
61
61
|
"url" => options[:url],
|
62
62
|
"state" => options[:state],
|
63
63
|
"date_registered" => options[:date_registered],
|
@@ -112,6 +112,7 @@ module Bolognese
|
|
112
112
|
:language,
|
113
113
|
:geo_locations,
|
114
114
|
:related_identifiers,
|
115
|
+
:related_items,
|
115
116
|
:formats,
|
116
117
|
:sizes
|
117
118
|
).compact
|
@@ -150,7 +151,7 @@ module Bolognese
|
|
150
151
|
def errors
|
151
152
|
meta.fetch("errors", nil) || datacite_errors(xml: datacite, schema_version: schema_version)
|
152
153
|
end
|
153
|
-
|
154
|
+
|
154
155
|
def descriptions
|
155
156
|
@descriptions ||= meta.fetch("descriptions", nil)
|
156
157
|
end
|
@@ -187,6 +188,10 @@ module Bolognese
|
|
187
188
|
@related_identifiers ||= meta.fetch("related_identifiers", nil)
|
188
189
|
end
|
189
190
|
|
191
|
+
def related_items
|
192
|
+
@related_items ||= meta.fetch("related_items", nil)
|
193
|
+
end
|
194
|
+
|
190
195
|
def url
|
191
196
|
@url ||= meta.fetch("url", nil)
|
192
197
|
end
|