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
@@ -32,16 +32,16 @@ describe Bolognese::Metadata, vcr: true do
32
32
  expect(subject.type).to eq("ScholarlyArticle")
33
33
  expect(subject.b_url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
34
34
  expect(subject.resource_type_general).to eq("Text")
35
- expect(subject.author.length).to eq(5)
36
- expect(subject.author.first).to eq("type"=>"Person",
35
+ expect(subject.creator.length).to eq(5)
36
+ expect(subject.creator.first).to eq("type"=>"Person",
37
37
  "name"=>"Martial Sankar",
38
38
  "givenName"=>"Martial",
39
39
  "familyName"=>"Sankar")
40
40
  expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
41
41
  expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
42
42
  expect(subject.date_published).to eq("2014")
43
- expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife")
44
- expect(subject.container_title).to eq("eLife")
43
+ expect(subject.related_identifiers).to eq([{"id"=>"2050084X", "related_identifier_type"=>"ISSN", "relation_type"=>"IsPartOf", "title"=>"eLife", "type"=>"Periodical"}])
44
+ expect(subject.periodical).to eq("id"=>"2050084X", "title"=>"eLife", "type"=>"Periodical")
45
45
  end
46
46
 
47
47
  it "DOI does not exist" do
@@ -54,7 +54,7 @@ describe Bolognese::Metadata, vcr: true do
54
54
  expect(subject.ris_type).to eq("THES")
55
55
  expect(subject.type).to eq("Thesis")
56
56
  expect(subject.resource_type_general).to eq("Text")
57
- expect(subject.author).to eq("type"=>"Person", "name"=>"Y. Toparlar", "givenName"=>"Y.", "familyName"=>"Toparlar")
57
+ expect(subject.creator).to eq("type"=>"Person", "name"=>"Y. Toparlar", "givenName"=>"Y.", "familyName"=>"Toparlar")
58
58
  expect(subject.title).to eq("A multiscale analysis of the urban heat island effect")
59
59
  expect(subject.description["text"]).to start_with("Designing the climates of cities")
60
60
  expect(subject.date_published).to eq("2018-04-25")
@@ -22,14 +22,14 @@ describe Bolognese::Metadata, vcr: true do
22
22
  expect(subject.identifier).to eq("https://doi.org/10.5438/4k3m-nyvg")
23
23
  expect(subject.b_url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
24
24
  expect(subject.type).to eq("BlogPosting")
25
- expect(subject.author).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0003-1419-2405", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
25
+ expect(subject.creator).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0003-1419-2405", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
26
26
  expect(subject.title).to eq("Eating your own Dog Food")
27
27
  expect(subject.description["text"]).to start_with("Eating your own dog food")
28
28
  expect(subject.keywords).to eq(["datacite", "doi", "metadata", "featured"])
29
29
  expect(subject.date_published).to eq("2016-12-20")
30
30
  expect(subject.date_modified).to eq("2016-12-20")
31
- expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "title"=>"DataCite Blog")
32
- expect(subject.references).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
31
+ expect(subject.related_identifiers.length).to eq(3)
32
+ expect(subject.related_identifiers.last).to eq("id"=>"10.5438/55e5-t5c0", "related_identifier_type"=>"DOI", "relation_type"=>"References")
33
33
  expect(subject.publisher).to eq("DataCite")
34
34
  end
35
35
 
@@ -52,8 +52,8 @@ describe Bolognese::Metadata, vcr: true do
52
52
  expect(subject.b_url).to eq("https://zenodo.org/record/1196821")
53
53
  expect(subject.type).to eq("Dataset")
54
54
  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")
55
- expect(subject.author.size).to eq(6)
56
- expect(subject.author.first).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0001-9688-838X", "name"=>"Matthias Staib", "givenName"=>"Matthias", "familyName"=>"Staib")
55
+ expect(subject.creator.size).to eq(6)
56
+ expect(subject.creator.first).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0001-9688-838X", "name"=>"Matthias Staib", "givenName"=>"Matthias", "familyName"=>"Staib")
57
57
  end
58
58
 
59
59
  it "pangaea" do
@@ -65,8 +65,8 @@ describe Bolognese::Metadata, vcr: true do
65
65
  expect(subject.b_url).to eq("https://doi.pangaea.de/10.1594/PANGAEA.836178")
66
66
  expect(subject.type).to eq("Dataset")
67
67
  expect(subject.title).to eq("Hydrological and meteorological investigations in a lake near Kangerlussuaq, west Greenland")
68
- expect(subject.author.size).to eq(8)
69
- expect(subject.author.first).to eq("type"=>"Person", "name"=>"Johansson, Emma", "givenName"=>"Emma", "familyName"=>"Johansson")
68
+ expect(subject.creator.size).to eq(8)
69
+ expect(subject.creator.first).to eq("type"=>"Person", "name"=>"Johansson, Emma", "givenName"=>"Emma", "familyName"=>"Johansson")
70
70
  end
71
71
 
72
72
  # service doesn't return html to script
@@ -80,8 +80,8 @@ describe Bolognese::Metadata, vcr: true do
80
80
  # expect(subject.b_url).to eq("https://doi.org/10.3334/ornldaac/1418")
81
81
  # expect(subject.type).to eq("DataSet")
82
82
  # expect(subject.title).to eq("AirMOSS: L2/3 Volumetric Soil Moisture Profiles Derived From Radar, 2012-2015")
83
- # expect(subject.author.size).to eq(8)
84
- # expect(subject.author.first).to eq("type"=>"Person", "name"=>"M. MOGHADDAM", "givenName"=>"M.", "familyName"=>"MOGHADDAM")
83
+ # expect(subject.creator.size).to eq(8)
84
+ # expect(subject.creator.first).to eq("type"=>"Person", "name"=>"M. MOGHADDAM", "givenName"=>"M.", "familyName"=>"MOGHADDAM")
85
85
  # end
86
86
 
87
87
  it "harvard dataverse" do
@@ -92,8 +92,8 @@ describe Bolognese::Metadata, vcr: true do
92
92
  expect(subject.doi).to eq("10.7910/dvn/nj7xso")
93
93
  expect(subject.type).to eq("Dataset")
94
94
  expect(subject.title).to eq("Summary data ankylosing spondylitis GWAS")
95
- expect(subject.container_title).to eq("Harvard Dataverse")
96
- expect(subject.author).to eq("name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)")
95
+ expect(subject.periodical).to eq("title"=>"Harvard Dataverse", "type"=>"DataCatalog", "url"=>"https://dataverse.harvard.edu")
96
+ expect(subject.creator).to eq("name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)")
97
97
  expect(subject.schema_version).to eq("https://schema.org/version/3.3")
98
98
  end
99
99
 
@@ -105,8 +105,8 @@ describe Bolognese::Metadata, vcr: true do
105
105
  expect(subject.doi).to eq("10.7910/dvn/nj7xso")
106
106
  expect(subject.type).to eq("Dataset")
107
107
  expect(subject.title).to eq("Summary data ankylosing spondylitis GWAS")
108
- expect(subject.container_title).to eq("Harvard Dataverse")
109
- expect(subject.author).to eq("name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)")
108
+ expect(subject.periodical).to eq("title"=>"Harvard Dataverse", "type"=>"DataCatalog", "url"=>"https://dataverse.harvard.edu")
109
+ expect(subject.creator).to eq("name" => "International Genetics Of Ankylosing Spondylitis Consortium (IGAS)")
110
110
  end
111
111
  end
112
112
 
@@ -114,18 +114,18 @@ describe Bolognese::Metadata, vcr: true do
114
114
  it "BlogPosting" do
115
115
  input = fixture_path + 'schema_org.json'
116
116
  subject = Bolognese::Metadata.new(input: input)
117
-
117
+ expect(subject.valid?).to be true
118
118
  expect(subject.identifier).to eq("https://doi.org/10.5438/4k3m-nyvg")
119
119
  expect(subject.b_url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
120
120
  expect(subject.type).to eq("BlogPosting")
121
- expect(subject.author).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-1419-2405", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
121
+ expect(subject.creator).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-1419-2405", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
122
122
  expect(subject.title).to eq("Eating your own Dog Food")
123
123
  expect(subject.description["text"]).to start_with("Eating your own dog food")
124
124
  expect(subject.keywords).to eq(["datacite", "doi", "metadata", "featured"])
125
125
  expect(subject.date_published).to eq("2016-12-20")
126
126
  expect(subject.date_modified).to eq("2016-12-20")
127
- expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "title"=>"DataCite Blog")
128
- expect(subject.references).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
127
+ expect(subject.related_identifiers.length).to eq(3)
128
+ expect(subject.related_identifiers.last).to eq("id"=>"10.5438/55e5-t5c0", "related_identifier_type"=>"DOI", "relation_type"=>"References")
129
129
  expect(subject.publisher).to eq("DataCite")
130
130
  end
131
131
 
@@ -135,39 +135,20 @@ describe Bolognese::Metadata, vcr: true do
135
135
 
136
136
  expect(subject.valid?).to be true
137
137
  expect(subject.identifier).to eq("https://doi.org/10.25491/d50j-3083")
138
- expect(subject.alternate_identifier).to eq("name"=>"687610993", "type"=>"md5")
138
+ expect(subject.alternate_identifiers).to eq("name"=>"687610993", "type"=>"md5")
139
139
  expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.25491/d50j-3083")
140
140
  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
141
  expect(subject.type).to eq("Dataset")
142
142
  expect(subject.additional_type).to eq("Gene expression matrices")
143
- expect(subject.author).to eq("name"=>"The GTEx Consortium", "type"=>"Organization")
143
+ expect(subject.creator).to eq("name"=>"The GTEx Consortium", "type"=>"Organization")
144
144
  expect(subject.title).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")
145
145
  expect(subject.b_version).to eq("v7")
146
146
  expect(subject.keywords).to eq(["gtex", "annotation", "phenotype", "gene regulation", "transcriptomics"])
147
147
  expect(subject.date_published).to eq("2017")
148
- expect(subject.container_title).to eq("GTEx")
148
+ expect(subject.periodical).to eq("title"=>"GTEx", "type"=>"DataCatalog")
149
149
  expect(subject.publisher).to eq("GTEx")
150
- expect(subject.funding).to eq([{"id"=>"https://doi.org/10.13039/100000052",
151
- "name"=>"Common Fund of the Office of the Director of the NIH",
152
- "type"=>"Organization"},
153
- {"id"=>"https://doi.org/10.13039/100000054",
154
- "name"=>"National Cancer Institute (NCI)",
155
- "type"=>"Organization"},
156
- {"id"=>"https://doi.org/10.13039/100000051",
157
- "name"=>"National Human Genome Research Institute (NHGRI)",
158
- "type"=>"Organization"},
159
- {"id"=>"https://doi.org/10.13039/100000050",
160
- "name"=>"National Heart, Lung, and Blood Institute (NHLBI)",
161
- "type"=>"Organization"},
162
- {"id"=>"https://doi.org/10.13039/100000026",
163
- "name"=>"National Institute on Drug Abuse (NIDA)",
164
- "type"=>"Organization"},
165
- {"id"=>"https://doi.org/10.13039/100000025",
166
- "name"=>"National Institute of Mental Health (NIMH)",
167
- "type"=>"Organization"},
168
- {"id"=>"https://doi.org/10.13039/100000065",
169
- "name"=>"National Institute of Neurological Disorders and Stroke (NINDS)",
170
- "type"=>"Organization"}])
150
+ expect(subject.funding_references.length).to eq(7)
151
+ expect(subject.funding_references.first).to eq("funder_identifier"=>"https://doi.org/10.13039/100000052", "funder_identifier_type"=>"Crossref Funder ID", "funder_name"=>"Common Fund of the Office of the Director of the NIH")
171
152
  end
172
153
 
173
154
  it "TOPMed dataset" do
@@ -176,18 +157,51 @@ describe Bolognese::Metadata, vcr: true do
176
157
 
177
158
  expect(subject.valid?).to be true
178
159
  expect(subject.identifier).to eq("https://doi.org/10.23725/8na3-9s47")
179
- expect(subject.alternate_identifier).to eq([{"name"=>"3b33f6b9338fccab0901b7d317577ea3", "type"=>"md5"}, {"name"=>"ark:/99999/fk41CrU4eszeLUDe", "type"=>"minid"}, {"name"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7", "type"=>"dataguid"}])
160
+ expect(subject.alternate_identifiers).to eq([{"name"=>"3b33f6b9338fccab0901b7d317577ea3", "type"=>"md5"}, {"name"=>"ark:/99999/fk41CrU4eszeLUDe", "type"=>"minid"}, {"name"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7", "type"=>"dataguid"}])
180
161
  expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.23725/8na3-9s47")
181
162
  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"])
182
163
  expect(subject.type).to eq("Dataset")
183
164
  expect(subject.additional_type).to eq("CRAM file")
184
- expect(subject.author).to eq("name"=>"TOPMed IRC", "type"=>"Organization")
165
+ expect(subject.creator).to eq("name"=>"TOPMed IRC", "type"=>"Organization")
185
166
  expect(subject.title).to eq("NWD165827.recab.cram")
186
167
  expect(subject.keywords).to eq(["topmed", "whole genome sequencing"])
187
168
  expect(subject.date_published).to eq("2017-11-30")
188
169
  expect(subject.publisher).to eq("TOPMed")
189
- expect(subject.references).to eq("id"=>"https://doi.org/10.23725/2g4s-qv04", "type"=>"Dataset")
190
- expect(subject.funding).to eq("id"=>"https://doi.org/10.13039/100000050", "name"=>"National Heart, Lung, and Blood Institute (NHLBI)", "type"=>"Organization")
170
+ expect(subject.related_identifiers).to eq([{"id"=>"10.23725/2g4s-qv04", "related_identifier_type"=>"DOI", "relation_type"=>"References", "resource_type_general"=>"Dataset"}])
171
+ expect(subject.funding_references).to eq([{"funder_identifier"=>"https://doi.org/10.13039/100000050", "funder_identifier_type"=>"Crossref Funder ID", "funder_name"=>"National Heart, Lung, and Blood Institute (NHLBI)"}])
172
+ end
173
+
174
+ it "geolocation" do
175
+ input = fixture_path + 'schema_org_geolocation.json'
176
+ subject = Bolognese::Metadata.new(input: input)
177
+
178
+ expect(subject.valid?).to be true
179
+ expect(subject.identifier).to eq("https://doi.org/10.6071/z7wc73")
180
+ expect(subject.type).to eq("Dataset")
181
+ expect(subject.additional_type).to eq("dataset")
182
+ expect(subject.creator.length).to eq(6)
183
+ expect(subject.creator.first).to eq("familyName"=>"Bales", "givenName"=>"Roger", "name"=>"Roger Bales", "type"=>"Person")
184
+ expect(subject.title).to eq("Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature")
185
+ expect(subject.keywords).to eq(["Earth sciences", "soil moisture", "soil temperature", "snow depth", "air temperature", "water balance", "Nevada", "Sierra (mountain range)"])
186
+ expect(subject.date_published).to eq("2013")
187
+ expect(subject.publisher).to eq("UC Merced")
188
+ expect(subject.funding_references).to eq([{"funder_name"=>"National Science Foundation, Division of Earth Sciences, Critical Zone Observatories"}])
189
+ expect(subject.geo_location).to eq([{"geo_location_place"=>"Providence Creek (Lower, Upper and P301)", "geo_location_point"=>{"point_latitude"=>"37.047756", "point_longitude"=>"-119.221094"}}])
190
+ end
191
+
192
+ it "geolocation geoshape" do
193
+ input = fixture_path + 'schema_org_geoshape.json'
194
+ subject = Bolognese::Metadata.new(input: input)
195
+
196
+ expect(subject.valid?).to be true
197
+ expect(subject.identifier).to eq("https://doi.org/10.1594/pangaea.842237")
198
+ expect(subject.type).to eq("Dataset")
199
+ expect(subject.creator.length).to eq(2)
200
+ expect(subject.creator.first).to eq("name"=>"Tara Oceans Consortium, Coordinators", "type"=>"Organization")
201
+ expect(subject.title).to eq("Registry of all stations from the Tara Oceans Expedition (2009-2013)")
202
+ expect(subject.date_published).to eq("2015-02-03")
203
+ expect(subject.publisher).to eq("PANGAEA")
204
+ expect(subject.geo_location).to eq([{"geo_location_box"=>{"east_bound_longitude"=>"174.9006", "north_bound_latitude"=>"79.6753", "south_bound_latitude"=>"-64.3088", "west_bound_longitude"=>"-168.5182"}}])
191
205
  end
192
206
 
193
207
  it "schema_org list" do
@@ -196,17 +210,17 @@ describe Bolognese::Metadata, vcr: true do
196
210
  subject = Bolognese::Metadata.new(input: input)
197
211
  expect(subject.valid?).to be true
198
212
  expect(subject.identifier).to eq("https://doi.org/10.23725/7jg3-v803")
199
- expect(subject.alternate_identifier).to eq([{"name"=>"ark:/99999/fk4E1n6n1YHKxPk", "type"=>"minid"}, {"name"=>"dg.4503/01b048d0-e128-4cb0-94e9-b2d2cab7563d", "type"=>"dataguid"}, {"name"=>"f9e72bdf25bf4b4f0e581d9218fec2eb", "type"=>"md5"}])
213
+ expect(subject.alternate_identifiers).to eq([{"name"=>"ark:/99999/fk4E1n6n1YHKxPk", "type"=>"minid"}, {"name"=>"dg.4503/01b048d0-e128-4cb0-94e9-b2d2cab7563d", "type"=>"dataguid"}, {"name"=>"f9e72bdf25bf4b4f0e581d9218fec2eb", "type"=>"md5"}])
200
214
  expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.23725/7jg3-v803")
201
215
  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"])
202
216
  expect(subject.type).to eq("Dataset")
203
217
  expect(subject.additional_type).to eq("CRAM file")
204
- expect(subject.author).to eq("name"=>"TOPMed", "type"=>"Organization")
218
+ expect(subject.creator).to eq("name"=>"TOPMed", "type"=>"Organization")
205
219
  expect(subject.title).to eq("NWD100953.recab.cram")
206
220
  expect(subject.keywords).to eq(["topmed", "whole genome sequencing"])
207
221
  expect(subject.date_published).to eq("2017-11-30")
208
222
  expect(subject.publisher).to eq("TOPMed")
209
- expect(subject.funding).to eq("id"=>"https://doi.org/10.13039/100000050", "name"=>"National Heart, Lung, and Blood Institute (NHLBI)", "type"=>"Organization")
223
+ expect(subject.funding_references).to eq([{"funder_identifier"=>"https://doi.org/10.13039/100000050", "funder_identifier_type"=>"Crossref Funder ID", "funder_name"=>"National Heart, Lung, and Blood Institute (NHLBI)"}])
210
224
  end
211
225
  end
212
226
  end
@@ -195,13 +195,13 @@ describe Bolognese::Metadata, vcr: true do
195
195
  it "doi" do
196
196
  ids = [{"@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5438/0012"}, {"@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5438/55E5-T5C0"}]
197
197
  response = subject.normalize_ids(ids: ids)
198
- expect(response).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
198
+ expect(response).to eq([{"id"=>"10.5438/0012", "related_identifier_type"=>"DOI"}, {"id"=>"10.5438/55e5-t5c0", "related_identifier_type"=>"DOI"}])
199
199
  end
200
200
 
201
201
  it "url" do
202
202
  ids = [{"@type"=>"CreativeWork", "@id"=>"https://blog.datacite.org/eating-your-own-dog-food/"}]
203
203
  response = subject.normalize_ids(ids: ids)
204
- expect(response).to eq("id"=>"https://blog.datacite.org/eating-your-own-dog-food", "type" => "CreativeWork")
204
+ expect(response).to eq("id"=>"https://blog.datacite.org/eating-your-own-dog-food", "related_identifier_type"=>"URL")
205
205
  end
206
206
  end
207
207
 
@@ -238,8 +238,8 @@ describe Bolognese::Metadata, vcr: true do
238
238
  context "to_schema_org_identifier" do
239
239
  it "with alternate_identifier" do
240
240
  identifier = "https://doi.org/10.23725/8na3-9s47"
241
- alternate_identifier = [{"type"=>"md5", "name"=>"3b33f6b9338fccab0901b7d317577ea3"}, {"type"=>"minid", "name"=>"ark:/99999/fk41CrU4eszeLUDe"}, {"type"=>"dataguid", "name"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7"}]
242
- response = subject.to_schema_org_identifier(identifier, alternate_identifier: alternate_identifier, type: "Dataset")
241
+ alternate_identifiers = [{"type"=>"md5", "name"=>"3b33f6b9338fccab0901b7d317577ea3"}, {"type"=>"minid", "name"=>"ark:/99999/fk41CrU4eszeLUDe"}, {"type"=>"dataguid", "name"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7"}]
242
+ response = subject.to_schema_org_identifier(identifier, alternate_identifiers: alternate_identifiers, type: "Dataset")
243
243
  expect(response).to eq([{"@type"=>"PropertyValue", "propertyID"=>"doi", "value"=>"https://doi.org/10.23725/8na3-9s47"},
244
244
  {"@type"=>"PropertyValue",
245
245
  "propertyID"=>"md5",
@@ -11,9 +11,13 @@ describe Bolognese::Metadata, vcr: true do
11
11
  expect(crosscite.fetch("url")).to eq("https://elifesciences.org/articles/01567")
12
12
  expect(crosscite.fetch("resource_type_general")).to eq("Text")
13
13
  expect(crosscite.fetch("title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
14
- expect(crosscite.fetch("references").length).to eq(26)
15
- expect(crosscite.fetch("references").first).to eq("type"=>"CreativeWork", "id"=>"https://doi.org/10.1038/nature02100", "title"=>"APL regulates vascular tissue identity in Arabidopsis")
16
- expect(crosscite.fetch("license")).to eq("id"=>"http://creativecommons.org/licenses/by/3.0")
14
+ expect(crosscite.fetch("related_identifiers").length).to eq(27)
15
+ expect(crosscite.fetch("related_identifiers").first).to eq("id"=>"2050-084X", "related_identifier_type"=>"ISSN", "relation_type"=>"IsPartOf", "title"=>"eLife", "type"=>"Periodical")
16
+ expect(crosscite.fetch("related_identifiers").last).to eq( +"id" => "10.1038/ncb2764",
17
+ "related_identifier_type" => "DOI",
18
+ "relation_type" => "References",
19
+ "title" => "A screen for morphological complexity identifies regulators of switch-like transitions between discrete cell shapes")
20
+ expect(crosscite.fetch("rights")).to eq("id"=>"http://creativecommons.org/licenses/by/3.0")
17
21
  end
18
22
 
19
23
  it "with ORCID ID" do
@@ -21,8 +25,8 @@ describe Bolognese::Metadata, vcr: true do
21
25
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
22
26
  crosscite = JSON.parse(subject.crosscite)
23
27
  expect(crosscite.fetch("resource_type_general")).to eq("Text")
24
- expect(crosscite.fetch("author").count).to eq(7)
25
- expect(crosscite.fetch("author")[2]).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-2043-4925", "name"=>"Beatriz Hernandez", "givenName"=>"Beatriz", "familyName"=>"Hernandez")
28
+ expect(crosscite.fetch("creator").count).to eq(7)
29
+ expect(crosscite.fetch("creator")[2]).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-2043-4925", "name"=>"Beatriz Hernandez", "givenName"=>"Beatriz", "familyName"=>"Hernandez")
26
30
  end
27
31
 
28
32
  # it "with editor" do
@@ -39,8 +43,8 @@ describe Bolognese::Metadata, vcr: true do
39
43
  expect(crosscite.fetch("resource_type_general")).to eq("Text")
40
44
  expect(crosscite.fetch("title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
41
45
  expect(crosscite.dig("description", "text")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
42
- expect(crosscite.fetch("author").count).to eq(5)
43
- expect(crosscite.fetch("author").first).to eq("type"=>"Person", "name"=>"Martial Sankar", "givenName"=>"Martial", "familyName"=>"Sankar")
46
+ expect(crosscite.fetch("creator").count).to eq(5)
47
+ expect(crosscite.fetch("creator").first).to eq("type"=>"Person", "name"=>"Martial Sankar", "givenName"=>"Martial", "familyName"=>"Sankar")
44
48
  end
45
49
 
46
50
  it "BlogPosting Citeproc JSON" do
@@ -51,7 +55,7 @@ describe Bolognese::Metadata, vcr: true do
51
55
  expect(crosscite["resource_type_general"]).to eq("Text")
52
56
  expect(crosscite.fetch("title")).to eq("Eating your own Dog Food")
53
57
  expect(crosscite.dig("description", "text")).to start_with("Eating your own dog food")
54
- expect(crosscite.fetch("author")).to eq("type"=>"Person", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
58
+ expect(crosscite.fetch("creator")).to eq("type"=>"Person", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
55
59
  end
56
60
 
57
61
  it "rdataone" do
@@ -59,8 +63,8 @@ describe Bolognese::Metadata, vcr: true do
59
63
  subject = Bolognese::Metadata.new(input: input, from: "codemeta")
60
64
  crosscite = JSON.parse(subject.crosscite)
61
65
  expect(crosscite["title"]).to eq("R Interface to the DataONE REST API")
62
- expect(crosscite["author"].length).to eq(3)
63
- expect(crosscite["author"].last).to eq("type"=>"Organization", "name"=>"University Of California, Santa Barbara")
66
+ expect(crosscite["creator"].length).to eq(3)
67
+ expect(crosscite["creator"].last).to eq("type"=>"Organization", "name"=>"University Of California, Santa Barbara")
64
68
  expect(crosscite["version"]).to eq("2.0.0")
65
69
  end
66
70
 
@@ -70,10 +74,9 @@ describe Bolognese::Metadata, vcr: true do
70
74
  crosscite = JSON.parse(subject.crosscite)
71
75
  expect(crosscite.fetch("url")).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
72
76
  expect(crosscite.fetch("title")).to eq("Data from: A new malaria agent in African hominids.")
73
- expect(crosscite.fetch("author").length).to eq(8)
74
- expect(crosscite.fetch("author").first).to eq("type"=>"Person", "familyName" => "Ollomo", "givenName" => "Benjamin", "name" => "Benjamin Ollomo")
75
- expect(crosscite.fetch("date_registered")).to eq("2011-02-01T17:32:02Z")
76
- expect(crosscite.fetch("date_updated")).to eq("2018-03-30T21:47:26Z")
77
+ expect(crosscite.fetch("creator").length).to eq(8)
78
+ expect(crosscite.fetch("creator").first).to eq("type"=>"Person", "familyName" => "Ollomo", "givenName" => "Benjamin", "name" => "Benjamin Ollomo")
79
+ expect(crosscite.fetch("date_published")).to eq("2011")
77
80
  expect(crosscite.fetch("provider_id")).to eq("DRYAD")
78
81
  expect(crosscite.fetch("client_id")).to eq("DRYAD.DRYAD")
79
82
  end
@@ -83,7 +86,7 @@ describe Bolognese::Metadata, vcr: true do
83
86
  subject = Bolognese::Metadata.new(input: input, from: "codemeta")
84
87
  crosscite = JSON.parse(subject.crosscite)
85
88
  expect(crosscite.fetch("title")).to eq("Maremma: a Ruby library for simplified network calls")
86
- expect(crosscite.fetch("author")).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
89
+ expect(crosscite.fetch("creator")).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
87
90
  end
88
91
 
89
92
  it "with data citation schema.org" do
@@ -92,8 +95,9 @@ describe Bolognese::Metadata, vcr: true do
92
95
  expect(subject.valid?).to be true
93
96
  crosscite = JSON.parse(subject.crosscite)
94
97
  expect(crosscite.fetch("title")).to eq("Eating your own Dog Food")
95
- expect(crosscite.fetch("references").count).to eq(2)
96
- expect(crosscite.fetch("references").first).to eq("id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork")
98
+ expect(crosscite.fetch("related_identifiers").count).to eq(3)
99
+ expect(crosscite.fetch("related_identifiers").first).to eq("id"=>"10.5438/0000-00ss", "related_identifier_type"=>"DOI", "relation_type"=>"IsPartOf", "resource_type_general"=>"Text", "title"=>"DataCite Blog")
100
+ expect(crosscite.fetch("related_identifiers").last).to eq("id"=>"10.5438/55e5-t5c0", "related_identifier_type"=>"DOI", "relation_type"=>"References")
97
101
  end
98
102
  end
99
103
  end
@@ -9,10 +9,10 @@ describe Bolognese::Metadata, vcr: true do
9
9
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
10
10
  datacite = JSON.parse(subject.datacite_json)
11
11
  expect(datacite.fetch("url")).to eq("https://elifesciences.org/articles/01567")
12
- expect(datacite.fetch("resource_type_general")).to eq("Text")
12
+ expect(datacite.fetch("resource-type-general")).to eq("Text")
13
13
  expect(datacite.fetch("title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
14
- expect(datacite.fetch("references").length).to eq(26)
15
- expect(datacite.fetch("references").first).to eq("id"=>"https://doi.org/10.1038/nature02100", "type"=>"CreativeWork", "title" => "APL regulates vascular tissue identity in Arabidopsis")
14
+ expect(datacite.fetch("related-identifiers").length).to eq(27)
15
+ expect(datacite.fetch("related-identifiers").first).to eq("id"=>"2050-084X", "related_identifier_type"=>"ISSN", "relation_type"=>"IsPartOf", "title"=>"eLife", "type"=>"Periodical")
16
16
  expect(datacite.fetch("rights")).to eq("id"=>"http://creativecommons.org/licenses/by/3.0")
17
17
  end
18
18
 
@@ -21,7 +21,7 @@ describe Bolognese::Metadata, vcr: true do
21
21
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
22
22
  datacite = JSON.parse(subject.datacite_json)
23
23
  expect(datacite.fetch("url")).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
24
- expect(datacite.fetch("resource_type_general")).to eq("Text")
24
+ expect(datacite.fetch("resource-type-general")).to eq("Text")
25
25
  expect(datacite.fetch("creator").length).to eq(7)
26
26
  expect(datacite.fetch("creator").first).to eq("type"=>"Person", "name"=>"Wendy Thanassi", "givenName"=>"Wendy", "familyName"=>"Thanassi")
27
27
  end
@@ -30,7 +30,7 @@ describe Bolognese::Metadata, vcr: true do
30
30
  input = fixture_path + "crossref.bib"
31
31
  subject = Bolognese::Metadata.new(input: input, from: "bibtex")
32
32
  datacite = JSON.parse(subject.datacite_json)
33
- expect(datacite.fetch("resource_type_general")).to eq("Text")
33
+ expect(datacite.fetch("resource-type-general")).to eq("Text")
34
34
  expect(datacite.fetch("title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
35
35
  expect(datacite.dig("description", "text")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
36
36
  expect(datacite.fetch("creator").length).to eq(5)
@@ -41,7 +41,7 @@ describe Bolognese::Metadata, vcr: true do
41
41
  input = fixture_path + "citeproc.json"
42
42
  subject = Bolognese::Metadata.new(input: input, from: "citeproc")
43
43
  datacite = JSON.parse(subject.datacite_json)
44
- expect(datacite.fetch("resource_type_general")).to eq("Text")
44
+ expect(datacite.fetch("resource-type-general")).to eq("Text")
45
45
  expect(datacite.fetch("title")).to eq("Eating your own Dog Food")
46
46
  expect(datacite.dig("description", "text")).to start_with("Eating your own dog food")
47
47
  expect(datacite.fetch("creator")).to eq("type"=>"Person", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
@@ -71,8 +71,8 @@ describe Bolognese::Metadata, vcr: true do
71
71
  expect(subject.valid?).to be true
72
72
  datacite = JSON.parse(subject.datacite_json)
73
73
  expect(datacite.fetch("title")).to eq("Eating your own Dog Food")
74
- expect(datacite.fetch("references").count).to eq(2)
75
- expect(datacite.fetch("references").first).to eq("id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork")
74
+ expect(datacite.fetch("related-identifiers").count).to eq(3)
75
+ expect(datacite.fetch("related-identifiers").first).to eq("id"=>"10.5438/0000-00ss", "related_identifier_type"=>"DOI", "relation_type"=>"IsPartOf", "resource_type_general"=>"Text", "title"=>"DataCite Blog")
76
76
  end
77
77
  end
78
78
  end
@@ -106,10 +106,10 @@ describe Bolognese::Metadata, vcr: true do
106
106
  expect(subject.type).to eq("ScholarlyArticle")
107
107
  expect(subject.additional_type).to eq("Paper")
108
108
  expect(subject.resource_type_general).to eq("Text")
109
- expect(subject.author.length).to eq(20)
110
- expect(subject.author.first).to eq("type"=>"Person", "familyName" => "Paglione", "givenName" => "Laura", "id" => "https://orcid.org/0000-0003-3188-6273", "name" => "Laura Paglione")
109
+ expect(subject.creator.length).to eq(20)
110
+ expect(subject.creator.first).to eq("type"=>"Person", "familyName" => "Paglione", "givenName" => "Laura", "id" => "https://orcid.org/0000-0003-3188-6273", "name" => "Laura Paglione")
111
111
  expect(subject.title).to eq("Recommendation of: ORCID Works Metadata Working Group")
112
- expect(subject.license).to eq("id"=>"https://creativecommons.org/publicdomain/zero/1.0", "name"=>"CC-0")
112
+ expect(subject.rights).to eq("id"=>"https://creativecommons.org/publicdomain/zero/1.0", "name"=>"CC-0")
113
113
  expect(subject.date_published).to eq("2017")
114
114
  expect(subject.publisher).to eq("Figshare")
115
115
  expect(subject.service_provider).to eq("DataCite")
@@ -125,10 +125,10 @@ describe Bolognese::Metadata, vcr: true do
125
125
  expect(subject.type).to eq("ScholarlyArticle")
126
126
  expect(subject.additional_type).to eq("Paper")
127
127
  expect(subject.resource_type_general).to eq("Text")
128
- expect(subject.author.length).to eq(20)
129
- expect(subject.author.first).to eq("type"=>"Person", "familyName" => "Paglione", "givenName" => "Laura", "id" => "https://orcid.org/0000-0003-3188-6273", "name" => "Laura Paglione")
128
+ expect(subject.creator.length).to eq(20)
129
+ expect(subject.creator.first).to eq("type"=>"Person", "familyName" => "Paglione", "givenName" => "Laura", "id" => "https://orcid.org/0000-0003-3188-6273", "name" => "Laura Paglione")
130
130
  expect(subject.title).to eq("Recommendation of: ORCID Works Metadata Working Group")
131
- expect(subject.license).to eq("id"=>"https://creativecommons.org/publicdomain/zero/1.0", "name"=>"CC-0")
131
+ expect(subject.rights).to eq("id"=>"https://creativecommons.org/publicdomain/zero/1.0", "name"=>"CC-0")
132
132
  expect(subject.date_published).to eq("2017")
133
133
  expect(subject.publisher).to eq("Figshare")
134
134
  expect(subject.service_provider).to eq("DataCite")
@@ -144,15 +144,14 @@ describe Bolognese::Metadata, vcr: true do
144
144
  expect(subject.type).to eq("Dataset")
145
145
  expect(subject.additional_type).to eq("DataPackage")
146
146
  expect(subject.resource_type_general).to eq("Dataset")
147
- expect(subject.author.length).to eq(8)
148
- expect(subject.author.first).to eq("type"=>"Person", "name"=>"Benjamin Ollomo", "givenName"=>"Benjamin", "familyName"=>"Ollomo")
147
+ expect(subject.creator.length).to eq(8)
148
+ expect(subject.creator.first).to eq("type"=>"Person", "name"=>"Benjamin Ollomo", "givenName"=>"Benjamin", "familyName"=>"Ollomo")
149
149
  expect(subject.title).to eq("Data from: A new malaria agent in African hominids.")
150
- expect(subject.alternate_identifier).to eq("type"=>"citation", "name"=>"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.")
151
- expect(subject.license).to eq("id"=>"http://creativecommons.org/publicdomain/zero/1.0")
150
+ expect(subject.alternate_identifiers).to eq("type"=>"citation", "name"=>"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.")
151
+ expect(subject.rights).to eq("id"=>"http://creativecommons.org/publicdomain/zero/1.0")
152
152
  expect(subject.date_published).to eq("2011")
153
- expect(subject.has_part).to eq([{"type"=>"CreativeWork", "id"=>"https://doi.org/10.5061/dryad.8515/1"},
154
- {"type"=>"CreativeWork", "id"=>"https://doi.org/10.5061/dryad.8515/2"}])
155
- expect(subject.is_referenced_by).to eq("type"=>"CreativeWork", "id"=>"https://doi.org/10.1371/journal.ppat.1000446")
153
+ expect(subject.related_identifiers.length).to eq(6)
154
+ expect(subject.related_identifiers.last).to eq("id"=>"19478877", "related_identifier_type"=>"PMID", "relation_type"=>"IsSupplementTo")
156
155
  expect(subject.publisher).to eq("Dryad Digital Repository")
157
156
  expect(subject.service_provider).to eq("DataCite")
158
157
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
@@ -168,7 +167,7 @@ describe Bolognese::Metadata, vcr: true do
168
167
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
169
168
  expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food")
170
169
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(3)
171
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"10.5438/0000-00ss")
170
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("__content__"=>"10.5438/0000-00ss", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Text")
172
171
  end
173
172
 
174
173
  it "DOI not found" do
@@ -235,7 +234,7 @@ describe Bolognese::Metadata, vcr: true do
235
234
  it "required metadata no input" do
236
235
  input = nil
237
236
  subject = Bolognese::Metadata.new(input: input, doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
238
- subject.author = [{"creatorName"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner"}]
237
+ subject.creator = [{"creatorName"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner"}]
239
238
  subject.title = "Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"
240
239
  subject.publisher = "Dryad"
241
240
  subject.resource_type_general = "Dataset"
@@ -253,7 +252,7 @@ describe Bolognese::Metadata, vcr: true do
253
252
  it "change license" do
254
253
  input = "10.7554/eLife.01567"
255
254
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
256
- subject.license = { "id" => "https://creativecommons.org/licenses/by-nc-sa/4.0", "name" => "Creative Commons Attribution-NonCommercial-ShareAlike" }
255
+ subject.rights = { "id" => "https://creativecommons.org/licenses/by-nc-sa/4.0", "name" => "Creative Commons Attribution-NonCommercial-ShareAlike" }
257
256
  expect(subject.valid?).to be true
258
257
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
259
258
  expect(datacite.dig("rightsList", "rights")).to eq("rightsURI"=>"https://creativecommons.org/licenses/by-nc-sa/4.0", "__content__"=>"Creative Commons Attribution-NonCommercial-ShareAlike")
@@ -262,7 +261,7 @@ describe Bolognese::Metadata, vcr: true do
262
261
  it "change license url" do
263
262
  input = "10.7554/eLife.01567"
264
263
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
265
- subject.license = "https://creativecommons.org/licenses/by-nc-sa/4.0"
264
+ subject.rights = "https://creativecommons.org/licenses/by-nc-sa/4.0"
266
265
  expect(subject.valid?).to be true
267
266
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
268
267
  expect(datacite.dig("rightsList", "rights")).to eq("rightsURI"=>"https://creativecommons.org/licenses/by-nc-sa/4.0", "__content__"=>"https://creativecommons.org/licenses/by-nc-sa/4.0")
@@ -271,7 +270,7 @@ describe Bolognese::Metadata, vcr: true do
271
270
  it "change license name" do
272
271
  input = "10.7554/eLife.01567"
273
272
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
274
- subject.license = "Creative Commons Attribution-NonCommercial-ShareAlike"
273
+ subject.rights = "Creative Commons Attribution-NonCommercial-ShareAlike"
275
274
  expect(subject.valid?).to be true
276
275
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
277
276
  expect(datacite.dig("rightsList", "rights")).to eq("Creative Commons Attribution-NonCommercial-ShareAlike")