bolognese 0.9.76 → 0.9.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/bolognese/datacite_utils.rb +15 -4
- data/lib/bolognese/version.rb +1 -1
- data/spec/datacite_utils_spec.rb +4 -4
- data/spec/writers/datacite_writer_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 929243886c6cef57a3d73b0afc690c992552410c1e4d91ee3f2f8bdf9663e7e2
|
4
|
+
data.tar.gz: 7aba3fea4c5d343a341509ddb7b17f4d662c6d5b5ffc125f81e59e231c0d0c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbf25d2aca9f3c9d8df6a229b9a87de94fd94b3c76fd19c20163666fbe1f88b98e4cfbd33d3cdb11d5725a68bbfe25ff0e16e9b978b226bfe82d4a72f3a36daa
|
7
|
+
data.tar.gz: 75c36cc522a1d23ad22c459b99d54195b717ed2f9106771417a75219f49115b8208c3871d4f8d948e8ed4c153410ca6ca93068db450189b215e81c97e8b80e22
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (0.9.
|
4
|
+
bolognese (0.9.77)
|
5
5
|
activesupport (>= 4.2.5, < 6)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (~> 4.1)
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
addressable (2.5.2)
|
33
33
|
public_suffix (>= 2.0.2, < 4.0)
|
34
34
|
benchmark_methods (0.7)
|
35
|
-
bibtex-ruby (4.4.
|
35
|
+
bibtex-ruby (4.4.6)
|
36
36
|
latex-decode (~> 0.0)
|
37
37
|
builder (3.2.3)
|
38
38
|
codeclimate-test-reporter (1.0.8)
|
@@ -103,7 +103,7 @@ GEM
|
|
103
103
|
public_suffix (>= 2.0.0, < 2.1)
|
104
104
|
public_suffix (2.0.5)
|
105
105
|
rack (2.0.4)
|
106
|
-
rack-test (0.8.
|
106
|
+
rack-test (0.8.3)
|
107
107
|
rack (>= 1.0, < 3)
|
108
108
|
rake (12.3.0)
|
109
109
|
rdf (3.0.1)
|
@@ -159,9 +159,19 @@ module Bolognese
|
|
159
159
|
|
160
160
|
def rel_identifier
|
161
161
|
Array.wrap(related_identifier).map do |r|
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
related_identifier_type = r["issn"].present? ? "ISSN" : validate_url(r["id"])
|
163
|
+
if related_identifier_type == "ISSN"
|
164
|
+
content = r["issn"]
|
165
|
+
elsif related_identifier_type == "DOI"
|
166
|
+
content = doi_from_url(r["id"])
|
167
|
+
else
|
168
|
+
content = r["id"]
|
169
|
+
end
|
170
|
+
|
171
|
+
{ "__content__" => content,
|
172
|
+
"related_identifier_type" => related_identifier_type,
|
173
|
+
"relation_type" => r["relationType"],
|
174
|
+
"resource_type_general" => r["resourceTypeGeneral"] }.compact
|
165
175
|
end
|
166
176
|
end
|
167
177
|
|
@@ -172,7 +182,8 @@ module Bolognese
|
|
172
182
|
rel_identifier.each do |related_identifier|
|
173
183
|
attributes = {
|
174
184
|
'relatedIdentifierType' => related_identifier["related_identifier_type"],
|
175
|
-
'relationType' => related_identifier["relation_type"]
|
185
|
+
'relationType' => related_identifier["relation_type"],
|
186
|
+
'resourceTypeGeneral' => related_identifier["resource_type_general"] }.compact
|
176
187
|
xml.relatedIdentifier(related_identifier["__content__"], attributes)
|
177
188
|
end
|
178
189
|
end
|
data/lib/bolognese/version.rb
CHANGED
data/spec/datacite_utils_spec.rb
CHANGED
@@ -122,16 +122,16 @@ describe Bolognese::Metadata, vcr: true do
|
|
122
122
|
response = Maremma.from_xml(xml)
|
123
123
|
expect(response.dig("relatedIdentifiers", "relatedIdentifier")).to eq([{"relatedIdentifierType"=>"DOI",
|
124
124
|
"relationType"=>"HasPart",
|
125
|
-
"__content__"=>"
|
125
|
+
"__content__"=>"10.5061/dryad.8515/1"},
|
126
126
|
{"relatedIdentifierType"=>"DOI",
|
127
127
|
"relationType"=>"HasPart",
|
128
|
-
"__content__"=>"
|
128
|
+
"__content__"=>"10.5061/dryad.8515/2"},
|
129
129
|
{"relatedIdentifierType"=>"DOI",
|
130
130
|
"relationType"=>"IsReferencedBy",
|
131
|
-
"__content__"=>"
|
131
|
+
"__content__"=>"10.1371/journal.ppat.1000446"},
|
132
132
|
{"relatedIdentifierType"=>"DOI",
|
133
133
|
"relationType"=>"IsSupplementTo",
|
134
|
-
"__content__"=>"
|
134
|
+
"__content__"=>"10.1371/journal.ppat.1000446"}])
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -10,7 +10,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
10
10
|
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
11
11
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
|
12
12
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X")
|
13
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"
|
13
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"10.1038/nature02100")
|
14
14
|
expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
|
15
15
|
expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
|
16
16
|
expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
|
@@ -157,7 +157,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
157
157
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
158
158
|
expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food")
|
159
159
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(3)
|
160
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"
|
160
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"10.5438/0000-00ss")
|
161
161
|
end
|
162
162
|
|
163
163
|
it "DOI not found" do
|
@@ -185,7 +185,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
185
185
|
expect(datacite.dig("titles", "title")).to eq("Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
186
186
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
|
187
187
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X")
|
188
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"
|
188
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"10.1038/nature02100")
|
189
189
|
expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
|
190
190
|
expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
|
191
191
|
expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.77
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|