bolognese 0.15.9 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -6
  3. data/bolognese.gemspec +1 -0
  4. data/lib/bolognese/datacite_utils.rb +19 -51
  5. data/lib/bolognese/doi_utils.rb +1 -1
  6. data/lib/bolognese/metadata_utils.rb +43 -125
  7. data/lib/bolognese/readers/bibtex_reader.rb +21 -10
  8. data/lib/bolognese/readers/citeproc_reader.rb +20 -12
  9. data/lib/bolognese/readers/codemeta_reader.rb +8 -3
  10. data/lib/bolognese/readers/crossref_reader.rb +41 -50
  11. data/lib/bolognese/readers/datacite_json_reader.rb +17 -40
  12. data/lib/bolognese/readers/datacite_reader.rb +78 -93
  13. data/lib/bolognese/readers/ris_reader.rb +20 -11
  14. data/lib/bolognese/readers/schema_org_reader.rb +62 -29
  15. data/lib/bolognese/utils.rb +90 -17
  16. data/lib/bolognese/version.rb +1 -1
  17. data/lib/bolognese/writers/bibtex_writer.rb +2 -2
  18. data/lib/bolognese/writers/codemeta_writer.rb +1 -2
  19. data/lib/bolognese/writers/crosscite_writer.rb +10 -29
  20. data/lib/bolognese/writers/datacite_json_writer.rb +18 -28
  21. data/lib/bolognese/writers/jats_writer.rb +4 -4
  22. data/lib/bolognese/writers/ris_writer.rb +3 -2
  23. data/lib/bolognese/writers/schema_org_writer.rb +16 -15
  24. data/spec/author_utils_spec.rb +3 -3
  25. data/spec/datacite_utils_spec.rb +4 -14
  26. data/spec/fixtures/crosscite.json +3 -3
  27. data/spec/fixtures/crossref.ris +1 -0
  28. data/spec/fixtures/datacite-example-geolocation-2.xml +140 -0
  29. data/spec/fixtures/datacite-example-geolocation.xml +66 -0
  30. data/spec/fixtures/datacite.json +33 -12
  31. data/spec/fixtures/datacite_software_missing_comma.json +1 -1
  32. data/spec/fixtures/schema_org_geolocation.json +82 -0
  33. data/spec/fixtures/schema_org_geoshape.json +550 -0
  34. data/spec/fixtures/schema_org_gtex.json +1 -1
  35. data/spec/fixtures/schema_org_list.json +1 -1
  36. data/spec/fixtures/schema_org_topmed.json +1 -1
  37. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/default.yml +3 -3
  38. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_bibtex.yml +3 -3
  39. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_citation.yml +4 -4
  40. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_crossref.yml +3 -3
  41. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_datacite.yml +3 -3
  42. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_jats.yml +3 -3
  43. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_schema_org.yml +3 -3
  44. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/default.yml +3 -3
  45. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_bibtex.yml +3 -3
  46. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_citation.yml +4 -4
  47. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite.yml +3 -3
  48. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite_json.yml +3 -3
  49. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_jats.yml +3 -3
  50. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_schema_org.yml +3 -3
  51. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/find_from_format_by_id/crossref.yml +2 -2
  52. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/find_from_format_by_id/datacite.yml +2 -2
  53. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/change_datacite_metadata/change_state.yml +3 -3
  54. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/change_datacite_metadata/change_title.yml +3 -3
  55. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/crossref.yml +3 -3
  56. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/datacite.yml +11 -11
  57. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/medra.yml +3 -3
  58. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/not_found.yml +3 -3
  59. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref.yml +5 -5
  60. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +5 -5
  61. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite.yml +5 -5
  62. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite_doi_http.yml +5 -5
  63. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/github.yml +3 -3
  64. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/orcid.yml +3 -3
  65. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/schema_org.yml +3 -3
  66. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml +5 -5
  67. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/bibtex.yml +3 -3
  68. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/citeproc.yml +3 -3
  69. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/codemeta.yml +3 -3
  70. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crosscite.yml +3 -3
  71. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crossref.yml +3 -3
  72. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite.yml +3 -3
  73. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite_json.yml +3 -3
  74. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/ris.yml +3 -3
  75. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/schema_org.yml +3 -3
  76. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_string/crosscite.yml +3 -3
  77. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/DOI_with_ORCID_ID.yml +3 -3
  78. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/DOI_with_SICI_DOI.yml +3 -3
  79. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/DOI_with_data_citation.yml +3 -3
  80. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/book_chapter.yml +3 -3
  81. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/dataset.yml +3 -3
  82. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/date_in_future.yml +3 -3
  83. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/journal_article.yml +3 -3
  84. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/journal_article_with.yml +3 -3
  85. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/not_found_error.yml +3 -3
  86. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/posted_content.yml +3 -3
  87. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/BlogPosting.yml +3 -3
  88. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/DOI_in_test_system.yml +3 -3
  89. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/DOI_in_with_related_id_system.yml +3 -3
  90. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/DOI_not_found.yml +3 -3
  91. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Dataset.yml +3 -3
  92. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding.yml +3 -3
  93. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding_schema_version_4.yml +3 -3
  94. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Referee_report_in_test_system.yml +3 -3
  95. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_only_full_name.yml +3 -3
  96. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_scheme.yml +3 -3
  97. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_wrong_orcid_scheme.yml +3 -3
  98. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/content_url.yml +12 -12
  99. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/date.yml +3 -3
  100. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/dissertation.yml +3 -3
  101. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/doi_with_sign.yml +3 -3
  102. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/empty_subject.yml +3 -3
  103. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/funding_schema_version_3.yml +3 -3
  104. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/is_identical_to.yml +3 -3
  105. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/keywords_with_attributes.yml +3 -3
  106. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/leading_and_trailing_whitespace.yml +3 -3
  107. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/multiple_author_names_in_one_creatorName.yml +3 -3
  108. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/multiple_licenses.yml +3 -3
  109. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/series-information.yml +3 -3
  110. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/subject_scheme.yml +3 -3
  111. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/xs_string_attributes.yml +3 -3
  112. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml +2 -2
  113. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/unknown_DOI_prefix.yml +2 -2
  114. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/missing_comma.yml +3 -3
  115. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/nil.yml +3 -3
  116. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/overlapping_keys.yml +3 -3
  117. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/valid.yml +3 -3
  118. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/BlogPosting_schema_org.yml +16 -20
  119. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/geo_location_box.yml +42 -0
  120. data/spec/readers/bibtex_reader_spec.rb +5 -5
  121. data/spec/readers/citeproc_reader_spec.rb +1 -2
  122. data/spec/readers/codemeta_reader_spec.rb +9 -9
  123. data/spec/readers/crosscite_reader_spec.rb +2 -2
  124. data/spec/readers/crossref_reader_spec.rb +55 -48
  125. data/spec/readers/datacite_json_reader_spec.rb +5 -4
  126. data/spec/readers/datacite_reader_spec.rb +150 -114
  127. data/spec/readers/ris_reader_spec.rb +5 -5
  128. data/spec/readers/schema_org_reader_spec.rb +62 -48
  129. data/spec/utils_spec.rb +4 -4
  130. data/spec/writers/crosscite_writer_spec.rb +21 -17
  131. data/spec/writers/datacite_json_writer_spec.rb +8 -8
  132. data/spec/writers/datacite_writer_spec.rb +17 -18
  133. data/spec/writers/ris_writer_spec.rb +26 -18
  134. data/spec/writers/schema_org_writer_spec.rb +45 -18
  135. data/spec/writers/turtle_writer_spec.rb +1 -1
  136. metadata +22 -3
@@ -17,8 +17,10 @@ describe Bolognese::Metadata, vcr: true do
17
17
  expect(ris[9]).to eq("UR - https://elifesciences.org/articles/01567")
18
18
  expect(ris[10]).to start_with("AB - Among various advantages")
19
19
  expect(ris[11]).to eq("PY - 2014")
20
- expect(ris[12]).to eq("VL - 3")
21
- expect(ris[13]).to eq("ER - ")
20
+ expect(ris[12]).to eq("PB - (:unav)")
21
+ expect(ris[13]).to eq("VL - 3")
22
+ expect(ris[14]).to eq("SN - 2050-084X")
23
+ expect(ris[15]).to eq("ER - ")
22
24
  end
23
25
 
24
26
  it "with pages" do
@@ -34,10 +36,12 @@ describe Bolognese::Metadata, vcr: true do
34
36
  expect(ris[11]).to eq("UR - http://www.hindawi.com/journals/pm/2012/291294/")
35
37
  expect(ris[12]).to start_with("AB - . To find a statistically significant separation point for the QuantiFERON")
36
38
  expect(ris[13]).to eq("PY - 2012")
37
- expect(ris[14]).to eq("VL - 2012")
38
- expect(ris[15]).to eq("SP - 1")
39
- expect(ris[16]).to eq("EP - 7")
40
- expect(ris[17]).to eq("ER - ")
39
+ expect(ris[14]).to eq("PB - (:unav)")
40
+ expect(ris[15]).to eq("VL - 2012")
41
+ expect(ris[16]).to eq("SP - 1")
42
+ expect(ris[17]).to eq("EP - 7")
43
+ expect(ris[18]).to eq("SN - 2090-1836")
44
+ expect(ris[19]).to eq("ER - ")
41
45
  end
42
46
 
43
47
  it "alternate name" do
@@ -55,7 +59,8 @@ describe Bolognese::Metadata, vcr: true do
55
59
  expect(ris[21]).to eq("PY - 2017")
56
60
  expect(ris[22]).to eq("PB - German Medical Science GMS Publishing House")
57
61
  expect(ris[23]).to eq("LA - en")
58
- expect(ris[24]).to eq("ER - ")
62
+ expect(ris[24]).to eq("SN - 2366-5017")
63
+ expect(ris[25]).to eq("ER - ")
59
64
  end
60
65
 
61
66
  it "Crossref DOI" do
@@ -72,7 +77,8 @@ describe Bolognese::Metadata, vcr: true do
72
77
  expect(ris[11]).to eq("PY - 2014")
73
78
  expect(ris[12]).to eq("PB - {eLife} Sciences Organisation, Ltd.")
74
79
  expect(ris[13]).to eq("VL - 3")
75
- expect(ris[14]).to eq("ER - ")
80
+ expect(ris[14]).to eq("SN - 2050-084X")
81
+ expect(ris[15]).to eq("ER - ")
76
82
  end
77
83
 
78
84
  it "BlogPosting" do
@@ -88,7 +94,8 @@ describe Bolognese::Metadata, vcr: true do
88
94
  expect(ris[5]).to eq("KW - datacite")
89
95
  expect(ris[8]).to eq("PY - 2016")
90
96
  expect(ris[9]).to eq("PB - DataCite")
91
- expect(ris[10]).to eq("ER - ")
97
+ expect(ris[10]).to eq("SN - 10.5438/0000-00ss")
98
+ expect(ris[11]).to eq("ER - ")
92
99
  end
93
100
 
94
101
  it "BlogPosting Citeproc JSON" do
@@ -120,7 +127,8 @@ describe Bolognese::Metadata, vcr: true do
120
127
  expect(ris[5]).to eq("KW - datacite")
121
128
  expect(ris[8]).to eq("PY - 2016")
122
129
  expect(ris[9]).to eq("PB - DataCite")
123
- expect(ris[10]).to eq("ER - ")
130
+ expect(ris[10]).to eq("SN - 10.5438/0000-00ss")
131
+ expect(ris[11]).to eq("ER - ")
124
132
  end
125
133
 
126
134
  it "BlogPosting schema.org" do
@@ -129,14 +137,14 @@ describe Bolognese::Metadata, vcr: true do
129
137
  ris = subject.ris.split("\r\n")
130
138
  expect(ris[0]).to eq("TY - GEN")
131
139
  expect(ris[1]).to eq("T1 - Eating your own Dog Food")
132
- expect(ris[2]).to eq("T2 - DataCite Blog")
133
- expect(ris[3]).to eq("AU - Fenner, Martin")
134
- expect(ris[4]).to eq("DO - 10.5438/4k3m-nyvg")
135
- expect(ris[5]).to eq("UR - https://blog.datacite.org/eating-your-own-dog-food")
136
- expect(ris[6]).to eq("AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...")
137
- expect(ris[7]).to eq("KW - datacite")
138
- expect(ris[11]).to eq("PY - 2016")
139
- expect(ris[12]).to eq("PB - DataCite")
140
+ expect(ris[2]).to eq("AU - Fenner, Martin")
141
+ expect(ris[3]).to eq("DO - 10.5438/4k3m-nyvg")
142
+ expect(ris[4]).to eq("UR - https://blog.datacite.org/eating-your-own-dog-food")
143
+ expect(ris[5]).to eq("AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...")
144
+ expect(ris[6]).to eq("KW - datacite")
145
+ expect(ris[10]).to eq("PY - 2016")
146
+ expect(ris[11]).to eq("PB - DataCite")
147
+ expect(ris[12]).to eq("SN - 10.5438/0000-00ss")
140
148
  expect(ris[13]).to eq("ER - ")
141
149
  end
142
150
 
@@ -10,9 +10,10 @@ 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", "name"=>"eLife", "issn"=>"2050-084X")
13
+ expect(json["periodical"]).to eq("@type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
13
14
  expect(json["citation"].length).to eq(26)
14
15
  expect(json["citation"].first).to eq("@id"=>"https://doi.org/10.1038/nature02100", "@type"=>"CreativeWork", "name" => "APL regulates vascular tissue identity in Arabidopsis")
15
- expect(json["funding"]).to eq([{"name"=>"SystemsX", "@type"=>"Organization"},
16
+ expect(json["funder"]).to eq([{"name"=>"SystemsX", "@type"=>"Organization"},
16
17
  {"name"=>"EMBO",
17
18
  "@type"=>"Organization",
18
19
  "@id"=>"https://doi.org/10.13039/501100003043"},
@@ -47,7 +48,8 @@ describe Bolognese::Metadata, vcr: true do
47
48
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
48
49
  json = JSON.parse(subject.schema_org)
49
50
  expect(json["@id"]).to eq("https://doi.org/10.5061/dryad.8515")
50
- expect(json["@reverse"]).to eq("citation"=>{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446"}, "isBasedOn"=>{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446"})
51
+ expect(json["@reverse"]).to eq("citation" => [{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446", "@type"=>"CreativeWork"}, {"@type"=>"CreativeWork", "identifier"=>{"@type"=>"PropertyValue", "propertyID"=>"PMID", "value"=>"19478877"}}],
52
+ "isBasedOn" => [{"@id"=>"https://doi.org/10.1371/journal.ppat.1000446", "@type"=>"CreativeWork"}, {"@type"=>"CreativeWork", "identifier"=>{"@type"=>"PropertyValue", "propertyID"=>"PMID", "value"=>"19478877"}}])
51
53
  end
52
54
 
53
55
  it "Schema.org JSON IsSupplementTo" do
@@ -55,7 +57,7 @@ describe Bolognese::Metadata, vcr: true do
55
57
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
56
58
  json = JSON.parse(subject.schema_org)
57
59
  expect(json["@id"]).to eq("https://doi.org/10.5517/cc8h01s")
58
- expect(json["@reverse"]).to eq("isBasedOn"=>{"@id"=>"https://doi.org/10.1107/s1600536804021154"})
60
+ expect(json["@reverse"]).to eq("isBasedOn"=>{"@id"=>"https://doi.org/10.1107/s1600536804021154", "@type"=>"CreativeWork"})
59
61
  end
60
62
 
61
63
  it "rdataone" do
@@ -86,11 +88,7 @@ describe Bolognese::Metadata, vcr: true do
86
88
  expect(json["@id"]).to eq("https://doi.org/10.5438/6423")
87
89
  expect(json["hasPart"].length).to eq(25)
88
90
  expect(json["hasPart"].first).to eq("@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5281/zenodo.30799")
89
- expect(json["funding"]).to eq("@type" => "Award",
90
- "funder" => {"@type"=>"Organization", "@id"=>"https://doi.org/10.13039/501100000780", "name"=>"European Commission"},
91
- "identifier" => "654039",
92
- "name" => "THOR – Technical and Human Infrastructure for Open Research",
93
- "url" => "http://cordis.europa.eu/project/rcn/194927_en.html")
91
+ expect(json["funder"]).to eq("@id"=>"https://doi.org/10.13039/501100000780", "@type"=>"Organization", "name"=>"European Commission")
94
92
  end
95
93
 
96
94
  it "Funding OpenAIRE" do
@@ -98,11 +96,7 @@ describe Bolognese::Metadata, vcr: true do
98
96
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
99
97
  json = JSON.parse(subject.schema_org)
100
98
  expect(json["@id"]).to eq("https://doi.org/10.5281/zenodo.1239")
101
- expect(json["funding"]).to eq("@type" => "Award",
102
- "funder" => {"@type"=>"Organization", "@id"=>"https://doi.org/10.13039/501100000780", "name"=>"European Commission"},
103
- "identifier" => "246686",
104
- "name" => "Open Access Infrastructure for Research in Europe",
105
- "url" => "info:eu-repo/grantAgreement/EC/FP7/246686/")
99
+ expect(json["funder"]).to eq("@id"=>"https://doi.org/10.13039/501100000780", "@type"=>"Organization", "name"=>"European Commission")
106
100
  end
107
101
 
108
102
  it "subject scheme" do
@@ -129,7 +123,6 @@ describe Bolognese::Metadata, vcr: true do
129
123
  content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz"
130
124
  subject = Bolognese::Metadata.new(input: input, b_url: b_url, content_url: content_url, from: "datacite")
131
125
  json = JSON.parse(subject.schema_org)
132
- puts json
133
126
  expect(json["@id"]).to eq("https://doi.org/10.25491/9hx8-ke93")
134
127
  expect(json["author"]).to eq("@type"=>"Organization", "name"=>"The GTEx Consortium")
135
128
  expect(json["url"]).to eq("https://ors.datacite.org/doi:/10.25491/9hx8-ke93")
@@ -137,19 +130,19 @@ describe Bolognese::Metadata, vcr: true do
137
130
  expect(json["contentSize"]).to eq("15.7M")
138
131
  expect(json["contentUrl"]).to eq("https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz")
139
132
  expect(json["includedInDataCatalog"]).to eq("@id"=>"https://www.ebi.ac.uk/miriam/main/datatypes/MIR:00000663", "@type"=>"DataCatalog", "name"=>"GTEx")
140
- expect(json["@reverse"]).to eq("isBasedOn"=>{"@id"=>"https://doi.org/10.1038/nmeth.4407"})
133
+ expect(json["@reverse"]).to eq("isBasedOn"=>{"@id"=>"https://doi.org/10.1038/nmeth.4407", "@type"=>"CreativeWork"})
141
134
  end
142
135
 
143
136
  it "series information" do
144
137
  input = "10.4229/23RDEUPVSEC2008-5CO.8.3"
145
138
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
146
139
  json = JSON.parse(subject.schema_org)
147
- expect(json["isPartOf"]).to eq("@type"=>"Periodical", "name"=>"23rd European Photovoltaic Solar Energy Conference and Exhibition, 1-5 September 2008, Valencia, Spain; 3353-3356")
148
140
  expect(json["@id"]).to eq("https://doi.org/10.4229/23rdeupvsec2008-5co.8.3")
149
141
  expect(json["@type"]).to eq("ScholarlyArticle")
150
142
  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")
151
143
  expect(json["author"].count).to eq(3)
152
144
  expect(json["author"].first).to eq("@type"=>"Person", "name"=>"P. Llamas", "givenName"=>"P.", "familyName"=>"Llamas")
145
+ expect(json["periodical"]).to eq("@type"=>"Periodical", "name"=>"23rd European Photovoltaic Solar Energy Conference and Exhibition, 1-5 September 2008, Valencia, Spain; 3353-3356")
153
146
  end
154
147
 
155
148
  it "data catalog" do
@@ -191,6 +184,40 @@ describe Bolognese::Metadata, vcr: true do
191
184
  expect(json["contentUrl"]).to include("s3://cgp-commons-public/topmed_open_access/197bc047-e917-55ed-852d-d563cdbc50e4/NWD165827.recab.cram", "gs://topmed-irc-share/public/NWD165827.recab.cram")
192
185
  end
193
186
 
187
+ it "geo_location_point" do
188
+ input = fixture_path + 'datacite-example-geolocation-2.xml'
189
+ doi = "10.6071/Z7WC73"
190
+ subject = Bolognese::Metadata.new(input: input, doi: doi)
191
+ json = JSON.parse(subject.schema_org)
192
+ expect(json["@id"]).to eq("https://doi.org/10.6071/z7wc73")
193
+ expect(json["@type"]).to eq("Dataset")
194
+ 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
+ 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")
197
+ expect(json["includedInDataCatalog"]).to be_nil
198
+ expect(json["spatialCoverage"]).to eq("@type"=>"Place", "geo"=>{"@type"=>"GeoCoordinates", "address"=>"Providence Creek (Lower, Upper and P301)", "latitude"=>"37.047756", "longitude"=>"-119.221094"})
199
+ end
200
+
201
+ it "geo_location_box" do
202
+ input = "10.1594/PANGAEA.842237"
203
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
204
+ json = JSON.parse(subject.schema_org)
205
+ expect(json["@id"]).to eq("https://doi.org/10.1594/pangaea.842237")
206
+ expect(json["@type"]).to eq("Dataset")
207
+ expect(json["name"]).to eq("Registry of all stations from the Tara Oceans Expedition (2009-2013)")
208
+ expect(json["author"]).to eq([{"@type"=>"Person",
209
+ "familyName"=>"Tara Oceans Consortium",
210
+ "givenName"=>"Coordinators",
211
+ "name"=>"Tara Oceans Consortium, Coordinators"},
212
+ {"@type"=>"Person",
213
+ "familyName"=>"Tara Oceans Expedition",
214
+ "givenName"=>"Participants",
215
+ "name"=>"Tara Oceans Expedition, Participants"}])
216
+ expect(json["includedInDataCatalog"]).to be_nil
217
+ expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"doi", "value"=>"https://doi.org/10.1594/pangaea.842237")
218
+ expect(json["spatialCoverage"]).to eq("@type"=>"Place", "geo"=>{"@type"=>"GeoShape", "box"=>"-64.3088 -168.5182 79.6753 174.9006"})
219
+ end
220
+
194
221
  it "from schema_org gtex" do
195
222
  input = fixture_path + 'schema_org_gtex.json'
196
223
  subject = Bolognese::Metadata.new(input: input, from: "schema_org")
@@ -209,7 +236,7 @@ describe Bolognese::Metadata, vcr: true do
209
236
  expect(json["schemaVersion"]).to eq("http://datacite.org/schema/kernel-4")
210
237
  expect(json["includedInDataCatalog"]).to eq("@type"=>"DataCatalog", "name"=>"GTEx")
211
238
  expect(json["publisher"]).to eq("@type"=>"Organization", "name"=>"GTEx")
212
- expect(json["funding"]).to eq([{"@id"=>"https://doi.org/10.13039/100000052",
239
+ expect(json["funder"]).to eq([{"@id"=>"https://doi.org/10.13039/100000052",
213
240
  "name"=>"Common Fund of the Office of the Director of the NIH",
214
241
  "@type"=>"Organization"},
215
242
  {"@id"=>"https://doi.org/10.13039/100000054",
@@ -262,7 +289,7 @@ describe Bolognese::Metadata, vcr: true do
262
289
  expect(json["schemaVersion"]).to eq("http://datacite.org/schema/kernel-4")
263
290
  expect(json["publisher"]).to eq("@type"=>"Organization", "name"=>"TOPMed")
264
291
  expect(json["citation"]).to eq("@id"=>"https://doi.org/10.23725/2g4s-qv04", "@type"=>"Dataset")
265
- expect(json["funding"]).to eq("@id"=>"https://doi.org/10.13039/100000050", "@type"=>"Organization", "name"=>"National Heart, Lung, and Blood Institute (NHLBI)")
292
+ expect(json["funder"]).to eq("@id"=>"https://doi.org/10.13039/100000050", "@type"=>"Organization", "name"=>"National Heart, Lung, and Blood Institute (NHLBI)")
266
293
  expect(json["provider"]).to eq("@type"=>"Organization", "name"=>"DataCite")
267
294
  end
268
295
  end
@@ -18,7 +18,7 @@ describe Bolognese::Metadata, vcr: true do
18
18
  expect(subject.valid?).to be true
19
19
  ttl = subject.turtle.split("\n")
20
20
  expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
21
- expect(ttl[2]).to eq("<https://doi.org/10.1371/journal.ppat.1000446> schema:citation <https://doi.org/10.5061/dryad.8515>;")
21
+ expect(ttl[2]).to eq("<https://doi.org/10.1371/journal.ppat.1000446> a schema:CreativeWork;")
22
22
  end
23
23
 
24
24
  # it "BlogPosting" 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.15.9
4
+ version: '1.0'
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-11-23 00:00:00.000000000 Z
11
+ date: 2018-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -358,6 +358,20 @@ dependencies:
358
358
  - - "~>"
359
359
  - !ruby/object:Gem::Version
360
360
  version: 0.1.2
361
+ - !ruby/object:Gem::Dependency
362
+ name: concurrent-ruby
363
+ requirement: !ruby/object:Gem::Requirement
364
+ requirements:
365
+ - - "~>"
366
+ - !ruby/object:Gem::Version
367
+ version: 1.0.5
368
+ type: :runtime
369
+ prerelease: false
370
+ version_requirements: !ruby/object:Gem::Requirement
371
+ requirements:
372
+ - - "~>"
373
+ - !ruby/object:Gem::Version
374
+ version: 1.0.5
361
375
  - !ruby/object:Gem::Dependency
362
376
  name: bundler
363
377
  requirement: !ruby/object:Gem::Requirement
@@ -655,6 +669,8 @@ files:
655
669
  - spec/fixtures/datacite-example-complicated-v3.0.xml
656
670
  - spec/fixtures/datacite-example-complicated-v4.0.xml
657
671
  - spec/fixtures/datacite-example-complicated-v4.1.xml
672
+ - spec/fixtures/datacite-example-geolocation-2.xml
673
+ - spec/fixtures/datacite-example-geolocation.xml
658
674
  - spec/fixtures/datacite-metadata-sample-complicated-v2.2.xml
659
675
  - spec/fixtures/datacite.json
660
676
  - spec/fixtures/datacite.xml
@@ -672,6 +688,8 @@ files:
672
688
  - spec/fixtures/pure.ris
673
689
  - spec/fixtures/schema_4.0.xml
674
690
  - spec/fixtures/schema_org.json
691
+ - spec/fixtures/schema_org_geolocation.json
692
+ - spec/fixtures/schema_org_geoshape.json
675
693
  - spec/fixtures/schema_org_gtex.json
676
694
  - spec/fixtures/schema_org_list.json
677
695
  - spec/fixtures/schema_org_topmed.json
@@ -970,6 +988,7 @@ files:
970
988
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Schema_org_JSON_isReferencedBy.yml
971
989
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/alternate_identifiers.yml
972
990
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/data_catalog.yml
991
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/geo_location_box.yml
973
992
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/journal_article.yml
974
993
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/maremma_schema_org_JSON.yml
975
994
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/series_information.yml
@@ -1024,7 +1043,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1024
1043
  version: '0'
1025
1044
  requirements: []
1026
1045
  rubyforge_project:
1027
- rubygems_version: 2.7.8
1046
+ rubygems_version: 2.7.7
1028
1047
  signing_key:
1029
1048
  specification_version: 4
1030
1049
  summary: Ruby client library for conversion of DOI Metadata