bolognese 0.7.2 → 0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/README.md +25 -16
- data/bolognese.gemspec +2 -1
- data/codemeta.json +39 -0
- data/lib/bolognese.rb +4 -0
- data/lib/bolognese/array.rb +11 -0
- data/lib/bolognese/author_utils.rb +35 -21
- data/lib/bolognese/bibtex.rb +4 -4
- data/lib/bolognese/codemeta.rb +8 -13
- data/lib/bolognese/crossref.rb +22 -20
- data/lib/bolognese/datacite.rb +61 -61
- data/lib/bolognese/datacite_json.rb +208 -0
- data/lib/bolognese/datacite_utils.rb +17 -48
- data/lib/bolognese/metadata.rb +83 -22
- data/lib/bolognese/schema_org.rb +42 -16
- data/lib/bolognese/utils.rb +79 -13
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/whitelist_scrubber.rb +45 -0
- data/spec/array_spec.rb +20 -0
- data/spec/author_utils_spec.rb +93 -9
- data/spec/bibtex_spec.rb +4 -4
- data/spec/cli_spec.rb +5 -0
- data/spec/codemeta_spec.rb +41 -31
- data/spec/crossref_spec.rb +47 -72
- data/spec/datacite_json_spec.rb +65 -0
- data/spec/datacite_spec.rb +67 -83
- data/spec/datacite_utils_spec.rb +9 -14
- data/spec/fixtures/datacite.json +49 -0
- data/spec/fixtures/datacite_software.json +18 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite_json.yml +214 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/author_from_schema_org/with_id.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/author_to_schema_org/with_id.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/authors_as_string/author.yml +137 -860
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/authors_as_string/no_author.yml +137 -860
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/authors_as_string/single_author.yml +137 -860
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/authors_as_string/with_organization.yml +137 -860
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/from_schema_org/with_id.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_name_identifier/has_ORCID.yml +155 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_name_identifier/has_no_ORCID.yml +134 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_familyName.yml +155 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_name_in_display-order.yml +186 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_name_in_display-order_with_ORCID.yml +177 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_name_in_sort-order.yml +173 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/is_organization.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/is_personal_name_/has_comma.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/is_personal_name_/has_family_name.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/is_personal_name_/has_id.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/is_personal_name_/has_no_info.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/is_personal_name_/has_type_organization.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/is_personal_name_/has_type_person.yml +207 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/sanitize/should_only_keep_specific_tags.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/sanitize/should_remove_a_tags.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/to_schema_org/with_id.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/related_identifier.yml +173 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_DataciteJson/get_metadata_as_bibtex/BlogPosting.yml +155 -0
- data/spec/schema_org_spec.rb +17 -14
- data/spec/utils_spec.rb +32 -2
- metadata +54 -4
data/spec/array_spec.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Array do
|
|
4
|
+
describe "unwrap" do
|
|
5
|
+
it "to array" do
|
|
6
|
+
arr = [1, 2, 3]
|
|
7
|
+
expect(arr.unwrap).to eq(arr)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "to integer" do
|
|
11
|
+
arr = [1]
|
|
12
|
+
expect(arr.unwrap).to eq(1)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "to nil" do
|
|
16
|
+
arr = []
|
|
17
|
+
expect(arr.unwrap).to be_nil
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/spec/author_utils_spec.rb
CHANGED
|
@@ -1,29 +1,113 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Bolognese::Crossref, vcr: true do
|
|
4
|
-
let(:id) { "https://doi.org/10.
|
|
4
|
+
let(:id) { "https://doi.org/10.1101/097196" }
|
|
5
5
|
|
|
6
6
|
subject { Bolognese::Crossref.new(id: id) }
|
|
7
7
|
|
|
8
|
+
context "is_personal_name?" do
|
|
9
|
+
it "has type person" do
|
|
10
|
+
author = {"type"=>"Person", "name"=>"Martin Fenner" }
|
|
11
|
+
expect(subject.is_personal_name?(author)).to be true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "has type organization" do
|
|
15
|
+
author = {"email"=>"info@ucop.edu", "name"=>"University of California, Santa Barbara", "role"=>{"namespace"=>"http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode", "roleCode"=>"copyrightHolder"}, "type"=>"organization" }
|
|
16
|
+
expect(subject.is_personal_name?(author)).to be false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "has id" do
|
|
20
|
+
author = {"id"=>"http://orcid.org/0000-0003-1419-2405", "givenName"=>"Martin", "familyName"=>"Fenner", "name"=>"Martin Fenner" }
|
|
21
|
+
expect(subject.is_personal_name?(author)).to be true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "has family name" do
|
|
25
|
+
author = {"givenName"=>"Martin", "familyName"=>"Fenner", "name"=>"Martin Fenner" }
|
|
26
|
+
expect(subject.is_personal_name?(author)).to be true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "has comma" do
|
|
30
|
+
author = {"name"=>"Fenner, Martin" }
|
|
31
|
+
expect(subject.is_personal_name?(author)).to be true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "has no info" do
|
|
35
|
+
author = {"name"=>"Martin Fenner" }
|
|
36
|
+
expect(subject.is_personal_name?(author)).to be false
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context "get_one_author" do
|
|
41
|
+
it "has familyName" do
|
|
42
|
+
id = "https://doi.org/10.5438/4K3M-NYVG"
|
|
43
|
+
subject = Bolognese::Datacite.new(id: id)
|
|
44
|
+
response = subject.get_one_author(subject.metadata.dig("creators", "creator"))
|
|
45
|
+
expect(response).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-1419-2405", "name"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "has name in sort-order" do
|
|
49
|
+
id = "https://doi.org/10.5061/dryad.8515"
|
|
50
|
+
subject = Bolognese::Datacite.new(id: id)
|
|
51
|
+
response = subject.get_one_author(subject.metadata.dig("creators", "creator").first)
|
|
52
|
+
expect(response).to eq("type"=>"Person", "name"=>"Benjamin Ollomo", "givenName"=>"Benjamin", "familyName"=>"Ollomo")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "has name in display-order" do
|
|
56
|
+
id = "https://doi.org/10.5281/ZENODO.48440"
|
|
57
|
+
subject = Bolognese::Datacite.new(id: id)
|
|
58
|
+
response = subject.get_one_author(subject.metadata.dig("creators", "creator"))
|
|
59
|
+
expect(response).to eq("type"=>"Person", "name"=>"Kristian Garza", "givenName"=>"Kristian", "familyName"=>"Garza")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "has name in display-order with ORCID" do
|
|
63
|
+
id = "https://doi.org/10.6084/M9.FIGSHARE.4700788"
|
|
64
|
+
subject = Bolognese::Datacite.new(id: id)
|
|
65
|
+
response = subject.get_one_author(subject.metadata.dig("creators", "creator"))
|
|
66
|
+
expect(response).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-4881-1606", "name"=>"Andrea Bedini", "givenName"=>"Andrea", "familyName"=>"Bedini")
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "is organization" do
|
|
70
|
+
author = {"email"=>"info@ucop.edu", "name"=>"University of California, Santa Barbara", "role"=>{"namespace"=>"http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode", "roleCode"=>"copyrightHolder"}, "type"=>"organization" }
|
|
71
|
+
response = subject.get_one_author(author)
|
|
72
|
+
expect(response).to eq("type"=>"Organization", "name"=>"University Of California, Santa Barbara")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
context "get_name_identifier" do
|
|
77
|
+
it "has ORCID" do
|
|
78
|
+
id = "https://doi.org/10.5438/4K3M-NYVG"
|
|
79
|
+
subject = Bolognese::Datacite.new(id: id)
|
|
80
|
+
response = subject.get_name_identifier(subject.metadata.dig("creators", "creator"))
|
|
81
|
+
expect(response).to eq("http://orcid.org/0000-0003-1419-2405")
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "has no ORCID" do
|
|
85
|
+
id = "https://doi.org/10.4230/lipics.tqc.2013.93"
|
|
86
|
+
subject = Bolognese::Datacite.new(id: id)
|
|
87
|
+
response = subject.get_name_identifier(subject.metadata.dig("creators", "creator"))
|
|
88
|
+
expect(response).to be_nil
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
8
92
|
context "authors_as_string" do
|
|
9
|
-
let(:author_with_organization) { [{"
|
|
10
|
-
"
|
|
93
|
+
let(:author_with_organization) { [{"type"=>"Person",
|
|
94
|
+
"id"=>"http://orcid.org/0000-0003-0077-4738",
|
|
11
95
|
"name"=>"Matt Jones"},
|
|
12
|
-
{"
|
|
13
|
-
"
|
|
96
|
+
{"type"=>"Person",
|
|
97
|
+
"id"=>"http://orcid.org/0000-0002-2192-403X",
|
|
14
98
|
"name"=>"Peter Slaughter"},
|
|
15
|
-
{"
|
|
16
|
-
"
|
|
99
|
+
{"type"=>"Organization",
|
|
100
|
+
"id"=>"http://orcid.org/0000-0002-3957-2474",
|
|
17
101
|
"name"=>"University of California, Santa Barbara"}] }
|
|
18
102
|
|
|
19
103
|
it "author" do
|
|
20
104
|
response = subject.authors_as_string(subject.author)
|
|
21
|
-
expect(response).to eq("
|
|
105
|
+
expect(response).to eq("Fenner, Martin and Crosas, Mercè and Grethe, Jeffrey and Kennedy, David and Hermjakob, Henning and Rocca-Serra, Philippe and Berjon, Robin and Karcher, Sebastian and Martone, Maryann and Clark, Timothy")
|
|
22
106
|
end
|
|
23
107
|
|
|
24
108
|
it "single author" do
|
|
25
109
|
response = subject.authors_as_string(subject.author.first)
|
|
26
|
-
expect(response).to eq("
|
|
110
|
+
expect(response).to eq("Fenner, Martin")
|
|
27
111
|
end
|
|
28
112
|
|
|
29
113
|
it "no author" do
|
data/spec/bibtex_spec.rb
CHANGED
|
@@ -16,11 +16,11 @@ describe Bolognese::Bibtex, vcr: true do
|
|
|
16
16
|
{"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
|
|
17
17
|
{"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
|
|
18
18
|
{"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
|
|
19
|
-
expect(subject.
|
|
20
|
-
expect(subject.description).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
|
21
|
-
expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
|
|
19
|
+
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
|
20
|
+
expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
|
21
|
+
expect(subject.license["id"]).to eq("http://creativecommons.org/licenses/by/3.0/")
|
|
22
22
|
expect(subject.date_published).to eq("2014")
|
|
23
|
-
expect(subject.is_part_of).to eq("
|
|
23
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
data/spec/cli_spec.rb
CHANGED
|
@@ -56,6 +56,11 @@ describe Bolognese::CLI do
|
|
|
56
56
|
subject.options = { to: "datacite" }
|
|
57
57
|
expect { subject.convert id }.to output(/http:\/\/datacite.org\/schema\/kernel-3/).to_stdout
|
|
58
58
|
end
|
|
59
|
+
|
|
60
|
+
it 'to datacite_json' do
|
|
61
|
+
subject.options = { to: "datacite_json" }
|
|
62
|
+
expect { subject.convert id }.to output(/François Renaud/).to_stdout
|
|
63
|
+
end
|
|
59
64
|
end
|
|
60
65
|
|
|
61
66
|
context "schema_org" do
|
data/spec/codemeta_spec.rb
CHANGED
|
@@ -11,21 +11,21 @@ describe Bolognese::Codemeta, vcr: true do
|
|
|
11
11
|
expect(subject.id).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
|
12
12
|
expect(subject.url).to eq("https://github.com/datacite/maremma")
|
|
13
13
|
expect(subject.type).to eq("SoftwareSourceCode")
|
|
14
|
-
expect(subject.author).to eq("
|
|
15
|
-
expect(subject.
|
|
16
|
-
expect(subject.description).to start_with("Simplifies network calls")
|
|
14
|
+
expect(subject.author).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
|
|
15
|
+
expect(subject.title).to eq("Maremma: a Ruby library for simplified network calls")
|
|
16
|
+
expect(subject.description["text"]).to start_with("Simplifies network calls")
|
|
17
17
|
expect(subject.keywords).to eq("faraday, excon, net/http")
|
|
18
18
|
expect(subject.date_created).to eq("2015-11-28")
|
|
19
19
|
expect(subject.date_published).to eq("2017-02-24")
|
|
20
20
|
expect(subject.date_modified).to eq("2017-02-24")
|
|
21
|
-
expect(subject.publisher).to eq("
|
|
21
|
+
expect(subject.publisher).to eq("DataCite")
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it "maremma schema.org JSON" do
|
|
25
25
|
json = JSON.parse(subject.schema_org)
|
|
26
26
|
expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
|
27
27
|
expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls")
|
|
28
|
-
expect(json["author"]).to eq("@type"=>"
|
|
28
|
+
expect(json["author"]).to eq("name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "@type"=>"Person", "@id"=>"http://orcid.org/0000-0003-0077-4738")
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "no codemeta.json" do
|
|
@@ -52,22 +52,25 @@ describe Bolognese::Codemeta, vcr: true do
|
|
|
52
52
|
expect(subject.id).to eq("https://doi.org/10.5063/f1m61h5x")
|
|
53
53
|
expect(subject.url).to eq("https://github.com/DataONEorg/rdataone")
|
|
54
54
|
expect(subject.type).to eq("SoftwareSourceCode")
|
|
55
|
-
expect(subject.author).to eq([{"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
expect(subject.author).to eq( [{"type"=>"Person",
|
|
56
|
+
"id"=>"http://orcid.org/0000-0003-0077-4738",
|
|
57
|
+
"name"=>"Matt Jones",
|
|
58
|
+
"givenName"=>"Matt",
|
|
59
|
+
"familyName"=>"Jones"},
|
|
60
|
+
{"type"=>"Person",
|
|
61
|
+
"id"=>"http://orcid.org/0000-0002-2192-403X",
|
|
62
|
+
"name"=>"Peter Slaughter",
|
|
63
|
+
"givenName"=>"Peter",
|
|
64
|
+
"familyName"=>"Slaughter"},
|
|
65
|
+
{"type"=>"Organization", "name"=>"University Of California, Santa Barbara"}])
|
|
66
|
+
expect(subject.title).to eq("R Interface to the DataONE REST API")
|
|
67
|
+
expect(subject.description["text"]).to start_with("Provides read and write access to data and metadata")
|
|
65
68
|
expect(subject.keywords).to eq("data sharing, data repository, DataONE")
|
|
66
69
|
expect(subject.version).to eq("2.0.0")
|
|
67
70
|
expect(subject.date_created).to eq("2016-05-27")
|
|
68
71
|
expect(subject.date_published).to eq("2016-05-27")
|
|
69
72
|
expect(subject.date_modified).to eq("2016-05-27")
|
|
70
|
-
expect(subject.publisher).to eq("
|
|
73
|
+
expect(subject.publisher).to eq("https://cran.r-project.org")
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
it "maremma" do
|
|
@@ -76,14 +79,14 @@ describe Bolognese::Codemeta, vcr: true do
|
|
|
76
79
|
expect(subject.id).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
|
77
80
|
expect(subject.url).to eq("https://github.com/datacite/maremma")
|
|
78
81
|
expect(subject.type).to eq("SoftwareSourceCode")
|
|
79
|
-
expect(subject.author).to eq("
|
|
80
|
-
expect(subject.
|
|
81
|
-
expect(subject.description).to start_with("Simplifies network calls")
|
|
82
|
+
expect(subject.author).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
|
|
83
|
+
expect(subject.title).to eq("Maremma: a Ruby library for simplified network calls")
|
|
84
|
+
expect(subject.description["text"]).to start_with("Simplifies network calls")
|
|
82
85
|
expect(subject.keywords).to eq("faraday, excon, net/http")
|
|
83
86
|
expect(subject.date_created).to eq("2015-11-28")
|
|
84
87
|
expect(subject.date_published).to eq("2017-02-24")
|
|
85
88
|
expect(subject.date_modified).to eq("2017-02-24")
|
|
86
|
-
expect(subject.publisher).to eq("
|
|
89
|
+
expect(subject.publisher).to eq("DataCite")
|
|
87
90
|
end
|
|
88
91
|
end
|
|
89
92
|
|
|
@@ -94,23 +97,27 @@ describe Bolognese::Codemeta, vcr: true do
|
|
|
94
97
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
|
95
98
|
expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API")
|
|
96
99
|
expect(datacite.dig("creators", "creator")).to eq([{"creatorName"=>"Matt Jones",
|
|
100
|
+
"givenName"=>"Matt",
|
|
101
|
+
"familyName"=>"Jones",
|
|
97
102
|
"nameIdentifier"=>
|
|
98
103
|
{"schemeURI"=>"http://orcid.org/",
|
|
99
104
|
"nameIdentifierScheme"=>"ORCID",
|
|
100
105
|
"__content__"=>"http://orcid.org/0000-0003-0077-4738"}},
|
|
101
106
|
{"creatorName"=>"Peter Slaughter",
|
|
107
|
+
"givenName"=>"Peter",
|
|
108
|
+
"familyName"=>"Slaughter",
|
|
102
109
|
"nameIdentifier"=>
|
|
103
110
|
{"schemeURI"=>"http://orcid.org/",
|
|
104
111
|
"nameIdentifierScheme"=>"ORCID",
|
|
105
112
|
"__content__"=>"http://orcid.org/0000-0002-2192-403X"}},
|
|
106
|
-
{"creatorName"=>"University
|
|
113
|
+
{"creatorName"=>"University Of California, Santa Barbara"}])
|
|
107
114
|
expect(datacite.fetch("version")).to eq("2.0.0")
|
|
108
115
|
end
|
|
109
116
|
|
|
110
117
|
it "maremma" do
|
|
111
118
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
|
112
119
|
expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls")
|
|
113
|
-
expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Martin Fenner", "nameIdentifier"=>{"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", "__content__"=>"http://orcid.org/0000-0003-0077-4738"})
|
|
120
|
+
expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", "__content__"=>"http://orcid.org/0000-0003-0077-4738"})
|
|
114
121
|
end
|
|
115
122
|
end
|
|
116
123
|
|
|
@@ -122,14 +129,17 @@ describe Bolognese::Codemeta, vcr: true do
|
|
|
122
129
|
expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x")
|
|
123
130
|
expect(json["@type"]).to eq("SoftwareSourceCode")
|
|
124
131
|
expect(json["name"]).to eq("R Interface to the DataONE REST API")
|
|
125
|
-
expect(json["author"]).to eq([{"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
"@id"=>"http://orcid.org/0000-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"
|
|
132
|
+
expect(json["author"]).to eq([{"name"=>"Matt Jones",
|
|
133
|
+
"givenName"=>"Matt",
|
|
134
|
+
"familyName"=>"Jones",
|
|
135
|
+
"@type"=>"Person",
|
|
136
|
+
"@id"=>"http://orcid.org/0000-0003-0077-4738"},
|
|
137
|
+
{"name"=>"Peter Slaughter",
|
|
138
|
+
"givenName"=>"Peter",
|
|
139
|
+
"familyName"=>"Slaughter",
|
|
140
|
+
"@type"=>"Person",
|
|
141
|
+
"@id"=>"http://orcid.org/0000-0002-2192-403X"},
|
|
142
|
+
{"name"=>"University Of California, Santa Barbara", "@type"=>"Organization"}])
|
|
133
143
|
expect(json["version"]).to eq("2.0.0")
|
|
134
144
|
end
|
|
135
145
|
|
|
@@ -138,7 +148,7 @@ describe Bolognese::Codemeta, vcr: true do
|
|
|
138
148
|
expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
|
139
149
|
expect(json["@type"]).to eq("SoftwareSourceCode")
|
|
140
150
|
expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls")
|
|
141
|
-
expect(json["author"]).to eq("@type"=>"
|
|
151
|
+
expect(json["author"]).to eq("name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "@type"=>"Person", "@id"=>"http://orcid.org/0000-0003-0077-4738")
|
|
142
152
|
end
|
|
143
153
|
end
|
|
144
154
|
|
data/spec/crossref_spec.rb
CHANGED
|
@@ -12,29 +12,23 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
12
12
|
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
|
13
13
|
expect(subject.additional_type).to eq("JournalArticle")
|
|
14
14
|
expect(subject.resource_type_general).to eq("Text")
|
|
15
|
-
expect(subject.author).to eq(
|
|
16
|
-
|
|
17
|
-
{"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
|
|
18
|
-
{"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
|
|
19
|
-
{"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
|
|
15
|
+
expect(subject.author.length).to eq(5)
|
|
16
|
+
expect(subject.author.first).to eq("type"=>"Person", "name"=>"Martial Sankar", "givenName"=>"Martial", "familyName"=>"Sankar")
|
|
20
17
|
expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
|
|
21
|
-
expect(subject.
|
|
18
|
+
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
|
22
19
|
expect(subject.date_published).to eq("2014-02-11")
|
|
23
20
|
expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
|
|
24
|
-
expect(subject.is_part_of).to eq("
|
|
25
|
-
expect(subject.
|
|
26
|
-
expect(subject.
|
|
27
|
-
expect(subject.funder).to eq([{"
|
|
28
|
-
{"
|
|
29
|
-
"@id"=>"https://doi.org/10.13039/501100003043",
|
|
21
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
|
22
|
+
expect(subject.references.count).to eq(27)
|
|
23
|
+
expect(subject.references[21]).to eq("id"=>"https://doi.org/10.5061/dryad.b835k", "relationType"=>"Cites", "position"=>"22", "datePublished"=>"2014")
|
|
24
|
+
expect(subject.funder).to eq([{"name"=>"SystemsX"},
|
|
25
|
+
{"id"=>"https://doi.org/10.13039/501100003043",
|
|
30
26
|
"name"=>"EMBO"},
|
|
31
|
-
{"
|
|
32
|
-
"@id"=>"https://doi.org/10.13039/501100001711",
|
|
27
|
+
{"id"=>"https://doi.org/10.13039/501100001711",
|
|
33
28
|
"name"=>"Swiss National Science Foundation"},
|
|
34
|
-
{"
|
|
35
|
-
"@id"=>"https://doi.org/10.13039/501100006390",
|
|
29
|
+
{"id"=>"https://doi.org/10.13039/501100006390",
|
|
36
30
|
"name"=>"University of Lausanne"}])
|
|
37
|
-
expect(subject.provider).to eq("
|
|
31
|
+
expect(subject.provider).to eq("Crossref")
|
|
38
32
|
end
|
|
39
33
|
|
|
40
34
|
it "journal article" do
|
|
@@ -45,19 +39,16 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
45
39
|
expect(subject.type).to eq("ScholarlyArticle")
|
|
46
40
|
expect(subject.additional_type).to eq("JournalArticle")
|
|
47
41
|
expect(subject.resource_type_general).to eq("Text")
|
|
48
|
-
expect(subject.author).to eq(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{"@type"=>"Person", "givenName"=>"Sylvia", "familyName"=>"Krobitsch"}])
|
|
53
|
-
expect(subject.editor).to eq("@type"=>"Person", "givenName"=>"Guilhem", "familyName"=>"Janbon")
|
|
54
|
-
expect(subject.name).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes")
|
|
42
|
+
expect(subject.author.length).to eq(5)
|
|
43
|
+
expect(subject.author.first).to eq("type"=>"Person", "name"=>"Markus Ralser", "givenName"=>"Markus", "familyName"=>"Ralser")
|
|
44
|
+
expect(subject.editor).to eq("type"=>"Person", "name"=>"Guilhem Janbon", "givenName"=>"Guilhem", "familyName"=>"Janbon")
|
|
45
|
+
expect(subject.title).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes")
|
|
55
46
|
expect(subject.license).to eq("http://creativecommons.org/licenses/by/4.0/")
|
|
56
47
|
expect(subject.date_published).to eq("2006-12-20")
|
|
57
48
|
expect(subject.date_modified).to eq("2016-12-31T21:37:08Z")
|
|
58
49
|
expect(subject.page_start).to eq("e30")
|
|
59
|
-
expect(subject.is_part_of).to eq("
|
|
60
|
-
expect(subject.provider).to eq("
|
|
50
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"PLoS ONE", "issn"=>"1932-6203")
|
|
51
|
+
expect(subject.provider).to eq("Crossref")
|
|
61
52
|
end
|
|
62
53
|
|
|
63
54
|
it "posted_content" do
|
|
@@ -69,14 +60,14 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
69
60
|
expect(subject.additional_type).to eq("PostedContent")
|
|
70
61
|
expect(subject.resource_type_general).to eq("Text")
|
|
71
62
|
expect(subject.author.count).to eq(10)
|
|
72
|
-
expect(subject.author.last).to eq("
|
|
73
|
-
expect(subject.
|
|
63
|
+
expect(subject.author.last).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-4060-7360", "name"=>"Timothy Clark", "givenName"=>"Timothy", "familyName"=>"Clark")
|
|
64
|
+
expect(subject.title).to eq("A Data Citation Roadmap for Scholarly Data Repositories")
|
|
74
65
|
expect(subject.alternate_name).to eq("biorxiv;097196v1")
|
|
75
66
|
expect(subject.description).to start_with("This article presents a practical roadmap")
|
|
76
67
|
expect(subject.date_published).to eq("2016-12-28")
|
|
77
68
|
expect(subject.date_modified).to eq("2016-12-29T00:10:20Z")
|
|
78
69
|
expect(subject.is_part_of).to be_nil
|
|
79
|
-
expect(subject.provider).to eq("
|
|
70
|
+
expect(subject.provider).to eq("Crossref")
|
|
80
71
|
end
|
|
81
72
|
|
|
82
73
|
it "DOI with SICI DOI" do
|
|
@@ -87,15 +78,15 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
87
78
|
expect(subject.type).to eq("ScholarlyArticle")
|
|
88
79
|
expect(subject.additional_type).to eq("JournalArticle")
|
|
89
80
|
expect(subject.resource_type_general).to eq("Text")
|
|
90
|
-
expect(subject.author).to eq([{"
|
|
81
|
+
expect(subject.author).to eq([{"type"=>"Person", "name"=>"A. Fenton", "givenName"=>"A.", "familyName"=>"Fenton"}, {"type"=>"Person", "name"=>"S. A. Rands", "givenName"=>"S. A.", "familyName"=>"Rands"}])
|
|
91
82
|
expect(subject.license).to eq("http://doi.wiley.com/10.1002/tdm_license_1")
|
|
92
|
-
expect(subject.
|
|
83
|
+
expect(subject.title).to eq("THE IMPACT OF PARASITE MANIPULATION AND PREDATOR FORAGING BEHAVIOR ON PREDATOR–PREY COMMUNITIES")
|
|
93
84
|
expect(subject.date_published).to eq("2006-11")
|
|
94
85
|
expect(subject.date_modified).to eq("2016-10-04T17:20:17Z")
|
|
95
86
|
expect(subject.page_start).to eq("2832")
|
|
96
87
|
expect(subject.page_end).to eq("2841")
|
|
97
|
-
expect(subject.is_part_of).to eq("
|
|
98
|
-
expect(subject.provider).to eq("
|
|
88
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"Ecology", "issn"=>"0012-9658")
|
|
89
|
+
expect(subject.provider).to eq("Crossref")
|
|
99
90
|
end
|
|
100
91
|
|
|
101
92
|
it "DOI with ORCID ID" do
|
|
@@ -106,24 +97,16 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
106
97
|
expect(subject.type).to eq("ScholarlyArticle")
|
|
107
98
|
expect(subject.additional_type).to eq("JournalArticle")
|
|
108
99
|
expect(subject.resource_type_general).to eq("Text")
|
|
109
|
-
expect(subject.author).to eq(
|
|
110
|
-
|
|
111
|
-
{"@type"=>"Person",
|
|
112
|
-
"@id"=>"http://orcid.org/0000-0003-2043-4925",
|
|
113
|
-
"givenName"=>"Beatriz",
|
|
114
|
-
"familyName"=>"Hernandez"},
|
|
115
|
-
{"@type"=>"Person", "givenName"=>"Jeffery", "familyName"=>"Newell"},
|
|
116
|
-
{"@type"=>"Person", "givenName"=>"Paul", "familyName"=>"Terpeluk"},
|
|
117
|
-
{"@type"=>"Person", "givenName"=>"David", "familyName"=>"Marder"},
|
|
118
|
-
{"@type"=>"Person", "givenName"=>"Jerome A.", "familyName"=>"Yesavage"}])
|
|
100
|
+
expect(subject.author.length).to eq(7)
|
|
101
|
+
expect(subject.author[2]).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-2043-4925", "name"=>"Beatriz Hernandez", "givenName"=>"Beatriz", "familyName"=>"Hernandez")
|
|
119
102
|
expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
|
|
120
|
-
expect(subject.
|
|
103
|
+
expect(subject.title).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
|
121
104
|
expect(subject.date_published).to eq("2012")
|
|
122
105
|
expect(subject.date_modified).to eq("2016-08-02T12:42:41Z")
|
|
123
106
|
expect(subject.page_start).to eq("1")
|
|
124
107
|
expect(subject.page_end).to eq("7")
|
|
125
|
-
expect(subject.is_part_of).to eq("
|
|
126
|
-
expect(subject.provider).to eq("
|
|
108
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"Pulmonary Medicine", "issn"=>["2090-1836", "2090-1844"])
|
|
109
|
+
expect(subject.provider).to eq("Crossref")
|
|
127
110
|
end
|
|
128
111
|
|
|
129
112
|
it "date in future" do
|
|
@@ -134,21 +117,13 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
134
117
|
expect(subject.type).to eq("ScholarlyArticle")
|
|
135
118
|
expect(subject.additional_type).to eq("JournalArticle")
|
|
136
119
|
expect(subject.resource_type_general).to eq("Text")
|
|
137
|
-
expect(subject.author).to eq(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{"@type"=>"Person", "givenName"=>"Kelly A.", "familyName"=>"Metcalf Pate"},
|
|
141
|
-
{"@type"=>"Person", "givenName"=>"Lisa M.", "familyName"=>"Mangus"},
|
|
142
|
-
{"@type"=>"Person", "givenName"=>"Lucio", "familyName"=>"Gama"},
|
|
143
|
-
{"@type"=>"Person", "givenName"=>"Robert J.", "familyName"=>"Adams"},
|
|
144
|
-
{"@type"=>"Person", "givenName"=>"Janice E.", "familyName"=>"Clements"},
|
|
145
|
-
{"@type"=>"Person", "givenName"=>"M.", "familyName"=>"Christine Zink"},
|
|
146
|
-
{"@type"=>"Person", "givenName"=>"Joseph L.", "familyName"=>"Mankowski"}])
|
|
147
|
-
expect(subject.name).to eq("Paving the path to HIV neurotherapy: Predicting SIV CNS disease")
|
|
120
|
+
expect(subject.author.length).to eq(10)
|
|
121
|
+
expect(subject.author.first).to eq("type"=>"Person", "name"=>"Sarah E. Beck", "givenName"=>"Sarah E.", "familyName"=>"Beck")
|
|
122
|
+
expect(subject.title).to eq("Paving the path to HIV neurotherapy: Predicting SIV CNS disease")
|
|
148
123
|
expect(subject.date_published).to eq("2015-07")
|
|
149
124
|
expect(subject.date_modified).to eq("2016-08-20T02:19:38Z")
|
|
150
|
-
expect(subject.is_part_of).to eq("
|
|
151
|
-
expect(subject.provider).to eq("
|
|
125
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"European Journal of Pharmacology", "issn"=>"00142999")
|
|
126
|
+
expect(subject.provider).to eq("Crossref")
|
|
152
127
|
end
|
|
153
128
|
|
|
154
129
|
it "not found error" do
|
|
@@ -175,19 +150,16 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
175
150
|
expect(subject.type).to eq("ScholarlyArticle")
|
|
176
151
|
expect(subject.additional_type).to eq("JournalArticle")
|
|
177
152
|
expect(subject.resource_type_general).to eq("Text")
|
|
178
|
-
expect(subject.author).to eq(
|
|
179
|
-
|
|
180
|
-
{"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
|
|
181
|
-
{"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
|
|
182
|
-
{"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
|
|
153
|
+
expect(subject.author.length).to eq(5)
|
|
154
|
+
expect(subject.author.last).to eq("type"=>"Person", "name"=>"Christian S Hardtke", "givenName"=>"Christian S", "familyName"=>"Hardtke")
|
|
183
155
|
expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
|
|
184
|
-
expect(subject.
|
|
156
|
+
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
|
185
157
|
expect(subject.date_published).to eq("2014-02-11")
|
|
186
158
|
expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
|
|
187
|
-
expect(subject.is_part_of).to eq("
|
|
188
|
-
expect(subject.
|
|
189
|
-
expect(subject.
|
|
190
|
-
expect(subject.provider).to eq("
|
|
159
|
+
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
|
160
|
+
expect(subject.references.count).to eq(27)
|
|
161
|
+
expect(subject.references[21]).to eq("id"=>"https://doi.org/10.5061/dryad.b835k", "relationType"=>"Cites", "position"=>"22", "datePublished"=>"2014")
|
|
162
|
+
expect(subject.provider).to eq("Crossref")
|
|
191
163
|
end
|
|
192
164
|
end
|
|
193
165
|
|
|
@@ -196,7 +168,7 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
196
168
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
|
197
169
|
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
|
198
170
|
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
|
199
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(
|
|
171
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(27)
|
|
200
172
|
expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
|
|
201
173
|
expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier"=>{"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
|
|
202
174
|
end
|
|
@@ -207,14 +179,17 @@ describe Bolognese::Crossref, vcr: true do
|
|
|
207
179
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
|
208
180
|
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
|
209
181
|
expect(datacite.dig("creators", "creator").count).to eq(7)
|
|
210
|
-
expect(datacite.dig("creators", "creator")
|
|
182
|
+
expect(datacite.dig("creators", "creator")[2]).to eq("creatorName" => "Beatriz Hernandez",
|
|
183
|
+
+"familyName" => "Hernandez",
|
|
184
|
+
+"givenName" => "Beatriz",
|
|
185
|
+
"nameIdentifier" => {"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", "__content__"=>"http://orcid.org/0000-0003-2043-4925"})
|
|
211
186
|
end
|
|
212
187
|
|
|
213
188
|
it "with editor" do
|
|
214
189
|
id = "https://doi.org/10.1371/journal.pone.0000030"
|
|
215
190
|
subject = Bolognese::Crossref.new(id: id)
|
|
216
191
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
|
217
|
-
expect(datacite.dig("contributors", "contributor")).to eq("contributorType"=>"Editor", "contributorName"=>"Janbon
|
|
192
|
+
expect(datacite.dig("contributors", "contributor")).to eq("contributorType"=>"Editor", "contributorName"=>"Guilhem Janbon", "givenName"=>"Guilhem", "familyName"=>"Janbon")
|
|
218
193
|
end
|
|
219
194
|
end
|
|
220
195
|
|