bolognese 0.9.11 → 0.9.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/datacite_utils.rb +4 -2
- data/lib/bolognese/metadata.rb +1 -1
- data/lib/bolognese/readers/bibtex_reader.rb +1 -1
- data/lib/bolognese/readers/citeproc_reader.rb +1 -1
- data/lib/bolognese/readers/crossref_reader.rb +3 -2
- data/lib/bolognese/readers/ris_reader.rb +1 -1
- data/lib/bolognese/readers/schema_org_reader.rb +5 -7
- data/lib/bolognese/utils.rb +1 -1
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/schema_org_writer.rb +1 -1
- data/spec/datacite_utils_spec.rb +3 -0
- data/spec/readers/bibtex_reader_spec.rb +1 -1
- data/spec/readers/citeproc_reader_spec.rb +1 -1
- data/spec/readers/crossref_reader_spec.rb +5 -5
- data/spec/readers/ris_reader_spec.rb +1 -1
- data/spec/readers/schema_org_reader_spec.rb +2 -2
- data/spec/writers/datacite_writer_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaee569568f76b04f3c5707cb20c7c3b91b5c42b
|
4
|
+
data.tar.gz: d267f2d4b97689676b9986b698ea47b628ad07d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a881f202c52634a6e3e0d8d5fc033b337a507fe6755104e6602631407772add424670d12fde54e406e15941a4a9fb3cc63640f0bce16f180fba6b28501ff31
|
7
|
+
data.tar.gz: 9b91e62983d77e603a29cd9d458fbc95adddcaa18f27792397b1eca213daea240beab70511aed08a3d8258d2c8ed2a30536d9103963ebb1e8bd98e0b911c2680
|
data/Gemfile.lock
CHANGED
@@ -167,7 +167,8 @@ module Bolognese
|
|
167
167
|
{ "__content__" => r["id"] || r["issn"],
|
168
168
|
"related_identifier_type" => r["issn"].present? ? "ISSN" : validate_url(r["id"]),
|
169
169
|
"relation_type" => r["relationType"],
|
170
|
-
"resource_type_general" => r["resourceTypeGeneral"]
|
170
|
+
"resource_type_general" => r["resourceTypeGeneral"] || "Other",
|
171
|
+
"title" => r["title"] }.compact
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
@@ -179,7 +180,8 @@ module Bolognese
|
|
179
180
|
attributes = {
|
180
181
|
'relatedIdentifierType' => related_identifier["related_identifier_type"],
|
181
182
|
'relationType' => related_identifier["relation_type"],
|
182
|
-
'resourceTypeGeneral' => related_identifier["resource_type_general"]
|
183
|
+
'resourceTypeGeneral' => related_identifier["resource_type_general"],
|
184
|
+
'title' => related_identifier["title"] }.compact
|
183
185
|
xml.relatedIdentifier(related_identifier["__content__"], attributes)
|
184
186
|
end
|
185
187
|
end
|
data/lib/bolognese/metadata.rb
CHANGED
@@ -38,7 +38,7 @@ module Bolognese
|
|
38
38
|
container_title = meta.fetch("container-title", nil)
|
39
39
|
is_part_of = if container_title.present?
|
40
40
|
{ "type" => "Periodical",
|
41
|
-
"
|
41
|
+
"title" => container_title,
|
42
42
|
"issn" => meta.fetch("ISSN", nil) }.compact
|
43
43
|
else
|
44
44
|
nil
|
@@ -190,7 +190,7 @@ module Bolognese
|
|
190
190
|
def crossref_is_part_of(journal_metadata)
|
191
191
|
if journal_metadata.present?
|
192
192
|
{ "type" => "Periodical",
|
193
|
-
"
|
193
|
+
"title" => journal_metadata["full_title"],
|
194
194
|
"issn" => parse_attributes(journal_metadata.fetch("issn", nil)) }.compact
|
195
195
|
else
|
196
196
|
nil
|
@@ -201,7 +201,8 @@ module Bolognese
|
|
201
201
|
refs = bibliographic_metadata.dig("citation_list", "citation")
|
202
202
|
Array.wrap(refs).select { |a| a["doi"].present? }.map do |c|
|
203
203
|
{ "id" => normalize_id(c["doi"]),
|
204
|
-
"type" => "CreativeWork"
|
204
|
+
"type" => "CreativeWork",
|
205
|
+
"title" => c["article_title"] }.compact
|
205
206
|
end.unwrap
|
206
207
|
end
|
207
208
|
end
|
@@ -21,12 +21,11 @@ module Bolognese
|
|
21
21
|
resource_type_general = Bolognese::Utils::SO_TO_DC_TRANSLATIONS[type]
|
22
22
|
author = get_authors(from_schema_org(Array.wrap(meta.fetch("author", nil))))
|
23
23
|
editor = get_authors(from_schema_org(Array.wrap(meta.fetch("editor", nil))))
|
24
|
-
publisher = meta.dig("publisher"
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
24
|
+
publisher = if meta.dig("publisher").is_a?(Hash)
|
25
|
+
meta.dig("publisher", "name")
|
26
|
+
elsif publisher.is_a?(String)
|
27
|
+
meta.dig("publisher")
|
28
|
+
end
|
30
29
|
date_published = meta.fetch("datePublished", nil)
|
31
30
|
|
32
31
|
{ "id" => id,
|
@@ -41,7 +40,6 @@ module Bolognese
|
|
41
40
|
"title" => meta.fetch("name", nil),
|
42
41
|
"alternate_name" => meta.fetch("alternateName", nil),
|
43
42
|
"author" => author,
|
44
|
-
"container_title" => container_title,
|
45
43
|
"publisher" => meta.dig("publisher", "name"),
|
46
44
|
"provider" => meta.fetch("provider", nil),
|
47
45
|
"is_identical_to" => schema_org_is_identical_to(meta),
|
data/lib/bolognese/utils.rb
CHANGED
@@ -321,7 +321,7 @@ module Bolognese
|
|
321
321
|
Array.wrap(ids).map do |id|
|
322
322
|
{ "id" => normalize_id(id["@id"]),
|
323
323
|
"type" => id["@type"] || Metadata::DC_TO_SO_TRANSLATIONS[id["resourceTypeGeneral"]] || "CreativeWork",
|
324
|
-
"
|
324
|
+
"title" => id["title"] || id["name"] }.compact
|
325
325
|
end.unwrap
|
326
326
|
end
|
327
327
|
|
data/lib/bolognese/version.rb
CHANGED
@@ -24,7 +24,7 @@ module Bolognese
|
|
24
24
|
"pagination" => pagination,
|
25
25
|
"spatialCoverage" => spatial_coverage,
|
26
26
|
"sameAs" => same_as,
|
27
|
-
"isPartOf" => is_part_of,
|
27
|
+
"isPartOf" => is_part_of.present? ? is_part_of.merge("name" => is_part_of["title"]) : nil,
|
28
28
|
"hasPart" => has_part,
|
29
29
|
"predecessor_of" => is_previous_version_of,
|
30
30
|
"successor_of" => is_new_version_of,
|
data/spec/datacite_utils_spec.rb
CHANGED
@@ -123,12 +123,15 @@ describe Bolognese::Metadata, vcr: true do
|
|
123
123
|
response = Maremma.from_xml(xml)
|
124
124
|
expect(response.dig("relatedIdentifiers", "relatedIdentifier")).to eq([{"relatedIdentifierType"=>"DOI",
|
125
125
|
"relationType"=>"HasPart",
|
126
|
+
"resourceTypeGeneral"=>"Other",
|
126
127
|
"__content__"=>"https://doi.org/10.5061/dryad.8515/1"},
|
127
128
|
{"relatedIdentifierType"=>"DOI",
|
128
129
|
"relationType"=>"HasPart",
|
130
|
+
"resourceTypeGeneral"=>"Other",
|
129
131
|
"__content__"=>"https://doi.org/10.5061/dryad.8515/2"},
|
130
132
|
{"relatedIdentifierType"=>"DOI",
|
131
133
|
"relationType"=>"IsReferencedBy",
|
134
|
+
"resourceTypeGeneral"=>"Other",
|
132
135
|
"__content__"=>"https://doi.org/10.1371/journal.ppat.1000446"}])
|
133
136
|
end
|
134
137
|
end
|
@@ -24,7 +24,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
24
24
|
expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
25
25
|
expect(subject.license["id"]).to eq("http://creativecommons.org/licenses/by/3.0/")
|
26
26
|
expect(subject.date_published).to eq("2014")
|
27
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
27
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife", "issn"=>"2050-084X")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -22,7 +22,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
22
22
|
expect(subject.title).to eq("Eating your own Dog Food")
|
23
23
|
expect(subject.description["text"]).to start_with("Eating your own dog food")
|
24
24
|
expect(subject.date_published).to eq("2016-12-20")
|
25
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
25
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"DataCite Blog")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -26,7 +26,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
26
26
|
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
27
27
|
expect(subject.date_published).to eq("2014-02-11")
|
28
28
|
expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
|
29
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
29
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife", "issn"=>"2050-084X")
|
30
30
|
expect(subject.references.count).to eq(25)
|
31
31
|
expect(subject.references[19]).to eq("id"=>"https://doi.org/10.5061/dryad.b835k", "type"=>"CreativeWork")
|
32
32
|
expect(subject.funder).to eq([{"name"=>"SystemsX"},
|
@@ -55,7 +55,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
55
55
|
expect(subject.date_published).to eq("2006-12-20")
|
56
56
|
expect(subject.date_modified).to eq("2016-12-31T21:37:08Z")
|
57
57
|
expect(subject.pagination).to eq("e30")
|
58
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
58
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"PLoS ONE", "issn"=>"1932-6203")
|
59
59
|
expect(subject.provider).to eq("Crossref")
|
60
60
|
end
|
61
61
|
|
@@ -92,7 +92,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
92
92
|
expect(subject.date_published).to eq("2006-11")
|
93
93
|
expect(subject.date_modified).to eq("2017-04-01T00:47:57Z")
|
94
94
|
expect(subject.pagination).to eq("2832-2841")
|
95
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
95
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"Ecology", "issn"=>"0012-9658")
|
96
96
|
expect(subject.provider).to eq("Crossref")
|
97
97
|
end
|
98
98
|
|
@@ -111,7 +111,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
111
111
|
expect(subject.date_published).to eq("2012")
|
112
112
|
expect(subject.date_modified).to eq("2016-08-02T12:42:41Z")
|
113
113
|
expect(subject.pagination).to eq("1-7")
|
114
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
114
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"Pulmonary Medicine", "issn"=>["2090-1836", "2090-1844"])
|
115
115
|
expect(subject.provider).to eq("Crossref")
|
116
116
|
end
|
117
117
|
|
@@ -128,7 +128,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
128
128
|
expect(subject.title).to eq("Paving the path to HIV neurotherapy: Predicting SIV CNS disease")
|
129
129
|
expect(subject.date_published).to eq("2015-07")
|
130
130
|
expect(subject.date_modified).to eq("2016-08-20T02:19:38Z")
|
131
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
131
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"European Journal of Pharmacology", "issn"=>"00142999")
|
132
132
|
expect(subject.provider).to eq("Crossref")
|
133
133
|
end
|
134
134
|
|
@@ -26,7 +26,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
26
26
|
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
27
27
|
expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
28
28
|
expect(subject.date_published).to eq("2014")
|
29
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "
|
29
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -27,7 +27,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
27
27
|
expect(subject.keywords).to eq("datacite, doi, metadata, featured")
|
28
28
|
expect(subject.date_published).to eq("2016-12-20")
|
29
29
|
expect(subject.date_modified).to eq("2016-12-20")
|
30
|
-
expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "
|
30
|
+
expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "title"=>"DataCite Blog")
|
31
31
|
expect(subject.references).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
|
32
32
|
expect(subject.publisher).to eq("DataCite")
|
33
33
|
end
|
@@ -55,7 +55,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
55
55
|
expect(subject.keywords).to eq("datacite, doi, metadata, featured")
|
56
56
|
expect(subject.date_published).to eq("2016-12-20")
|
57
57
|
expect(subject.date_modified).to eq("2016-12-20")
|
58
|
-
expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "
|
58
|
+
expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "title"=>"DataCite Blog")
|
59
59
|
expect(subject.references).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
|
60
60
|
expect(subject.publisher).to eq("DataCite")
|
61
61
|
end
|
@@ -9,8 +9,8 @@ describe Bolognese::Metadata, vcr: true do
|
|
9
9
|
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
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(26)
|
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__"=>"https://doi.org/10.1038/nature02100")
|
12
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral" => "Other", "title"=>"eLife", "__content__"=>"2050-084X")
|
13
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "resourceTypeGeneral" => "Other", "__content__"=>"https://doi.org/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"})
|
@@ -119,7 +119,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
119
119
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
120
120
|
expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food")
|
121
121
|
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(3)
|
122
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"https://doi.org/10.5438/0000-00ss")
|
122
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "title" => "DataCite Blog", "resourceTypeGeneral" => "Other", "__content__"=>"https://doi.org/10.5438/0000-00ss")
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|