bolognese 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +33 -0
- data/lib/bolognese/author_utils.rb +1 -1
- data/lib/bolognese/crossref.rb +9 -0
- data/lib/bolognese/datacite.rb +32 -9
- data/lib/bolognese/datacite_utils.rb +22 -4
- data/lib/bolognese/metadata.rb +5 -0
- data/lib/bolognese/utils.rb +4 -4
- data/lib/bolognese/version.rb +1 -1
- data/spec/crossref_spec.rb +12 -0
- data/spec/datacite_spec.rb +49 -1
- data/spec/datacite_utils_spec.rb +12 -12
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Funding_schema_version_3.yml +140 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Funding_schema_version_4.yml +474 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_datacite_xml_4_0/Funding.yml +474 -0
- data/spec/schema_org_spec.rb +1 -1
- data/spec/utils_spec.rb +4 -4
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abe51c368c713c55ea7e471b59369b89f3b6b9d
|
4
|
+
data.tar.gz: 5ac5bfbb3d8559ab69550a4966f1aac8142e74f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 882c4b43fe659cb7228540eed7cf45ef270038a7c494742b03eadbde8c1831d39ef7a96529562846538c93ac8d9637d2028169e0315b51a8ff58f08a6ce55ac3
|
7
|
+
data.tar.gz: 0c6acfdcfa05aa2ef68af95cb79d214436b72dec40e9cd2af834bc71a063966071b80c41701c741c10d382b7c870990ef10f770926d588486472b806352c843f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (0.5.
|
4
|
+
bolognese (0.5.3)
|
5
5
|
activesupport (~> 4.2, >= 4.2.5)
|
6
6
|
builder (~> 3.2, >= 3.2.2)
|
7
7
|
dotenv (~> 2.1, >= 2.1.1)
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
hashdiff (0.3.2)
|
40
40
|
i18n (0.8.0)
|
41
41
|
json (1.8.6)
|
42
|
-
maremma (3.5)
|
42
|
+
maremma (3.5.1)
|
43
43
|
activesupport (~> 4.2, >= 4.2.5)
|
44
44
|
addressable (>= 2.3.6)
|
45
45
|
builder (~> 3.2, >= 3.2.2)
|
data/README.md
CHANGED
@@ -801,6 +801,22 @@ bolognese read https://doi.org/10.7554/elife.01567
|
|
801
801
|
"position": "27",
|
802
802
|
"datePublished": "2013"
|
803
803
|
}],
|
804
|
+
"funder": [{
|
805
|
+
"@type": "Organization",
|
806
|
+
"name": "SystemsX"
|
807
|
+
}, {
|
808
|
+
"@type": "Organization",
|
809
|
+
"@id": "https://doi.org/10.13039/501100003043",
|
810
|
+
"name": "EMBO"
|
811
|
+
}, {
|
812
|
+
"@type": "Organization",
|
813
|
+
"@id": "https://doi.org/10.13039/501100001711",
|
814
|
+
"name": "Swiss National Science Foundation"
|
815
|
+
}, {
|
816
|
+
"@type": "Organization",
|
817
|
+
"@id": "https://doi.org/10.13039/501100006390",
|
818
|
+
"name": "University of Lausanne"
|
819
|
+
}],
|
804
820
|
"provider": {
|
805
821
|
"@type": "Organization",
|
806
822
|
"name": "Crossref"
|
@@ -848,6 +864,23 @@ bolognese read https://doi.org/10.7554/elife.01567 --as datacite
|
|
848
864
|
<publisher>eLife</publisher>
|
849
865
|
<publicationYear>2014</publicationYear>
|
850
866
|
<resourceType resourceTypeGeneral="Text">JournalArticle</resourceType>
|
867
|
+
<fundingReferences>
|
868
|
+
<fundingReference>
|
869
|
+
<funderName>SystemsX</funderName>
|
870
|
+
</fundingReference>
|
871
|
+
<fundingReference>
|
872
|
+
<funderName>EMBO</funderName>
|
873
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">https://doi.org/10.13039/501100003043</funderIdentifier>
|
874
|
+
</fundingReference>
|
875
|
+
<fundingReference>
|
876
|
+
<funderName>Swiss National Science Foundation</funderName>
|
877
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">https://doi.org/10.13039/501100001711</funderIdentifier>
|
878
|
+
</fundingReference>
|
879
|
+
<fundingReference>
|
880
|
+
<funderName>University of Lausanne</funderName>
|
881
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">https://doi.org/10.13039/501100006390</funderIdentifier>
|
882
|
+
</fundingReference>
|
883
|
+
</fundingReferences>
|
851
884
|
<dates>
|
852
885
|
<date dateType="Issued">2014-02-11</date>
|
853
886
|
<date dateType="Updated">2015-08-11T05:35:02Z</date>
|
@@ -50,7 +50,7 @@ module Bolognese
|
|
50
50
|
|
51
51
|
# parse nameIdentifier from DataCite
|
52
52
|
def get_name_identifier(author)
|
53
|
-
name_identifier = author.dig("nameIdentifier", "
|
53
|
+
name_identifier = author.dig("nameIdentifier", "__content__")
|
54
54
|
name_identifier = validate_orcid(name_identifier)
|
55
55
|
name_identifier_scheme = author.dig("nameIdentifier", "nameIdentifierScheme") || "ORCID"
|
56
56
|
|
data/lib/bolognese/crossref.rb
CHANGED
@@ -148,6 +148,15 @@ module Bolognese
|
|
148
148
|
end.presence
|
149
149
|
end
|
150
150
|
|
151
|
+
def funder
|
152
|
+
f = Array.wrap(program_metadata).find { |a| a["name"] == "fundref" } || {}
|
153
|
+
Array.wrap(f.fetch("assertion", [])).select { |a| a["name"] == "fundgroup" }.map do |f|
|
154
|
+
{ "@type" => "Organization",
|
155
|
+
"@id" => normalize_id(f.dig("assertion", "assertion", "__content__")),
|
156
|
+
"name" => f.dig("assertion", "__content__").strip }.compact
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
151
160
|
def date_published
|
152
161
|
pub_date = bibliographic_metadata.fetch("publication_date", nil) ||
|
153
162
|
bibliographic_metadata.fetch("acceptance_date", nil)
|
data/lib/bolognese/datacite.rb
CHANGED
@@ -34,13 +34,13 @@ module Bolognese
|
|
34
34
|
alias_method :schema_org, :as_schema_org
|
35
35
|
|
36
36
|
def schema_version
|
37
|
-
@schema_version ||= metadata.fetch("schemaLocation", "").split(" ").first
|
37
|
+
@schema_version ||= metadata.fetch("xsi:schemaLocation", "").split(" ").first
|
38
38
|
end
|
39
39
|
|
40
40
|
# show DataCite XML in different version if schema_version option is provided
|
41
41
|
# currently only supports 4.0
|
42
42
|
def datacite
|
43
|
-
if schema_version != metadata.fetch("schemaLocation", "").split(" ").first
|
43
|
+
if schema_version != metadata.fetch("xsi:schemaLocation", "").split(" ").first
|
44
44
|
as_datacite
|
45
45
|
else
|
46
46
|
raw
|
@@ -56,7 +56,7 @@ module Bolognese
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def doi
|
59
|
-
metadata.fetch("identifier", {}).fetch("
|
59
|
+
metadata.fetch("identifier", {}).fetch("__content__", nil)
|
60
60
|
end
|
61
61
|
|
62
62
|
def id
|
@@ -72,7 +72,7 @@ module Bolognese
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def additional_type
|
75
|
-
metadata.fetch("resourceType", {}).fetch("
|
75
|
+
metadata.fetch("resourceType", {}).fetch("__content__", nil) ||
|
76
76
|
metadata.fetch("resourceType", {}).fetch("resourceTypeGeneral", nil)
|
77
77
|
end
|
78
78
|
|
@@ -81,11 +81,11 @@ module Bolognese
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def alternate_name
|
84
|
-
metadata.dig("alternateIdentifiers", "alternateIdentifier", "
|
84
|
+
metadata.dig("alternateIdentifiers", "alternateIdentifier", "__content__")
|
85
85
|
end
|
86
86
|
|
87
87
|
def description
|
88
|
-
des = metadata.dig("descriptions", "description", "
|
88
|
+
des = metadata.dig("descriptions", "description", "__content__")
|
89
89
|
if des.is_a?(Hash)
|
90
90
|
des.to_xml
|
91
91
|
elsif des.is_a?(String)
|
@@ -113,6 +113,30 @@ module Bolognese
|
|
113
113
|
get_authors(editors).presence
|
114
114
|
end
|
115
115
|
|
116
|
+
def funder
|
117
|
+
f = funder_contributor + funding_reference
|
118
|
+
f.length > 1 ? f : f.first
|
119
|
+
end
|
120
|
+
|
121
|
+
def funder_contributor
|
122
|
+
Array.wrap(metadata.dig("contributors", "contributor")).reduce([]) do |sum, f|
|
123
|
+
if f["contributorType"] == "Funder"
|
124
|
+
sum << { "@type" => "Organization", "name" => f["contributorName"] }
|
125
|
+
else
|
126
|
+
sum
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def funding_reference
|
132
|
+
Array.wrap(metadata.dig("fundingReferences", "fundingReference")).map do |f|
|
133
|
+
funder_id = parse_attribute(f["funderIdentifier"])
|
134
|
+
{ "@type" => "Organization",
|
135
|
+
"@id" => normalize_id(funder_id),
|
136
|
+
"name" => f["funderName"] }.compact
|
137
|
+
end.uniq
|
138
|
+
end
|
139
|
+
|
116
140
|
def version
|
117
141
|
metadata.fetch("version", nil)
|
118
142
|
end
|
@@ -125,7 +149,7 @@ module Bolognese
|
|
125
149
|
|
126
150
|
def date(date_type)
|
127
151
|
dd = dates.find { |d| d["dateType"] == date_type } || {}
|
128
|
-
dd.fetch("
|
152
|
+
dd.fetch("__content__", nil)
|
129
153
|
end
|
130
154
|
|
131
155
|
def date_created
|
@@ -156,9 +180,8 @@ module Bolognese
|
|
156
180
|
Array(metadata.dig("relatedIdentifiers", "relatedIdentifier"))
|
157
181
|
.select { |r| relation_type.split(" ").include?(r["relationType"]) && %w(DOI URL).include?(r["relatedIdentifierType"]) }
|
158
182
|
.map do |work|
|
159
|
-
work_id = work["relatedIdentifierType"] == "DOI" ? normalize_doi(work["text"]) : work["text"]
|
160
183
|
{ "@type" => "CreativeWork",
|
161
|
-
"@id" =>
|
184
|
+
"@id" => normalize_id(work["__content__"]) }
|
162
185
|
end
|
163
186
|
end
|
164
187
|
|
@@ -65,6 +65,7 @@ module Bolognese
|
|
65
65
|
insert_alternate_identifiers(xml)
|
66
66
|
insert_subjects(xml)
|
67
67
|
insert_contributors(xml)
|
68
|
+
insert_funding_references(xml)
|
68
69
|
insert_dates(xml)
|
69
70
|
insert_related_identifiers(xml)
|
70
71
|
insert_version(xml)
|
@@ -127,13 +128,13 @@ module Bolognese
|
|
127
128
|
|
128
129
|
def resource_type
|
129
130
|
{ "resource_type_general" => SO_TO_DC_TRANSLATIONS[type] || "Other",
|
130
|
-
"
|
131
|
+
"__content__" => additional_type || type }
|
131
132
|
end
|
132
133
|
|
133
134
|
def insert_resource_type(xml)
|
134
135
|
return xml unless type.present?
|
135
136
|
|
136
|
-
xml.resourceType(resource_type["
|
137
|
+
xml.resourceType(resource_type["__content__"],
|
137
138
|
'resourceTypeGeneral' => resource_type["resource_type_general"])
|
138
139
|
end
|
139
140
|
|
@@ -157,6 +158,23 @@ module Bolognese
|
|
157
158
|
xml.date(date, 'dateType' => date_type)
|
158
159
|
end
|
159
160
|
|
161
|
+
def insert_funding_references(xml)
|
162
|
+
return xml unless Array.wrap(funder).present?
|
163
|
+
|
164
|
+
xml.fundingReferences do
|
165
|
+
Array.wrap(funder).each do |funding_reference|
|
166
|
+
xml.fundingReference do
|
167
|
+
insert_funding_reference(xml, funding_reference)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def insert_funding_reference(xml, funding_reference)
|
174
|
+
xml.funderName(funding_reference["name"]) if funding_reference["name"].present?
|
175
|
+
xml.funderIdentifier(funding_reference["@id"], "funderIdentifierType" => "Crossref Funder ID") if funding_reference["@id"].present?
|
176
|
+
end
|
177
|
+
|
160
178
|
def insert_subjects(xml)
|
161
179
|
return xml unless keywords.present?
|
162
180
|
|
@@ -181,7 +199,7 @@ module Bolognese
|
|
181
199
|
|
182
200
|
def rel_identifier(rel_ids: nil, relation_type: nil)
|
183
201
|
Array.wrap(rel_ids).map do |i|
|
184
|
-
{ "
|
202
|
+
{ "__content__" => i["@id"],
|
185
203
|
"related_identifier_type" => validate_url(i["@id"]),
|
186
204
|
"relation_type" => relation_type }
|
187
205
|
end.select { |i| i["related_identifier_type"].present? }
|
@@ -192,7 +210,7 @@ module Bolognese
|
|
192
210
|
|
193
211
|
xml.relatedIdentifiers do
|
194
212
|
rel_identifiers.each do |related_identifier|
|
195
|
-
xml.relatedIdentifier(related_identifier["
|
213
|
+
xml.relatedIdentifier(related_identifier["__content__"], 'relatedIdentifierType' => related_identifier["related_identifier_type"], 'relationType' => related_identifier["relation_type"])
|
196
214
|
end
|
197
215
|
end
|
198
216
|
end
|
data/lib/bolognese/metadata.rb
CHANGED
@@ -68,6 +68,10 @@ module Bolognese
|
|
68
68
|
|
69
69
|
end
|
70
70
|
|
71
|
+
def funder
|
72
|
+
|
73
|
+
end
|
74
|
+
|
71
75
|
def as_schema_org
|
72
76
|
{ "@context" => "http://schema.org",
|
73
77
|
"@type" => type,
|
@@ -95,6 +99,7 @@ module Bolognese
|
|
95
99
|
"citation" => citation,
|
96
100
|
"schemaVersion" => schema_version,
|
97
101
|
"publisher" => publisher,
|
102
|
+
"funder" => funder,
|
98
103
|
"provider" => provider
|
99
104
|
}.compact.to_json
|
100
105
|
end
|
data/lib/bolognese/utils.rb
CHANGED
@@ -24,9 +24,9 @@ module Bolognese
|
|
24
24
|
if element.is_a?(String)
|
25
25
|
element
|
26
26
|
elsif element.is_a?(Hash)
|
27
|
-
element.fetch("
|
27
|
+
element.fetch("__content__", nil)
|
28
28
|
elsif element.is_a?(Array)
|
29
|
-
element.map { |e| e.fetch("
|
29
|
+
element.map { |e| e.fetch("__content__", nil) }
|
30
30
|
else
|
31
31
|
nil
|
32
32
|
end
|
@@ -36,9 +36,9 @@ module Bolognese
|
|
36
36
|
if element.is_a?(String)
|
37
37
|
element
|
38
38
|
elsif element.is_a?(Hash)
|
39
|
-
element.fetch("
|
39
|
+
element.fetch("__content__", nil)
|
40
40
|
elsif element.is_a?(Array)
|
41
|
-
element.first.fetch("
|
41
|
+
element.first.fetch("__content__", nil)
|
42
42
|
else
|
43
43
|
nil
|
44
44
|
end
|
data/lib/bolognese/version.rb
CHANGED
data/spec/crossref_spec.rb
CHANGED
@@ -24,6 +24,16 @@ describe Bolognese::Crossref, vcr: true do
|
|
24
24
|
expect(subject.is_part_of).to eq("@type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
25
25
|
expect(subject.citation.count).to eq(27)
|
26
26
|
expect(subject.citation[21]).to eq("@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5061/dryad.b835k", "position"=>"22", "datePublished"=>"2014")
|
27
|
+
expect(subject.funder).to eq([{"@type"=>"Organization", "name"=>"SystemsX"},
|
28
|
+
{"@type"=>"Organization",
|
29
|
+
"@id"=>"https://doi.org/10.13039/501100003043",
|
30
|
+
"name"=>"EMBO"},
|
31
|
+
{"@type"=>"Organization",
|
32
|
+
"@id"=>"https://doi.org/10.13039/501100001711",
|
33
|
+
"name"=>"Swiss National Science Foundation"},
|
34
|
+
{"@type"=>"Organization",
|
35
|
+
"@id"=>"https://doi.org/10.13039/501100006390",
|
36
|
+
"name"=>"University of Lausanne"}])
|
27
37
|
expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
|
28
38
|
end
|
29
39
|
|
@@ -188,6 +198,8 @@ describe Bolognese::Crossref, vcr: true do
|
|
188
198
|
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
189
199
|
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
190
200
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(25)
|
201
|
+
expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
|
202
|
+
expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier"=>{"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
|
191
203
|
end
|
192
204
|
|
193
205
|
it "with ORCID ID" do
|
data/spec/datacite_spec.rb
CHANGED
@@ -68,6 +68,44 @@ describe Bolognese::Datacite, vcr: true do
|
|
68
68
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.1")
|
69
69
|
end
|
70
70
|
|
71
|
+
it "Funding schema version 3" do
|
72
|
+
id = "https://doi.org/10.5281/ZENODO.1239"
|
73
|
+
subject = Bolognese::Datacite.new(id: id)
|
74
|
+
expect(subject.id).to eq("https://doi.org/10.5281/zenodo.1239")
|
75
|
+
expect(subject.type).to eq("Dataset")
|
76
|
+
expect(subject.additional_type).to eq("Dataset")
|
77
|
+
expect(subject.resource_type_general).to eq("Dataset")
|
78
|
+
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Najko", "familyName"=>"Jahn"},
|
79
|
+
{"@type"=>"Person", "givenName"=>"Martin", "familyName"=>"Fenner"},
|
80
|
+
{"@type"=>"Person", "givenName"=>"Harry", "familyName"=>"Dimitropoulos"},
|
81
|
+
{"@type"=>"Person", "givenName"=>"Jochen", "familyName"=>"Schirrwagen"}])
|
82
|
+
expect(subject.name).to eq("Publication FP7 Funding Acknowledgment - PLOS OpenAIRE")
|
83
|
+
expect(subject.description).to start_with("The dataset contains a sample of metadata describing papers")
|
84
|
+
expect(subject.date_published).to eq("2013-04-03")
|
85
|
+
expect(subject.publisher).to eq("@type"=>"Organization", "name"=>"OpenAIRE Orphan Record Repository")
|
86
|
+
expect(subject.funder).to eq("@type"=>"Organization", "name"=>"European Commission")
|
87
|
+
expect(subject.provider).to eq("@type"=>"Organization", "name"=>"DataCite")
|
88
|
+
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "Funding schema version 4" do
|
92
|
+
id = "https://doi.org/10.5438/6423"
|
93
|
+
subject = Bolognese::Datacite.new(id: id)
|
94
|
+
expect(subject.id).to eq("https://doi.org/10.5438/6423")
|
95
|
+
expect(subject.type).to eq("Collection")
|
96
|
+
expect(subject.additional_type).to eq("Project")
|
97
|
+
expect(subject.resource_type_general).to eq("Collection")
|
98
|
+
expect(subject.author.length).to eq(24)
|
99
|
+
expect(subject.author.first).to eq("@type"=>"Person", "@id"=>"http://orcid.org/0000-0001-5331-6592", "givenName"=>"Adam", "familyName"=>"Farquhar")
|
100
|
+
expect(subject.name).to eq("Technical and Human Infrastructure for Open Research (THOR)")
|
101
|
+
expect(subject.description).to start_with("<p>Five years ago, a global infrastructure")
|
102
|
+
expect(subject.date_published).to eq("2015")
|
103
|
+
expect(subject.publisher).to eq("@type"=>"Organization", "name"=>"DataCite")
|
104
|
+
expect(subject.funder).to eq("@type"=>"Organization", "@id"=>"https://doi.org/10.13039/501100000780", "name"=>"European Commission")
|
105
|
+
expect(subject.provider).to eq("@type"=>"Organization", "name"=>"DataCite")
|
106
|
+
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
|
107
|
+
end
|
108
|
+
|
71
109
|
it "Schema.org JSON" do
|
72
110
|
json = JSON.parse(subject.as_schema_org)
|
73
111
|
expect(json["@id"]).to eq("https://doi.org/10.5061/dryad.8515")
|
@@ -131,7 +169,17 @@ describe Bolognese::Datacite, vcr: true do
|
|
131
169
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
|
132
170
|
|
133
171
|
datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
|
134
|
-
expect(datacite.fetch("schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
|
172
|
+
expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "Funding" do
|
176
|
+
id = "https://doi.org/10.5438/6423"
|
177
|
+
subject = Bolognese::Datacite.new(id: id, schema_version: "http://datacite.org/schema/kernel-4")
|
178
|
+
expect(subject.id).to eq("https://doi.org/10.5438/6423")
|
179
|
+
|
180
|
+
datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
|
181
|
+
expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
|
182
|
+
expect(datacite.fetch("fundingReferences")).to eq("fundingReference"=>{"funderName"=>"European Commission", "funderIdentifier"=>{"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100000780"}})
|
135
183
|
end
|
136
184
|
end
|
137
185
|
end
|
data/spec/datacite_utils_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Bolognese::Datacite, vcr: true do
|
|
9
9
|
it "doi" do
|
10
10
|
xml = Nokogiri::XML::Builder.new { |xml| subject.insert_identifier(xml) }.to_xml
|
11
11
|
response = Maremma.from_xml(xml)
|
12
|
-
expect(response["identifier"]).to eq("identifierType"=>"DOI", "
|
12
|
+
expect(response["identifier"]).to eq("identifierType"=>"DOI", "__content__"=>"10.5061/DRYAD.8515")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -75,7 +75,7 @@ describe Bolognese::Datacite, vcr: true do
|
|
75
75
|
it "insert" do
|
76
76
|
xml = Nokogiri::XML::Builder.new { |xml| subject.insert_resource_type(xml) }.to_xml
|
77
77
|
response = Maremma.from_xml(xml)
|
78
|
-
expect(response["resourceType"]).to eq("resourceTypeGeneral"=>"Dataset", "
|
78
|
+
expect(response["resourceType"]).to eq("resourceTypeGeneral"=>"Dataset", "__content__"=>"DataPackage")
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -83,7 +83,7 @@ describe Bolognese::Datacite, vcr: true do
|
|
83
83
|
it "insert" do
|
84
84
|
xml = Nokogiri::XML::Builder.new { |xml| subject.insert_alternate_identifiers(xml) }.to_xml
|
85
85
|
response = Maremma.from_xml(xml)
|
86
|
-
expect(response.dig("alternateIdentifiers", "alternateIdentifier")).to eq("alternateIdentifierType"=>"Local accession number", "
|
86
|
+
expect(response.dig("alternateIdentifiers", "alternateIdentifier")).to eq("alternateIdentifierType"=>"Local accession number", "__content__"=>"Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -91,7 +91,7 @@ describe Bolognese::Datacite, vcr: true do
|
|
91
91
|
it "insert" do
|
92
92
|
xml = Nokogiri::XML::Builder.new { |xml| subject.insert_dates(xml) }.to_xml
|
93
93
|
response = Maremma.from_xml(xml)
|
94
|
-
expect(response.dig("dates", "date")).to eq("dateType"=>"Issued", "
|
94
|
+
expect(response.dig("dates", "date")).to eq("dateType"=>"Issued", "__content__"=>"2011")
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -113,13 +113,13 @@ describe Bolognese::Datacite, vcr: true do
|
|
113
113
|
|
114
114
|
context "insert_related_identifiers" do
|
115
115
|
it "rel_identifiers" do
|
116
|
-
expect(subject.rel_identifiers).to eq([{"
|
116
|
+
expect(subject.rel_identifiers).to eq([{"__content__"=>"https://doi.org/10.5061/dryad.8515/1",
|
117
117
|
"related_identifier_type"=>"DOI",
|
118
118
|
"relation_type"=>"HasPart"},
|
119
|
-
{"
|
119
|
+
{"__content__"=>"https://doi.org/10.5061/dryad.8515/2",
|
120
120
|
"related_identifier_type"=>"DOI",
|
121
121
|
"relation_type"=>"HasPart"},
|
122
|
-
{"
|
122
|
+
{"__content__"=>"https://doi.org/10.1371/journal.ppat.1000446",
|
123
123
|
"related_identifier_type"=>"DOI",
|
124
124
|
"relation_type"=>"References"}])
|
125
125
|
end
|
@@ -129,13 +129,13 @@ describe Bolognese::Datacite, vcr: true do
|
|
129
129
|
response = Maremma.from_xml(xml)
|
130
130
|
expect(response.dig("relatedIdentifiers", "relatedIdentifier")).to eq([{"relatedIdentifierType"=>"DOI",
|
131
131
|
"relationType"=>"HasPart",
|
132
|
-
"
|
132
|
+
"__content__"=>"https://doi.org/10.5061/dryad.8515/1"},
|
133
133
|
{"relatedIdentifierType"=>"DOI",
|
134
134
|
"relationType"=>"HasPart",
|
135
|
-
"
|
135
|
+
"__content__"=>"https://doi.org/10.5061/dryad.8515/2"},
|
136
136
|
{"relatedIdentifierType"=>"DOI",
|
137
137
|
"relationType"=>"References",
|
138
|
-
"
|
138
|
+
"__content__"=>"https://doi.org/10.1371/journal.ppat.1000446"}])
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -143,7 +143,7 @@ describe Bolognese::Datacite, vcr: true do
|
|
143
143
|
it "insert" do
|
144
144
|
xml = Nokogiri::XML::Builder.new { |xml| subject.insert_rights_list(xml) }.to_xml
|
145
145
|
response = Maremma.from_xml(xml)
|
146
|
-
expect(response.dig("rightsList", "rights")).to eq("rightsURI"=>"http://creativecommons.org/publicdomain/zero/1.0/", "
|
146
|
+
expect(response.dig("rightsList", "rights")).to eq("rightsURI"=>"http://creativecommons.org/publicdomain/zero/1.0/", "__content__"=>"Public Domain (CC0 1.0)")
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -153,7 +153,7 @@ describe Bolognese::Datacite, vcr: true do
|
|
153
153
|
subject = Bolognese::Datacite.new(id: id)
|
154
154
|
xml = Nokogiri::XML::Builder.new { |xml| subject.insert_descriptions(xml) }.to_xml
|
155
155
|
response = Maremma.from_xml(xml)
|
156
|
-
expect(response.dig("descriptions", "description")).to eq("descriptionType" => "Abstract", "
|
156
|
+
expect(response.dig("descriptions", "description")).to eq("descriptionType" => "Abstract", "__content__" => "Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...")
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|