bolognese 1.8.18 → 1.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/changelog.yml +36 -0
- data/CHANGELOG.md +1740 -0
- data/Gemfile.lock +54 -50
- 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 +3 -3
- data/lib/bolognese/readers/datacite_reader.rb +77 -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/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 +76 -0
- data/spec/metadata_spec.rb +1 -1
- data/spec/readers/bibtex_reader_spec.rb +2 -2
- data/spec/readers/crossref_reader_spec.rb +37 -37
- data/spec/readers/datacite_json_reader_spec.rb +1 -1
- data/spec/readers/datacite_reader_spec.rb +262 -3
- data/spec/readers/ris_reader_spec.rb +3 -3
- 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 +4 -4
- data/spec/writers/schema_org_writer_spec.rb +2 -2
- metadata +25 -5
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (1.
|
4
|
+
bolognese (1.9.5)
|
5
5
|
activesupport (>= 4.2.5)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (>= 5.1.0)
|
@@ -19,7 +19,7 @@ PATH
|
|
19
19
|
loofah (~> 2.0, >= 2.0.3)
|
20
20
|
maremma (>= 4.7, < 5)
|
21
21
|
namae (~> 1.0)
|
22
|
-
nokogiri (~> 1.
|
22
|
+
nokogiri (~> 1.11.2)
|
23
23
|
oj (~> 3.10)
|
24
24
|
oj_mimic_json (~> 1.0, >= 1.0.1)
|
25
25
|
postrank-uri (~> 1.0, >= 1.0.18)
|
@@ -30,16 +30,16 @@ PATH
|
|
30
30
|
GEM
|
31
31
|
remote: https://rubygems.org/
|
32
32
|
specs:
|
33
|
-
activesupport (6.
|
33
|
+
activesupport (6.1.3.1)
|
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)
|
@@ -48,15 +48,16 @@ GEM
|
|
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
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
|
+
docile (1.3.5)
|
60
61
|
ebnf (2.1.2)
|
61
62
|
htmlentities (~> 4.3)
|
62
63
|
rdf (~> 3.1)
|
@@ -65,7 +66,7 @@ GEM
|
|
65
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,26 +74,26 @@ 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.10)
|
84
85
|
concurrent-ruby (~> 1.0)
|
85
86
|
iso8601 (0.9.1)
|
86
|
-
json (2.
|
87
|
-
json-canonicalization (0.2.
|
88
|
-
json-ld (3.1.
|
87
|
+
json (2.5.1)
|
88
|
+
json-canonicalization (0.2.1)
|
89
|
+
json-ld (3.1.9)
|
89
90
|
htmlentities (~> 4.3)
|
90
91
|
json-canonicalization (~> 0.2)
|
91
92
|
link_header (~> 0.0, >= 0.0.8)
|
92
93
|
multi_json (~> 1.14)
|
93
94
|
rack (~> 2.0)
|
94
95
|
rdf (~> 3.1)
|
95
|
-
json-ld-preloaded (3.1.
|
96
|
+
json-ld-preloaded (3.1.5)
|
96
97
|
json-ld (~> 3.1)
|
97
98
|
rdf (~> 3.1)
|
98
99
|
jsonlint (0.3.0)
|
@@ -100,10 +101,10 @@ GEM
|
|
100
101
|
optimist (~> 3)
|
101
102
|
latex-decode (0.3.2)
|
102
103
|
link_header (0.0.8)
|
103
|
-
loofah (2.
|
104
|
+
loofah (2.9.1)
|
104
105
|
crass (~> 1.0.2)
|
105
106
|
nokogiri (>= 1.5.9)
|
106
|
-
maremma (4.7.
|
107
|
+
maremma (4.7.4)
|
107
108
|
activesupport (>= 4.2.5)
|
108
109
|
addressable (>= 2.3.6)
|
109
110
|
builder (~> 3.2, >= 3.2.2)
|
@@ -111,17 +112,18 @@ GEM
|
|
111
112
|
faraday (~> 0.17.3)
|
112
113
|
faraday-encoding (~> 0.0.4)
|
113
114
|
faraday_middleware (~> 0.14.0)
|
114
|
-
nokogiri (~> 1.
|
115
|
+
nokogiri (~> 1.11.2)
|
115
116
|
oj (>= 2.8.3)
|
116
117
|
oj_mimic_json (~> 1.0, >= 1.0.1)
|
117
|
-
mini_portile2 (2.
|
118
|
-
minitest (5.14.
|
118
|
+
mini_portile2 (2.5.0)
|
119
|
+
minitest (5.14.4)
|
119
120
|
multi_json (1.15.0)
|
120
121
|
multipart-post (2.1.1)
|
121
|
-
namae (1.
|
122
|
-
nokogiri (1.
|
123
|
-
mini_portile2 (~> 2.
|
124
|
-
|
122
|
+
namae (1.1.1)
|
123
|
+
nokogiri (1.11.2)
|
124
|
+
mini_portile2 (~> 2.5.0)
|
125
|
+
racc (~> 1.4)
|
126
|
+
oj (3.11.5)
|
125
127
|
oj_mimic_json (1.0.1)
|
126
128
|
optimist (3.0.1)
|
127
129
|
postrank-uri (1.0.24)
|
@@ -129,47 +131,50 @@ GEM
|
|
129
131
|
nokogiri (>= 1.8.0)
|
130
132
|
public_suffix (>= 2.0.0, < 2.1)
|
131
133
|
public_suffix (2.0.5)
|
134
|
+
racc (1.5.2)
|
132
135
|
rack (2.2.3)
|
133
136
|
rack-test (0.8.3)
|
134
137
|
rack (>= 1.0, < 3)
|
135
138
|
rake (12.3.3)
|
136
|
-
rdf (3.1.
|
139
|
+
rdf (3.1.13)
|
137
140
|
hamster (~> 3.0)
|
138
141
|
link_header (~> 0.0, >= 0.0.8)
|
139
142
|
rdf-aggregate-repo (3.1.0)
|
140
143
|
rdf (~> 3.1)
|
141
|
-
rdf-rdfa (3.1.
|
142
|
-
haml (~> 5.
|
144
|
+
rdf-rdfa (3.1.3)
|
145
|
+
haml (~> 5.2)
|
143
146
|
htmlentities (~> 4.3)
|
144
|
-
rdf (~> 3.1, >= 3.1.
|
147
|
+
rdf (~> 3.1, >= 3.1.13)
|
145
148
|
rdf-aggregate-repo (~> 3.1)
|
146
|
-
rdf-vocab (~> 3.1, >= 3.1.
|
149
|
+
rdf-vocab (~> 3.1, >= 3.1.11)
|
147
150
|
rdf-xsd (~> 3.1)
|
148
|
-
rdf-rdfxml (3.1.
|
151
|
+
rdf-rdfxml (3.1.1)
|
149
152
|
htmlentities (~> 4.3)
|
150
153
|
rdf (~> 3.1)
|
151
154
|
rdf-rdfa (~> 3.1)
|
152
155
|
rdf-xsd (~> 3.1)
|
153
|
-
rdf-turtle (3.1.
|
154
|
-
ebnf (~> 2.
|
155
|
-
rdf (~> 3.1, >= 3.1.
|
156
|
-
rdf-vocab (3.1.
|
157
|
-
rdf (~> 3.1, >= 3.1.
|
158
|
-
rdf-xsd (3.1.
|
156
|
+
rdf-turtle (3.1.3)
|
157
|
+
ebnf (~> 2.1)
|
158
|
+
rdf (~> 3.1, >= 3.1.8)
|
159
|
+
rdf-vocab (3.1.13)
|
160
|
+
rdf (~> 3.1, >= 3.1.12)
|
161
|
+
rdf-xsd (3.1.1)
|
159
162
|
rdf (~> 3.1)
|
163
|
+
rexml (~> 3.2)
|
164
|
+
rexml (3.2.4)
|
160
165
|
rspec (3.10.0)
|
161
166
|
rspec-core (~> 3.10.0)
|
162
167
|
rspec-expectations (~> 3.10.0)
|
163
168
|
rspec-mocks (~> 3.10.0)
|
164
|
-
rspec-core (3.10.
|
169
|
+
rspec-core (3.10.1)
|
165
170
|
rspec-support (~> 3.10.0)
|
166
|
-
rspec-expectations (3.10.
|
171
|
+
rspec-expectations (3.10.1)
|
167
172
|
diff-lcs (>= 1.2.0, < 2.0)
|
168
173
|
rspec-support (~> 3.10.0)
|
169
|
-
rspec-mocks (3.10.
|
174
|
+
rspec-mocks (3.10.2)
|
170
175
|
diff-lcs (>= 1.2.0, < 2.0)
|
171
176
|
rspec-support (~> 3.10.0)
|
172
|
-
rspec-support (3.10.
|
177
|
+
rspec-support (3.10.2)
|
173
178
|
rspec-xsd (0.1.0)
|
174
179
|
nokogiri (~> 1.6)
|
175
180
|
rspec (~> 3)
|
@@ -182,18 +187,17 @@ GEM
|
|
182
187
|
sxp (1.1.0)
|
183
188
|
rdf (~> 3.1)
|
184
189
|
temple (0.8.2)
|
185
|
-
thor (1.0
|
186
|
-
thread_safe (0.3.6)
|
190
|
+
thor (1.1.0)
|
187
191
|
tilt (2.0.10)
|
188
|
-
tzinfo (
|
189
|
-
|
192
|
+
tzinfo (2.0.4)
|
193
|
+
concurrent-ruby (~> 1.0)
|
190
194
|
unicode_utils (1.4.0)
|
191
195
|
vcr (3.0.3)
|
192
|
-
webmock (3.
|
196
|
+
webmock (3.12.1)
|
193
197
|
addressable (>= 2.3.6)
|
194
198
|
crack (>= 0.3.2)
|
195
199
|
hashdiff (>= 0.4.0, < 2.0.0)
|
196
|
-
zeitwerk (2.4.
|
200
|
+
zeitwerk (2.4.2)
|
197
201
|
|
198
202
|
PLATFORMS
|
199
203
|
ruby
|
@@ -211,4 +215,4 @@ DEPENDENCIES
|
|
211
215
|
webmock (~> 3.0, >= 3.0.1)
|
212
216
|
|
213
217
|
BUNDLED WITH
|
214
|
-
2.
|
218
|
+
2.2.16
|
data/bolognese.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
# Declare dependencies here, rather than in the Gemfile
|
19
19
|
s.add_dependency 'maremma', '>= 4.7', '< 5'
|
20
20
|
s.add_dependency 'faraday', '~> 0.17.3'
|
21
|
-
s.add_dependency 'nokogiri', '~> 1.
|
21
|
+
s.add_dependency 'nokogiri', '~> 1.11.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'
|
@@ -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
|