bolognese 0.9.91 → 0.9.92

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/bolognese/author_utils.rb +4 -2
  4. data/lib/bolognese/metadata.rb +1 -1
  5. data/lib/bolognese/readers/schema_org_reader.rb +19 -5
  6. data/lib/bolognese/utils.rb +2 -2
  7. data/lib/bolognese/version.rb +1 -1
  8. data/spec/author_utils_spec.rb +6 -0
  9. data/spec/find_from_format_spec.rb +30 -0
  10. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/find_from_format_by_id/crossref.yml +48 -0
  11. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/find_from_format_by_id/datacite.yml +50 -0
  12. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref.yml +36 -33
  13. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +36 -33
  14. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite.yml +39 -33
  15. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite_doi_http.yml +39 -33
  16. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/github.yml +26 -23
  17. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/orcid.yml +26 -23
  18. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/schema_org.yml +26 -23
  19. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml +34 -31
  20. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/only_familyName_and_givenName.yml +45 -0
  21. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/harvard_dataverse.yml +37 -0
  22. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/ornl_daac.yml +734 -0
  23. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/pangaea.yml +45 -0
  24. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/zenodo.yml +481 -0
  25. data/spec/readers/schema_org_reader_spec.rb +56 -0
  26. metadata +10 -2
@@ -49,6 +49,62 @@ describe Bolognese::Metadata, vcr: true do
49
49
  expect(subject.exists?).to be false
50
50
  expect(subject.state).to eq("not_found")
51
51
  end
52
+
53
+ it "zenodo" do
54
+ input = "https://www.zenodo.org/record/1196821"
55
+ subject = Bolognese::Metadata.new(input: input, from: "schema_org", doi: nil)
56
+ subject.id = "https://doi.org/10.5438/0000-00ss"
57
+ #expect(subject.errors.size).to eq(2)
58
+ 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'.")
59
+ expect(subject.id).to eq("https://doi.org/10.5438/0000-00ss")
60
+ expect(subject.doi).to eq("10.5438/0000-00ss")
61
+ expect(subject.b_url).to eq("https://www.zenodo.org/record/1196821")
62
+ expect(subject.type).to eq("Dataset")
63
+ expect(subject.title).to eq("PsPM-SC4B: SCR, ECG, EMG, PSR and respiration measurements in a delay fear conditioning task with auditory CS and electrical US")
64
+ expect(subject.author.size).to eq(6)
65
+ expect(subject.author.first).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0001-9688-838X", "name"=>"Matthias Staib", "givenName"=>"Matthias", "familyName"=>"Staib")
66
+ end
67
+
68
+ it "pangaea" do
69
+ input = "https://doi.pangaea.de/10.1594/PANGAEA.836178"
70
+ subject = Bolognese::Metadata.new(input: input, from: "schema_org", doi: nil)
71
+ subject.id = "https://doi.org/10.5438/0000-00ss"
72
+ expect(subject.valid?).to be true
73
+ expect(subject.id).to eq("https://doi.org/10.5438/0000-00ss")
74
+ expect(subject.doi).to eq("10.5438/0000-00ss")
75
+ expect(subject.b_url).to eq("https://doi.pangaea.de/10.1594/PANGAEA.836178")
76
+ expect(subject.type).to eq("Dataset")
77
+ expect(subject.title).to eq("Hydrological and meteorological investigations in a lake near Kangerlussuaq, west Greenland")
78
+ expect(subject.author.size).to eq(8)
79
+ expect(subject.author.first).to eq("type"=>"Person", "name"=>"Johansson, Emma", "givenName"=>"Emma", "familyName"=>"Johansson")
80
+ end
81
+
82
+ it "ornl daac" do
83
+ input = "https://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=1418"
84
+ subject = Bolognese::Metadata.new(input: input, from: "schema_org")
85
+ subject.id = "https://doi.org/10.3334/ornldaac/1418"
86
+ expect(subject.valid?).to be true
87
+ expect(subject.id).to eq("https://doi.org/10.3334/ornldaac/1418")
88
+ expect(subject.doi).to eq("10.3334/ornldaac/1418")
89
+ expect(subject.b_url).to eq("https://doi.org/10.3334/ornldaac/1418")
90
+ expect(subject.type).to eq("DataSet")
91
+ expect(subject.title).to eq("AirMOSS: L2/3 Volumetric Soil Moisture Profiles Derived From Radar, 2012-2015")
92
+ expect(subject.author.size).to eq(8)
93
+ expect(subject.author.first).to eq("type"=>"Person", "name"=>"M. MOGHADDAM", "givenName"=>"M.", "familyName"=>"MOGHADDAM")
94
+ end
95
+
96
+ it "harvard dataverse" do
97
+ input = "https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/GAOC03"
98
+ subject = Bolognese::Metadata.new(input: input, from: "schema_org", doi: nil)
99
+ subject.id = "https://doi.org/10.3334/ornldaac/1418"
100
+ expect(subject.valid?).to be true
101
+ expect(subject.id).to eq("https://doi.org/10.3334/ornldaac/1418")
102
+ expect(subject.doi).to eq("10.3334/ornldaac/1418")
103
+ expect(subject.type).to eq("Dataset")
104
+ expect(subject.title).to eq("The National Labor Force : SAKERNAS, 2008")
105
+ expect(subject.container_title).to eq("Harvard Dataverse")
106
+ expect(subject.author).to eq("name"=>"Badan Pusat Statistik")
107
+ end
52
108
  end
53
109
 
54
110
  context "get schema_org metadata as string" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.91
4
+ version: 0.9.92
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-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -545,6 +545,7 @@ files:
545
545
  - spec/cli_spec.rb
546
546
  - spec/datacite_utils_spec.rb
547
547
  - spec/doi_utils_spec.rb
548
+ - spec/find_from_format_spec.rb
548
549
  - spec/fixtures/citeproc.json
549
550
  - spec/fixtures/codemeta.json
550
551
  - spec/fixtures/crosscite.json
@@ -579,6 +580,8 @@ files:
579
580
  - spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_bibtex.yml
580
581
  - spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_datacite.yml
581
582
  - spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_schema_org.yml
583
+ - spec/fixtures/vcr_cassettes/Bolognese_CLI/find_from_format_by_id/crossref.yml
584
+ - spec/fixtures/vcr_cassettes/Bolognese_CLI/find_from_format_by_id/datacite.yml
582
585
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/author.yml
583
586
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/no_author.yml
584
587
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/single_author.yml
@@ -685,9 +688,14 @@ files:
685
688
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_affiliation.yml
686
689
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_affiliation_and_country.yml
687
690
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_role.yml
691
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/only_familyName_and_givenName.yml
688
692
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/BlogPosting.yml
689
693
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/BlogPosting_with_new_DOI.yml
694
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/harvard_dataverse.yml
690
695
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/not_found_error.yml
696
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/ornl_daac.yml
697
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/pangaea.yml
698
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/zenodo.yml
691
699
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml
692
700
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/unknown_DOI_prefix.yml
693
701
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_alternate_identifiers/insert.yml