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
@@ -10,7 +10,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
10
10
|
json = JSON.parse(subject.schema_org)
|
11
11
|
expect(json["@id"]).to eq("https://doi.org/10.7554/elife.01567")
|
12
12
|
expect(json["isPartOf"]).to eq("@type"=>"Periodical", "issn"=>"2050-084X")
|
13
|
-
expect(json["periodical"]).to eq("@type"=>"
|
13
|
+
expect(json["periodical"]).to eq("@type"=>"Journal", "identifier"=>"2050-084X", "identifierType"=>"ISSN", "name"=>"eLife", "volume"=>"3")
|
14
14
|
expect(json["citation"].length).to eq(26)
|
15
15
|
expect(json["citation"].first).to eq("@id"=>"https://doi.org/10.1038/nature02100", "@type"=>"CreativeWork")
|
16
16
|
expect(json["funder"]).to eq([{"name"=>"SystemsX", "@type"=>"Organization"},
|
@@ -32,7 +32,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
32
32
|
expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
33
33
|
expect(json["@type"]).to eq("SoftwareSourceCode")
|
34
34
|
expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls")
|
35
|
-
expect(json["author"]).to eq("name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "@type"=>"Person", "@id"=>"
|
35
|
+
expect(json["author"]).to eq("name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "@type"=>"Person", "@id"=>"https://orcid.org/0000-0003-0077-4738", "affiliation" => {"@type"=>"Organization", "name"=>"DataCite"})
|
36
36
|
end
|
37
37
|
|
38
38
|
it "Schema.org JSON" do
|
@@ -71,12 +71,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
71
71
|
"givenName"=>"Matt",
|
72
72
|
"familyName"=>"Jones",
|
73
73
|
"@type"=>"Person",
|
74
|
-
"@id"=>"
|
74
|
+
"@id"=>"https://orcid.org/0000-0003-0077-4738",
|
75
|
+
"affiliation"=>{"@type"=>"Organization", "name"=>"NCEAS"}},
|
75
76
|
{"name"=>"Peter Slaughter",
|
76
77
|
"givenName"=>"Peter",
|
77
78
|
"familyName"=>"Slaughter",
|
78
79
|
"@type"=>"Person",
|
79
|
-
"@id"=>"
|
80
|
+
"@id"=>"https://orcid.org/0000-0002-2192-403X",
|
81
|
+
"affiliation"=>{"@type"=>"Organization", "name"=>"NCEAS"}},
|
80
82
|
{"name"=>"University Of California, Santa Barbara", "@type"=>"Organization"}])
|
81
83
|
expect(json["version"]).to eq("2.0.0")
|
82
84
|
end
|
@@ -142,7 +144,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
142
144
|
expect(json["name"]).to eq("Rural Electrification With Hybrid Power Systems Based on Renewables - Technical System Configurations From the Point of View of the European Industry")
|
143
145
|
expect(json["author"].count).to eq(3)
|
144
146
|
expect(json["author"].first).to eq("@type"=>"Person", "name"=>"P. Llamas", "givenName"=>"P.", "familyName"=>"Llamas")
|
145
|
-
expect(json["periodical"]).to eq("@type"=>"
|
147
|
+
expect(json["periodical"]).to eq("@type"=>"Series", "firstPage"=>"Spain; 3353", "lastPage"=>"3356", "name"=>"23rd European Photovoltaic Solar Energy Conference and Exhibition", "volume"=>"1-5 September 2008")
|
146
148
|
end
|
147
149
|
|
148
150
|
it "data catalog" do
|
@@ -154,7 +156,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
154
156
|
expect(json["name"]).to eq("Covariates used in eQTL analysis. Includes genotyping principal components and PEER factors")
|
155
157
|
expect(json["author"]).to eq("@type"=>"Organization", "name"=>"The GTEx Consortium")
|
156
158
|
expect(json["includedInDataCatalog"]).to eq("@type"=>"DataCatalog", "name"=>"GTEx")
|
157
|
-
expect(json["identifier"]).to eq([{"@type"=>"PropertyValue", "propertyID"=>"
|
159
|
+
expect(json["identifier"]).to eq([{"@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.25491/8kmc-g314"},{"@type"=>"PropertyValue", "propertyID"=>"md5", "value"=>"c7c89fe7366d50cd75448aa603c9de58"}])
|
158
160
|
expect(json["contentUrl"]).to eq("https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_covariates.tar.gz")
|
159
161
|
end
|
160
162
|
|
@@ -169,7 +171,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
169
171
|
expect(json["includedInDataCatalog"]).to be_nil
|
170
172
|
expect(json["identifier"]).to eq(
|
171
173
|
[{"@type"=>"PropertyValue",
|
172
|
-
"propertyID"=>"
|
174
|
+
"propertyID"=>"DOI",
|
173
175
|
"value"=>"https://doi.org/10.23725/8na3-9s47"},
|
174
176
|
{"@type"=>"PropertyValue",
|
175
177
|
"propertyID"=>"minid",
|
@@ -193,9 +195,19 @@ describe Bolognese::Metadata, vcr: true do
|
|
193
195
|
expect(json["@type"]).to eq("Dataset")
|
194
196
|
expect(json["name"]).to eq("Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek\n meteorological data, soil moisture and temperature, snow depth and air\n temperature")
|
195
197
|
expect(json["author"].length).to eq(6)
|
196
|
-
expect(json["author"][2]).to eq("@id"=>"https://orcid.org/0000-0002-8862-1404", "@type"=>"Person", "familyName"=>"Stacy", "givenName"=>"Erin", "name"=>"Erin Stacy")
|
198
|
+
expect(json["author"][2]).to eq("@id"=>"https://orcid.org/0000-0002-8862-1404", "@type"=>"Person", "familyName"=>"Stacy", "givenName"=>"Erin", "name"=>"Erin Stacy", "affiliation" => {"@type"=>"Organization", "name"=>"UC Merced"})
|
197
199
|
expect(json["includedInDataCatalog"]).to be_nil
|
198
|
-
expect(json["spatialCoverage"]).to eq("@type"=>"Place",
|
200
|
+
expect(json["spatialCoverage"]).to eq([{"@type"=>"Place",
|
201
|
+
"geo"=>
|
202
|
+
{"@type"=>"GeoCoordinates",
|
203
|
+
"address"=>"Providence Creek (Lower, Upper and P301)",
|
204
|
+
"latitude"=>"37.047756",
|
205
|
+
"longitude"=>"-119.221094"}},
|
206
|
+
{"@type"=>"Place",
|
207
|
+
"geo"=>
|
208
|
+
{"@type"=>"GeoShape",
|
209
|
+
"address"=>"Providence Creek (Lower, Upper and P301)",
|
210
|
+
"box"=>"37.046 -119.211 37.075 -119.182"}}])
|
199
211
|
end
|
200
212
|
|
201
213
|
it "geo_location_box" do
|
@@ -208,23 +220,37 @@ describe Bolognese::Metadata, vcr: true do
|
|
208
220
|
expect(json["author"]).to eq([{"@type"=>"Person",
|
209
221
|
"familyName"=>"Tara Oceans Consortium",
|
210
222
|
"givenName"=>"Coordinators",
|
211
|
-
"name"=>"Tara Oceans Consortium
|
223
|
+
"name"=>"Coordinators Tara Oceans Consortium"},
|
212
224
|
{"@type"=>"Person",
|
213
225
|
"familyName"=>"Tara Oceans Expedition",
|
214
226
|
"givenName"=>"Participants",
|
215
|
-
"name"=>"Tara Oceans Expedition
|
227
|
+
"name"=>"Participants Tara Oceans Expedition"}])
|
216
228
|
expect(json["includedInDataCatalog"]).to be_nil
|
217
|
-
expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"
|
229
|
+
expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.1594/pangaea.842237")
|
218
230
|
expect(json["spatialCoverage"]).to eq("@type"=>"Place", "geo"=>{"@type"=>"GeoShape", "box"=>"-64.3088 -168.5182 79.6753 174.9006"})
|
219
231
|
end
|
220
232
|
|
233
|
+
it "geo_location_polygon" do
|
234
|
+
input = fixture_path + 'datacite-example-polygon-v4.1.xml'
|
235
|
+
subject = Bolognese::Metadata.new(input: input)
|
236
|
+
json = JSON.parse(subject.schema_org)
|
237
|
+
expect(json["@id"]).to eq("https://doi.org/10.5072/example-polygon")
|
238
|
+
expect(json["@type"]).to eq("Dataset")
|
239
|
+
expect(json["name"]).to eq("Meteo measurements at the Sand Motor")
|
240
|
+
expect(json["author"]).to eq("@type"=>"Person", "familyName"=>"Den Heijer", "givenName"=>"C", "name"=>"C Den Heijer")
|
241
|
+
expect(json["includedInDataCatalog"]).to be_nil
|
242
|
+
expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.5072/example-polygon")
|
243
|
+
expect(json["spatialCoverage"].dig("geo", "polygon").length).to eq(34)
|
244
|
+
expect(json["spatialCoverage"].dig("geo", "polygon").first).to eq(["4.1738852605822", "52.03913926329928"])
|
245
|
+
end
|
246
|
+
|
221
247
|
it "from schema_org gtex" do
|
222
248
|
input = fixture_path + 'schema_org_gtex.json'
|
223
249
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
224
250
|
json = JSON.parse(subject.schema_org)
|
225
251
|
expect(json["@id"]).to eq("https://doi.org/10.25491/d50j-3083")
|
226
252
|
expect(json["@type"]).to eq("Dataset")
|
227
|
-
expect(json["identifier"]).to eq([{"@type"=>"PropertyValue", "propertyID"=>"
|
253
|
+
expect(json["identifier"]).to eq([{"@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.25491/d50j-3083"}, {"@type"=>"PropertyValue", "propertyID"=>"md5", "value"=>"687610993"}])
|
228
254
|
expect(json["url"]).to eq("https://ors.datacite.org/doi:/10.25491/d50j-3083")
|
229
255
|
expect(json["additionalType"]).to eq("Gene expression matrices")
|
230
256
|
expect(json["name"]).to eq("Fully processed, filtered and normalized gene expression matrices (in BED format) for each tissue, which were used as input into FastQTL for eQTL discovery")
|
@@ -268,7 +294,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
268
294
|
expect(json["@type"]).to eq("Dataset")
|
269
295
|
expect(json["identifier"]).to eq(
|
270
296
|
[{"@type"=>"PropertyValue",
|
271
|
-
"propertyID"=>"
|
297
|
+
"propertyID"=>"DOI",
|
272
298
|
"value"=>"https://doi.org/10.23725/8na3-9s47"},
|
273
299
|
{"@type"=>"PropertyValue",
|
274
300
|
"propertyID"=>"md5",
|
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: 1.0.
|
4
|
+
version: 1.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -672,10 +672,12 @@ files:
|
|
672
672
|
- spec/fixtures/datacite-example-complicated-v4.1.xml
|
673
673
|
- spec/fixtures/datacite-example-geolocation-2.xml
|
674
674
|
- spec/fixtures/datacite-example-geolocation.xml
|
675
|
+
- spec/fixtures/datacite-example-polygon-v4.1.xml
|
675
676
|
- spec/fixtures/datacite-geolocation-empty.xml
|
676
677
|
- spec/fixtures/datacite-metadata-sample-complicated-v2.2.xml
|
677
678
|
- spec/fixtures/datacite-multiple-language.xml
|
678
679
|
- spec/fixtures/datacite-multiple-rights.xml
|
680
|
+
- spec/fixtures/datacite-seriesinformation.xml
|
679
681
|
- spec/fixtures/datacite-xml-lang.xml
|
680
682
|
- spec/fixtures/datacite.json
|
681
683
|
- spec/fixtures/datacite.xml
|
@@ -847,6 +849,10 @@ files:
|
|
847
849
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/harvard_dataverse_via_identifiers_org.yml
|
848
850
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/pangaea.yml
|
849
851
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/zenodo.yml
|
852
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/only_title.yml
|
853
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/title_and_pages.yml
|
854
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/title_volume_and_pages.yml
|
855
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_series_information/title_volume_issue_and_pages.yml
|
850
856
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/github/github_as_codemeta_url.yml
|
851
857
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/github/github_from_url.yml
|
852
858
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/github/github_from_url_file.yml
|
@@ -873,6 +879,7 @@ files:
|
|
873
879
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_id.yml
|
874
880
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_known_given_name.yml
|
875
881
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_no_info.yml
|
882
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_orcid_id.yml
|
876
883
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_type_organization.yml
|
877
884
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/missing_comma.yml
|
878
885
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/nil.yml
|
@@ -913,6 +920,7 @@ files:
|
|
913
920
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/sanitize/should_remove_a_tags.yml
|
914
921
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/to_schema_org/with_id.yml
|
915
922
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/to_schema_org_identifier/with_alternate_identifier.yml
|
923
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/to_schema_org_identifiers/with_identifiers.yml
|
916
924
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid.yml
|
917
925
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_https.yml
|
918
926
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_id.yml
|