bolognese 1.0.29 → 1.0.30
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/lib/bolognese/author_utils.rb +33 -56
- data/lib/bolognese/datacite_utils.rb +15 -7
- data/lib/bolognese/metadata.rb +13 -18
- data/lib/bolognese/metadata_utils.rb +41 -20
- data/lib/bolognese/readers/bibtex_reader.rb +21 -17
- data/lib/bolognese/readers/citeproc_reader.rb +28 -7
- data/lib/bolognese/readers/codemeta_reader.rb +21 -8
- data/lib/bolognese/readers/crossref_reader.rb +31 -23
- data/lib/bolognese/readers/datacite_json_reader.rb +1 -47
- data/lib/bolognese/readers/datacite_reader.rb +26 -16
- data/lib/bolognese/readers/ris_reader.rb +20 -13
- data/lib/bolognese/readers/schema_org_reader.rb +26 -22
- data/lib/bolognese/utils.rb +139 -39
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/bibtex_writer.rb +7 -5
- data/lib/bolognese/writers/citation_writer.rb +1 -1
- data/lib/bolognese/writers/codemeta_writer.rb +2 -2
- data/lib/bolognese/writers/crosscite_writer.rb +1 -34
- data/lib/bolognese/writers/datacite_json_writer.rb +1 -29
- data/lib/bolognese/writers/jats_writer.rb +9 -9
- data/lib/bolognese/writers/ris_writer.rb +5 -5
- data/lib/bolognese/writers/schema_org_writer.rb +9 -9
- data/spec/author_utils_spec.rb +17 -47
- data/spec/cli_spec.rb +1 -1
- data/spec/fixtures/crosscite.json +10 -4
- data/spec/fixtures/datacite-example-polygon-v4.1.xml +163 -0
- data/spec/fixtures/datacite-seriesinformation.xml +41 -0
- data/spec/fixtures/datacite.json +12 -8
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/only_title.yml +37 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/title_and_pages.yml +37 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/title_volume_and_pages.yml +37 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/title_volume_issue_and_pages.yml +37 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_orcid_id.yml +37 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/to_schema_org_identifiers/with_identifiers.yml +37 -0
- data/spec/readers/bibtex_reader_spec.rb +5 -5
- data/spec/readers/citeproc_reader_spec.rb +4 -4
- data/spec/readers/codemeta_reader_spec.rb +39 -18
- data/spec/readers/crosscite_reader_spec.rb +2 -2
- data/spec/readers/crossref_reader_spec.rb +26 -32
- data/spec/readers/datacite_json_reader_spec.rb +2 -2
- data/spec/readers/datacite_reader_spec.rb +156 -101
- data/spec/readers/ris_reader_spec.rb +7 -7
- data/spec/readers/schema_org_reader_spec.rb +34 -28
- data/spec/utils_spec.rb +37 -6
- data/spec/writers/bibtex_writer_spec.rb +1 -0
- data/spec/writers/codemeta_writer_spec.rb +1 -1
- data/spec/writers/crosscite_writer_spec.rb +13 -6
- data/spec/writers/datacite_json_writer_spec.rb +13 -5
- data/spec/writers/datacite_writer_spec.rb +18 -18
- data/spec/writers/schema_org_writer_spec.rb +40 -14
- metadata +10 -2
@@ -15,7 +15,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
15
15
|
it "string" do
|
16
16
|
Bolognese::Metadata.new(input: IO.read(input).strip)
|
17
17
|
expect(subject.valid?).to be true
|
18
|
-
expect(subject.
|
18
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.7554/elife.01567", "identifierType"=>"DOI"}])
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -28,12 +28,12 @@ describe Bolognese::Metadata, vcr: true do
|
|
28
28
|
context "get ris metadata" do
|
29
29
|
it "Crossref DOI" do
|
30
30
|
expect(subject.valid?).to be true
|
31
|
-
expect(subject.
|
31
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.7554/elife.01567", "identifierType"=>"DOI"}])
|
32
32
|
expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
|
33
33
|
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
34
34
|
expect(subject.creators.length).to eq(5)
|
35
|
-
expect(subject.creators.first).to eq("
|
36
|
-
"name"=>"Martial
|
35
|
+
expect(subject.creators.first).to eq("nameType"=>"Personal",
|
36
|
+
"name"=>"Sankar, Martial",
|
37
37
|
"givenName"=>"Martial",
|
38
38
|
"familyName"=>"Sankar")
|
39
39
|
expect(subject.titles).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
|
@@ -41,7 +41,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
41
41
|
expect(subject.dates).to eq([{"date"=>"2014", "dateType"=>"Issued"}])
|
42
42
|
expect(subject.publication_year).to eq("2014")
|
43
43
|
expect(subject.related_identifiers).to eq([{"id"=>"2050084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "title"=>"eLife", "type"=>"Periodical"}])
|
44
|
-
expect(subject.
|
44
|
+
expect(subject.container).to eq("identifier"=>"2050084X", "title"=>"eLife", "type"=>"Journal", "volume"=>"3")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "DOI does not exist" do
|
@@ -50,9 +50,9 @@ describe Bolognese::Metadata, vcr: true do
|
|
50
50
|
subject = Bolognese::Metadata.new(input: input, doi: doi)
|
51
51
|
expect(subject.valid?).to be false
|
52
52
|
expect(subject.state).to eq("not_found")
|
53
|
-
expect(subject.
|
53
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.7554/elife.01567", "identifierType"=>"DOI"}])
|
54
54
|
expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"Text", "ris"=>"THES", "schemaOrg"=>"Thesis")
|
55
|
-
expect(subject.creators).to eq([{"
|
55
|
+
expect(subject.creators).to eq([{"nameType"=>"Personal", "name"=>"Toparlar, Y.", "givenName"=>"Y.", "familyName"=>"Toparlar"}])
|
56
56
|
expect(subject.titles).to eq([{"title"=>"A multiscale analysis of the urban heat island effect"}])
|
57
57
|
expect(subject.descriptions.first["description"]).to start_with("Designing the climates of cities")
|
58
58
|
expect(subject.dates).to eq([{"date"=>"2018-04-25", "dateType"=>"Issued"}, {"date"=>"2018-04-25", "dateType"=>"Created"}])
|
@@ -19,10 +19,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
19
19
|
context "get schema_org metadata" do
|
20
20
|
it "BlogPosting" do
|
21
21
|
expect(subject.valid?).to be true
|
22
|
-
expect(subject.
|
22
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
|
23
23
|
expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
24
24
|
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
25
|
-
expect(subject.creators).to eq([{"
|
25
|
+
expect(subject.creators).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin", "nameIdentifiers"=> [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID"}], "nameType"=>"Personal"}])
|
26
26
|
expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
|
27
27
|
expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
|
28
28
|
expect(subject.subjects).to eq([{"subject"=>"datacite"}, {"subject"=>"doi"}, {"subject"=>"metadata"}, {"subject"=>"featured"}])
|
@@ -36,7 +36,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
36
36
|
it "BlogPosting with new DOI" do
|
37
37
|
subject = Bolognese::Metadata.new(input: input, doi: "10.5438/0000-00ss")
|
38
38
|
expect(subject.valid?).to be true
|
39
|
-
expect(subject.
|
39
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/0000-00ss", "identifierType"=>"DOI"}])
|
40
40
|
expect(subject.doi).to eq("10.5438/0000-00ss")
|
41
41
|
expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
42
42
|
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
@@ -47,26 +47,28 @@ describe Bolognese::Metadata, vcr: true do
|
|
47
47
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
48
48
|
expect(subject.errors.size).to eq(2)
|
49
49
|
expect(subject.errors.first).to eq("43:0: ERROR: Element '{http://datacite.org/schema/kernel-4}publisher': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'.")
|
50
|
-
expect(subject.
|
50
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5281/zenodo.1196821", "identifierType"=>"DOI"}])
|
51
51
|
expect(subject.doi).to eq("10.5281/zenodo.1196821")
|
52
52
|
expect(subject.url).to eq("https://zenodo.org/record/1196821")
|
53
53
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
54
54
|
expect(subject.titles).to eq([{"title"=>"PsPM-SC4B: SCR, ECG, EMG, PSR and respiration measurements in a delay fear conditioning task with auditory CS and electrical US"}])
|
55
55
|
expect(subject.creators.size).to eq(6)
|
56
|
-
expect(subject.creators.first).to eq("
|
56
|
+
expect(subject.creators.first).to eq("name" => "Staib, Matthias",
|
57
|
+
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0001-9688-838X", "nameIdentifierScheme"=>"ORCID"}],
|
58
|
+
"nameType" => "Personal", "givenName"=>"Matthias", "familyName"=>"Staib", "affiliation" => "University of Zurich, Zurich, Switzerland")
|
57
59
|
end
|
58
60
|
|
59
61
|
it "pangaea" do
|
60
62
|
input = "https://doi.pangaea.de/10.1594/PANGAEA.836178"
|
61
63
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
62
64
|
expect(subject.valid?).to be true
|
63
|
-
expect(subject.
|
65
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.1594/pangaea.836178", "identifierType"=>"DOI"}])
|
64
66
|
expect(subject.doi).to eq("10.1594/pangaea.836178")
|
65
67
|
expect(subject.url).to eq("https://doi.pangaea.de/10.1594/PANGAEA.836178")
|
66
68
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
67
69
|
expect(subject.titles).to eq([{"title"=>"Hydrological and meteorological investigations in a lake near Kangerlussuaq, west Greenland"}])
|
68
70
|
expect(subject.creators.size).to eq(8)
|
69
|
-
expect(subject.creators.first).to eq("
|
71
|
+
expect(subject.creators.first).to eq("nameType" => "Personal", "name"=>"Johansson, Emma", "givenName"=>"Emma", "familyName"=>"Johansson")
|
70
72
|
end
|
71
73
|
|
72
74
|
# service doesn't return html to script
|
@@ -88,11 +90,11 @@ describe Bolognese::Metadata, vcr: true do
|
|
88
90
|
input = "https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/NJ7XSO"
|
89
91
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
90
92
|
expect(subject.valid?).to be true
|
91
|
-
expect(subject.
|
93
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.7910/dvn/nj7xso", "identifierType"=>"DOI"}])
|
92
94
|
expect(subject.doi).to eq("10.7910/dvn/nj7xso")
|
93
95
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
94
96
|
expect(subject.titles).to eq([{"title"=>"Summary data ankylosing spondylitis GWAS"}])
|
95
|
-
expect(subject.
|
97
|
+
expect(subject.container).to eq("identifier"=>"https://dataverse.harvard.edu", "identifierType"=>"URL", "title"=>"Harvard Dataverse", "type"=>"DataRepository")
|
96
98
|
expect(subject.creators).to eq([{"name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)"}])
|
97
99
|
expect(subject.schema_version).to eq("https://schema.org/version/3.3")
|
98
100
|
end
|
@@ -101,11 +103,11 @@ describe Bolognese::Metadata, vcr: true do
|
|
101
103
|
input = "https://identifiers.org/doi/10.7910/DVN/NJ7XSO"
|
102
104
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
103
105
|
expect(subject.valid?).to be true
|
104
|
-
expect(subject.
|
106
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.7910/dvn/nj7xso", "identifierType"=>"DOI"}])
|
105
107
|
expect(subject.doi).to eq("10.7910/dvn/nj7xso")
|
106
108
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
107
109
|
expect(subject.titles).to eq([{"title"=>"Summary data ankylosing spondylitis GWAS"}])
|
108
|
-
expect(subject.
|
110
|
+
expect(subject.container).to eq("identifier"=>"https://dataverse.harvard.edu", "identifierType"=>"URL", "title"=>"Harvard Dataverse", "type"=>"DataRepository")
|
109
111
|
expect(subject.creators).to eq([{"name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)"}])
|
110
112
|
end
|
111
113
|
end
|
@@ -115,10 +117,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
115
117
|
input = fixture_path + 'schema_org.json'
|
116
118
|
subject = Bolognese::Metadata.new(input: input)
|
117
119
|
expect(subject.valid?).to be true
|
118
|
-
expect(subject.
|
120
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
|
119
121
|
expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
120
122
|
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
121
|
-
expect(subject.creators).to eq([{"
|
123
|
+
expect(subject.creators).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin", "nameIdentifiers"=> [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID"}], "nameType"=>"Personal"}])
|
122
124
|
expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
|
123
125
|
expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
|
124
126
|
expect(subject.subjects).to eq([{"subject"=>"datacite"}, {"subject"=>"doi"}, {"subject"=>"metadata"}, {"subject"=>"featured"}])
|
@@ -134,18 +136,17 @@ describe Bolognese::Metadata, vcr: true do
|
|
134
136
|
subject = Bolognese::Metadata.new(input: input)
|
135
137
|
|
136
138
|
expect(subject.valid?).to be true
|
137
|
-
expect(subject.
|
138
|
-
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"687610993", "alternateIdentifierType"=>"md5"}])
|
139
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.25491/d50j-3083", "identifierType"=>"DOI"}, {"identifier"=>"687610993", "identifierType"=>"md5"}])
|
139
140
|
expect(subject.url).to eq("https://ors.datacite.org/doi:/10.25491/d50j-3083")
|
140
141
|
expect(subject.content_url).to eq(["https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz"])
|
141
142
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"Gene expression matrices", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
142
|
-
expect(subject.creators).to eq([{"name"=>"The GTEx Consortium", "
|
143
|
+
expect(subject.creators).to eq([{"name"=>"The GTEx Consortium", "nameType"=>"Organizational"}])
|
143
144
|
expect(subject.titles).to eq([{"title"=>"Fully processed, filtered and normalized gene expression matrices (in BED format) for each tissue, which were used as input into FastQTL for eQTL discovery"}])
|
144
145
|
expect(subject.version_info).to eq("v7")
|
145
146
|
expect(subject.subjects).to eq([{"subject"=>"gtex"}, {"subject"=>"annotation"}, {"subject"=>"phenotype"}, {"subject"=>"gene regulation"}, {"subject"=>"transcriptomics"}])
|
146
147
|
expect(subject.dates).to eq([{"date"=>"2017", "dateType"=>"Issued"}])
|
147
148
|
expect(subject.publication_year).to eq("2017")
|
148
|
-
expect(subject.
|
149
|
+
expect(subject.container).to eq("title"=>"GTEx", "type"=>"DataRepository")
|
149
150
|
expect(subject.publisher).to eq("GTEx")
|
150
151
|
expect(subject.funding_references.length).to eq(7)
|
151
152
|
expect(subject.funding_references.first).to eq("funderIdentifier"=>"https://doi.org/10.13039/100000052", "funderIdentifierType"=>"Crossref Funder ID", "funderName"=>"Common Fund of the Office of the Director of the NIH")
|
@@ -155,12 +156,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
155
156
|
input = fixture_path + 'schema_org_topmed.json'
|
156
157
|
subject = Bolognese::Metadata.new(input: input)
|
157
158
|
expect(subject.valid?).to be true
|
158
|
-
expect(subject.
|
159
|
-
|
159
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.23725/8na3-9s47", "identifierType"=>"DOI"},
|
160
|
+
{"identifier"=>"3b33f6b9338fccab0901b7d317577ea3", "identifierType"=>"md5"},
|
161
|
+
{"identifier"=>"ark:/99999/fk41CrU4eszeLUDe", "identifierType"=>"minid"},
|
162
|
+
{"identifier"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7", "identifierType"=>"dataguid"}])
|
160
163
|
expect(subject.url).to eq("https://ors.datacite.org/doi:/10.23725/8na3-9s47")
|
161
164
|
expect(subject.content_url).to eq(["s3://cgp-commons-public/topmed_open_access/197bc047-e917-55ed-852d-d563cdbc50e4/NWD165827.recab.cram", "gs://topmed-irc-share/public/NWD165827.recab.cram"])
|
162
165
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"CRAM file", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
163
|
-
expect(subject.creators).to eq([{"name"=>"TOPMed IRC", "
|
166
|
+
expect(subject.creators).to eq([{"name"=>"TOPMed IRC", "nameType"=>"Organizational"}])
|
164
167
|
expect(subject.titles).to eq([{"title"=>"NWD165827.recab.cram"}])
|
165
168
|
expect(subject.subjects).to eq([{"subject"=>"topmed"}, {"subject"=>"whole genome sequencing"}])
|
166
169
|
expect(subject.dates).to eq([{"date"=>"2017-11-30", "dateType"=>"Issued"}])
|
@@ -175,10 +178,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
175
178
|
subject = Bolognese::Metadata.new(input: input)
|
176
179
|
|
177
180
|
expect(subject.valid?).to be true
|
178
|
-
expect(subject.
|
181
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.6071/z7wc73", "identifierType"=>"DOI"}])
|
179
182
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
180
183
|
expect(subject.creators.length).to eq(6)
|
181
|
-
expect(subject.creators.first).to eq("familyName"=>"Bales", "givenName"=>"Roger", "name"=>"Roger
|
184
|
+
expect(subject.creators.first).to eq("familyName"=>"Bales", "givenName"=>"Roger", "name"=>"Bales, Roger", "nameType"=>"Personal")
|
182
185
|
expect(subject.titles).to eq([{"title"=>"Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature"}])
|
183
186
|
expect(subject.subjects).to eq([{"subject"=>"Earth sciences"},
|
184
187
|
{"subject"=>"soil moisture"},
|
@@ -200,10 +203,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
200
203
|
subject = Bolognese::Metadata.new(input: input)
|
201
204
|
|
202
205
|
expect(subject.valid?).to be true
|
203
|
-
expect(subject.
|
206
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.1594/pangaea.842237", "identifierType"=>"DOI"}])
|
204
207
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
205
208
|
expect(subject.creators.length).to eq(2)
|
206
|
-
expect(subject.creators.first).to eq("name"=>"Tara Oceans Consortium, Coordinators", "
|
209
|
+
expect(subject.creators.first).to eq("name"=>"Tara Oceans Consortium, Coordinators", "nameType"=>"Organizational")
|
207
210
|
expect(subject.titles).to eq([{"title"=>"Registry of all stations from the Tara Oceans Expedition (2009-2013)"}])
|
208
211
|
expect(subject.dates).to eq([{"date"=>"2015-02-03", "dateType"=>"Issued"}])
|
209
212
|
expect(subject.publication_year).to eq("2015")
|
@@ -216,12 +219,15 @@ describe Bolognese::Metadata, vcr: true do
|
|
216
219
|
input = JSON.parse(data).first.to_json
|
217
220
|
subject = Bolognese::Metadata.new(input: input)
|
218
221
|
expect(subject.valid?).to be true
|
219
|
-
expect(subject.
|
220
|
-
|
222
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.23725/7jg3-v803", "identifierType"=>"DOI"},
|
223
|
+
{"identifier"=>"ark:/99999/fk4E1n6n1YHKxPk", "identifierType"=>"minid"},
|
224
|
+
{"identifier"=>"dg.4503/01b048d0-e128-4cb0-94e9-b2d2cab7563d",
|
225
|
+
"identifierType"=>"dataguid"},
|
226
|
+
{"identifier"=>"f9e72bdf25bf4b4f0e581d9218fec2eb", "identifierType"=>"md5"}])
|
221
227
|
expect(subject.url).to eq("https://ors.datacite.org/doi:/10.23725/7jg3-v803")
|
222
228
|
expect(subject.content_url).to eq(["s3://cgp-commons-public/topmed_open_access/44a8837b-4456-5709-b56b-54e23000f13a/NWD100953.recab.cram","gs://topmed-irc-share/public/NWD100953.recab.cram","dos://dos.commons.ucsc-cgp.org/01b048d0-e128-4cb0-94e9-b2d2cab7563d?version=2018-05-26T133719.491772Z"])
|
223
229
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"CRAM file", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
224
|
-
expect(subject.creators).to eq([{"name"=>"TOPMed", "
|
230
|
+
expect(subject.creators).to eq([{"name"=>"TOPMed", "nameType"=>"Organizational"}])
|
225
231
|
expect(subject.titles).to eq([{"title"=>"NWD100953.recab.cram"}])
|
226
232
|
expect(subject.subjects).to eq([{"subject"=>"topmed"}, {"subject"=>"whole genome sequencing"}])
|
227
233
|
expect(subject.dates).to eq([{"date"=>"2017-11-30", "dateType"=>"Issued"}])
|
@@ -250,7 +256,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
250
256
|
|
251
257
|
expect(subject.valid?).to be true
|
252
258
|
expect(subject.doi).to eq("10.5281/zenodo.1239")
|
253
|
-
expect(subject.
|
259
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5281/zenodo.1239", "identifierType"=>"DOI"}])
|
254
260
|
expect(subject.types["schemaOrg"]).to eq("Dataset")
|
255
261
|
expect(subject.types["resourceTypeGeneral"]).to eq("Dataset")
|
256
262
|
expect(subject.creators).to eq([{"familyName"=>"Jahn", "givenName"=>"Najko", "name"=>"Jahn, Najko", "type"=>"Person"}])
|
data/spec/utils_spec.rb
CHANGED
@@ -235,12 +235,11 @@ describe Bolognese::Metadata, vcr: true do
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
|
-
context "
|
239
|
-
it "with
|
240
|
-
|
241
|
-
|
242
|
-
response
|
243
|
-
expect(response).to eq([{"@type"=>"PropertyValue", "propertyID"=>"doi", "value"=>"https://doi.org/10.23725/8na3-9s47"},
|
238
|
+
context "to_schema_org_identifiers" do
|
239
|
+
it "with identifiers" do
|
240
|
+
identifiers = [{"identifier" => "https://doi.org/10.23725/8na3-9s47", "identifierType" => "DOI"}, {"identifierType"=>"md5", "identifier"=>"3b33f6b9338fccab0901b7d317577ea3"}, {"identifierType"=>"minid", "identifier"=>"ark:/99999/fk41CrU4eszeLUDe"}, {"identifierType"=>"dataguid", "identifier"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7"}]
|
241
|
+
response = subject.to_schema_org_identifiers(identifiers, type: "Dataset")
|
242
|
+
expect(response).to eq([{"@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.23725/8na3-9s47"},
|
244
243
|
{"@type"=>"PropertyValue",
|
245
244
|
"propertyID"=>"md5",
|
246
245
|
"value"=>"3b33f6b9338fccab0901b7d317577ea3"},
|
@@ -332,6 +331,38 @@ describe Bolognese::Metadata, vcr: true do
|
|
332
331
|
end
|
333
332
|
end
|
334
333
|
|
334
|
+
context "get_series_information" do
|
335
|
+
it "only title" do
|
336
|
+
str = nil
|
337
|
+
response = subject.get_series_information(str)
|
338
|
+
expect(response).to eq({})
|
339
|
+
end
|
340
|
+
|
341
|
+
it "only title" do
|
342
|
+
str = "DataCite Blog"
|
343
|
+
response = subject.get_series_information(str)
|
344
|
+
expect(response).to eq("title"=>"DataCite Blog")
|
345
|
+
end
|
346
|
+
|
347
|
+
it "title and pages" do
|
348
|
+
str = "DataCite Blog, 1-3"
|
349
|
+
response = subject.get_series_information(str)
|
350
|
+
expect(response).to eq("firstPage"=>"1", "lastPage"=>"3", "title"=>"DataCite Blog")
|
351
|
+
end
|
352
|
+
|
353
|
+
it "title, volume and pages" do
|
354
|
+
str = "DataCite Blog, 7, 1-3"
|
355
|
+
response = subject.get_series_information(str)
|
356
|
+
expect(response).to eq("firstPage"=>"1", "lastPage"=>"3", "title"=>"DataCite Blog", "volume"=>"7")
|
357
|
+
end
|
358
|
+
|
359
|
+
it "title, volume, issue and pages" do
|
360
|
+
str = "DataCite Blog, 7(11), 1-3"
|
361
|
+
response = subject.get_series_information(str)
|
362
|
+
expect(response).to eq("firstPage"=>"1", "issue"=>"11", "lastPage"=>"3", "title"=>"DataCite Blog", "volume"=>"7")
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
335
366
|
context "github" do
|
336
367
|
it "github_from_url" do
|
337
368
|
url = "https://github.com/datacite/bolognese"
|
@@ -75,6 +75,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
75
75
|
it "BlogPosting from string" do
|
76
76
|
input = fixture_path + "datacite.json"
|
77
77
|
subject = Bolognese::Metadata.new(input: input, from: "datacite_json")
|
78
|
+
expect(subject.valid?).to be true
|
78
79
|
bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
|
79
80
|
expect(bibtex[:bibtex_type].to_s).to eq("article")
|
80
81
|
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/4k3m-nyvg")
|
@@ -27,7 +27,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
27
27
|
expect(json["@context"]).to eq("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
|
28
28
|
expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x")
|
29
29
|
expect(json["@type"]).to eq("SoftwareSourceCode")
|
30
|
-
expect(json["identifier"]).to eq("https://doi.org/10.5063/f1m61h5x")
|
30
|
+
expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.5063/f1m61h5x")
|
31
31
|
expect(json["agents"]).to eq([{"name"=>"Jones, Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read, Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott"}])
|
32
32
|
expect(json["title"]).to eq("dataone: R interface to the DataONE network of data repositories")
|
33
33
|
expect(json["datePublished"]).to eq("2016")
|
@@ -23,7 +23,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
23
23
|
crosscite = JSON.parse(subject.crosscite)
|
24
24
|
expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
|
25
25
|
expect(crosscite.fetch("creators").count).to eq(7)
|
26
|
-
expect(crosscite.fetch("creators")[2]).to eq("
|
26
|
+
expect(crosscite.fetch("creators")[2]).to eq("nameType"=>"Personal", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-2043-4925", "nameIdentifierScheme"=>"ORCID"}], "name"=>"Hernandez, Beatriz", "givenName"=>"Beatriz", "familyName"=>"Hernandez")
|
27
27
|
end
|
28
28
|
|
29
29
|
# it "with editor" do
|
@@ -41,7 +41,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
41
41
|
expect(crosscite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
|
42
42
|
expect(crosscite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
43
43
|
expect(crosscite.fetch("creators").count).to eq(5)
|
44
|
-
expect(crosscite.fetch("creators").first).to eq("
|
44
|
+
expect(crosscite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "BlogPosting Citeproc JSON" do
|
@@ -52,7 +52,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
52
52
|
expect(crosscite["types"]).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
53
53
|
expect(crosscite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}])
|
54
54
|
expect(crosscite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food")
|
55
|
-
expect(crosscite.fetch("creators")).to eq([{"
|
55
|
+
expect(crosscite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin", "nameType"=>"Personal"}])
|
56
56
|
end
|
57
57
|
|
58
58
|
it "rdataone" do
|
@@ -61,7 +61,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
61
61
|
crosscite = JSON.parse(subject.crosscite)
|
62
62
|
expect(crosscite["titles"]).to eq([{"title"=>"R Interface to the DataONE REST API"}])
|
63
63
|
expect(crosscite["creators"].length).to eq(3)
|
64
|
-
expect(crosscite["creators"].last).to eq("
|
64
|
+
expect(crosscite["creators"].last).to eq("nameType" => "Organizational", "name"=>"University Of California, Santa Barbara")
|
65
65
|
expect(crosscite["version"]).to eq("2.0.0")
|
66
66
|
end
|
67
67
|
|
@@ -72,7 +72,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
72
72
|
expect(crosscite.fetch("url")).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
|
73
73
|
expect(crosscite.fetch("titles")).to eq([{"title"=>"Data from: A new malaria agent in African hominids."}])
|
74
74
|
expect(crosscite.fetch("creators").length).to eq(8)
|
75
|
-
expect(crosscite.fetch("creators").first).to eq("
|
75
|
+
expect(crosscite.fetch("creators").first).to eq("familyName" => "Ollomo", "givenName" => "Benjamin", "name" => "Ollomo, Benjamin", "nameType" => "Personal")
|
76
76
|
expect(crosscite.fetch("dates")).to eq([{"date"=>"2011", "dateType"=>"Issued"}])
|
77
77
|
expect(crosscite.fetch("publication_year")).to eq("2011")
|
78
78
|
expect(crosscite.fetch("provider_id")).to eq("DRYAD")
|
@@ -84,7 +84,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
84
84
|
subject = Bolognese::Metadata.new(input: input, from: "codemeta")
|
85
85
|
crosscite = JSON.parse(subject.crosscite)
|
86
86
|
expect(crosscite.fetch("titles")).to eq( [{"title"=>"Maremma: a Ruby library for simplified network calls"}])
|
87
|
-
expect(crosscite.fetch("creators")).to eq([{"
|
87
|
+
expect(crosscite.fetch("creators")).to eq([{"affiliation"=>"DataCite",
|
88
|
+
"familyName"=>"Fenner",
|
89
|
+
"givenName"=>"Martin",
|
90
|
+
"name"=>"Fenner, Martin",
|
91
|
+
"nameIdentifiers"=>
|
92
|
+
[{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738",
|
93
|
+
"nameIdentifierScheme"=>"ORCID"}],
|
94
|
+
"nameType"=>"Personal"}])
|
88
95
|
end
|
89
96
|
|
90
97
|
it "with data citation schema.org" do
|
@@ -23,7 +23,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
23
23
|
expect(datacite.fetch("url")).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
|
24
24
|
expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
|
25
25
|
expect(datacite.fetch("creators").length).to eq(7)
|
26
|
-
expect(datacite.fetch("creators").first).to eq("
|
26
|
+
expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi")
|
27
27
|
end
|
28
28
|
|
29
29
|
it "Crossref DOI" do
|
@@ -34,7 +34,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
34
34
|
expect(datacite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
|
35
35
|
expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
36
36
|
expect(datacite.fetch("creators").length).to eq(5)
|
37
|
-
expect(datacite.fetch("creators").first).to eq("
|
37
|
+
expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar")
|
38
38
|
end
|
39
39
|
|
40
40
|
it "BlogPosting Citeproc JSON" do
|
@@ -44,7 +44,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
44
44
|
expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
45
45
|
expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}])
|
46
46
|
expect(datacite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food")
|
47
|
-
expect(datacite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Martin
|
47
|
+
expect(datacite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin", "nameType"=>"Personal"}])
|
48
48
|
end
|
49
49
|
|
50
50
|
it "rdataone" do
|
@@ -53,7 +53,8 @@ describe Bolognese::Metadata, vcr: true do
|
|
53
53
|
datacite = JSON.parse(subject.datacite_json)
|
54
54
|
expect(datacite.fetch("titles")).to eq([{"title"=>"R Interface to the DataONE REST API"}])
|
55
55
|
expect(datacite.fetch("creators").length).to eq(3)
|
56
|
-
expect(datacite.fetch("creators").first).to eq("
|
56
|
+
expect(datacite.fetch("creators").first).to eq("affiliation"=>"NCEAS", "nameType"=>"Personal", "name" => "Jones, Matt",
|
57
|
+
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID"}], "givenName"=>"Matt", "familyName"=>"Jones")
|
57
58
|
expect(datacite.fetch("version")).to eq("2.0.0")
|
58
59
|
end
|
59
60
|
|
@@ -62,7 +63,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
62
63
|
subject = Bolognese::Metadata.new(input: input, from: "codemeta")
|
63
64
|
datacite = JSON.parse(subject.datacite_json)
|
64
65
|
expect(datacite.fetch("titles")).to eq([{"title"=>"Maremma: a Ruby library for simplified network calls"}])
|
65
|
-
expect(datacite.fetch("creators")).to eq([{"
|
66
|
+
expect(datacite.fetch("creators")).to eq([{"affiliation"=>"DataCite",
|
67
|
+
"familyName"=>"Fenner",
|
68
|
+
"givenName"=>"Martin",
|
69
|
+
"name"=>"Fenner, Martin",
|
70
|
+
"nameIdentifiers"=>
|
71
|
+
[{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738",
|
72
|
+
"nameIdentifierScheme"=>"ORCID"}],
|
73
|
+
"nameType"=>"Personal"}])
|
66
74
|
end
|
67
75
|
|
68
76
|
it "with data citation schema.org" do
|
@@ -29,7 +29,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
29
29
|
expect(datacite.dig("creators", "creator")[2]).to eq("creatorName" => {"__content__"=>"Hernandez, Beatriz", "nameType"=>"Personal"},
|
30
30
|
"familyName" => "Hernandez",
|
31
31
|
"givenName" => "Beatriz",
|
32
|
-
"nameIdentifier" => {"
|
32
|
+
"nameIdentifier" => {"nameIdentifierScheme"=>"ORCID", "__content__"=>"https://orcid.org/0000-0003-2043-4925"})
|
33
33
|
end
|
34
34
|
|
35
35
|
it "with editor" do
|
@@ -47,7 +47,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
47
47
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
48
48
|
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
49
49
|
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
50
|
-
expect(datacite.dig("descriptions", "description").first).to eq("__content__"=>"eLife", "descriptionType"=>"SeriesInformation")
|
50
|
+
expect(datacite.dig("descriptions", "description").first).to eq("__content__"=>"eLife, 3", "descriptionType"=>"SeriesInformation")
|
51
51
|
expect(datacite.dig("descriptions", "description", 1, "__content__")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
52
52
|
expect(datacite.dig("creators", "creator").count).to eq(5)
|
53
53
|
expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>{"__content__"=>"Sankar, Martial", "nameType"=>"Personal"}, "familyName"=>"Sankar", "givenName"=>"Martial")
|
@@ -75,16 +75,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
75
75
|
"givenName"=>"Matt",
|
76
76
|
"familyName"=>"Jones",
|
77
77
|
"nameIdentifier"=>
|
78
|
-
{"
|
79
|
-
"
|
80
|
-
"__content__"=>"http://orcid.org/0000-0003-0077-4738"}},
|
78
|
+
{"nameIdentifierScheme"=>"ORCID",
|
79
|
+
"__content__"=>"https://orcid.org/0000-0003-0077-4738"}},
|
81
80
|
{"creatorName"=>{"__content__"=>"Slaughter, Peter", "nameType"=>"Personal"},
|
82
81
|
"givenName"=>"Peter",
|
83
82
|
"familyName"=>"Slaughter",
|
84
83
|
"nameIdentifier"=>
|
85
|
-
{"
|
86
|
-
"
|
87
|
-
"__content__"=>"http://orcid.org/0000-0002-2192-403X"}},
|
84
|
+
{"nameIdentifierScheme"=>"ORCID",
|
85
|
+
"__content__"=>"https://orcid.org/0000-0002-2192-403X"}},
|
88
86
|
{"creatorName"=>{"__content__"=>"University Of California, Santa Barbara", "nameType"=>"Organizational"}}])
|
89
87
|
expect(datacite.fetch("version")).to eq("2.0.0")
|
90
88
|
end
|
@@ -95,17 +93,17 @@ describe Bolognese::Metadata, vcr: true do
|
|
95
93
|
expect(subject.valid?).to be true
|
96
94
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
97
95
|
expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls")
|
98
|
-
expect(datacite.dig("creators", "creator")).to eq("creatorName"=> {"__content__"=>"Fenner, Martin", "nameType"=>"Personal"}, "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"
|
96
|
+
expect(datacite.dig("creators", "creator")).to eq("creatorName"=> {"__content__"=>"Fenner, Martin", "nameType"=>"Personal"}, "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"__content__"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID"})
|
99
97
|
end
|
100
98
|
|
101
99
|
it "Text pass-thru" do
|
102
100
|
input = "https://doi.org/10.23640/07243.5153971"
|
103
101
|
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
104
102
|
expect(subject.valid?).to be true
|
105
|
-
expect(subject.
|
103
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.23640/07243.5153971", "identifierType"=>"DOI"}])
|
106
104
|
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"Paper", "resourceTypeGeneral"=>"Text", "ris"=>"RPRT", "schemaOrg"=>"ScholarlyArticle")
|
107
105
|
expect(subject.creators.length).to eq(20)
|
108
|
-
expect(subject.creators.first).to eq("
|
106
|
+
expect(subject.creators.first).to eq("nameType"=>"Personal", "familyName" => "Paglione", "givenName" => "Laura", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-3188-6273", "nameIdentifierScheme"=>"ORCID"}], "name" => "Paglione, Laura")
|
109
107
|
expect(subject.titles).to eq([{"title"=>"Recommendation of: ORCID Works Metadata Working Group"}])
|
110
108
|
expect(subject.rights_list).to eq([{"rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0", "rights"=>"CC-0"}])
|
111
109
|
expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
|
@@ -120,10 +118,10 @@ describe Bolognese::Metadata, vcr: true do
|
|
120
118
|
input = "https://doi.org/10.23640/07243.5153971"
|
121
119
|
subject = Bolognese::Metadata.new(input: input, from: "datacite", doi: "10.5072/07243.5153971")
|
122
120
|
expect(subject.valid?).to be true
|
123
|
-
expect(subject.
|
121
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5072/07243.5153971", "identifierType"=>"DOI"}])
|
124
122
|
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"Paper", "resourceTypeGeneral"=>"Text", "ris"=>"RPRT", "schemaOrg"=>"ScholarlyArticle")
|
125
123
|
expect(subject.creators.length).to eq(20)
|
126
|
-
expect(subject.creators.first).to eq("
|
124
|
+
expect(subject.creators.first).to eq("nameType" => "Personal", "familyName" => "Paglione", "givenName" => "Laura", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-3188-6273", "nameIdentifierScheme"=>"ORCID"}], "name" => "Paglione, Laura")
|
127
125
|
expect(subject.titles).to eq([{"title"=>"Recommendation of: ORCID Works Metadata Working Group"}])
|
128
126
|
expect(subject.rights_list).to eq([{"rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0", "rights"=>"CC-0"}])
|
129
127
|
expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}])
|
@@ -138,12 +136,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
138
136
|
input = "https://doi.org/10.5061/DRYAD.8515"
|
139
137
|
subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true)
|
140
138
|
expect(subject.valid?).to be true
|
141
|
-
expect(subject.identifier).to eq("https://doi.org/10.5061/dryad.8515")
|
142
139
|
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"DataPackage", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
|
143
140
|
expect(subject.creators.length).to eq(8)
|
144
|
-
expect(subject.creators.first).to eq("
|
141
|
+
expect(subject.creators.first).to eq("nameType" => "Personal", "name"=>"Ollomo, Benjamin", "givenName"=>"Benjamin", "familyName"=>"Ollomo")
|
145
142
|
expect(subject.titles).to eq([{"title"=>"Data from: A new malaria agent in African hominids."}])
|
146
|
-
expect(subject.
|
143
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5061/dryad.8515", "identifierType"=>"DOI"},
|
144
|
+
{"identifier"=>
|
145
|
+
"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.",
|
146
|
+
"identifierType"=>"citation"}])
|
147
147
|
expect(subject.rights_list).to eq([{"rightsUri"=>"http://creativecommons.org/publicdomain/zero/1.0"}])
|
148
148
|
expect(subject.dates).to eq([{"date"=>"2011", "dateType"=>"Issued"}])
|
149
149
|
expect(subject.publication_year).to eq("2011")
|
@@ -171,7 +171,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
171
171
|
input = "https://doi.org/10.4124/05F6C379-DD68-4CDB-880D-33D3E9576D52/1"
|
172
172
|
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
173
173
|
expect(subject.valid?).to be false
|
174
|
-
expect(subject.
|
174
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1", "identifierType"=>"DOI"}])
|
175
175
|
expect(subject.doi).to eq("10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
|
176
176
|
expect(subject.agency).to eq("DataCite")
|
177
177
|
expect(subject.state).to eq("not_found")
|
@@ -216,7 +216,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
216
216
|
subject.descriptions = { "description" => "This is an abstract." }
|
217
217
|
expect(subject.valid?).to be true
|
218
218
|
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
219
|
-
expect(datacite.dig("descriptions", "description")).to eq([{"__content__"=>"eLife", "descriptionType"=>"SeriesInformation"}, {"__content__"=>"This is an abstract.", "descriptionType"=>"Abstract"}])
|
219
|
+
expect(datacite.dig("descriptions", "description")).to eq( [{"__content__"=>"eLife, 3", "descriptionType"=>"SeriesInformation"}, {"__content__"=>"This is an abstract.", "descriptionType"=>"Abstract"}])
|
220
220
|
end
|
221
221
|
|
222
222
|
it "change description no input" do
|