briard 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (464) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Gemfile.lock +5 -5
  4. data/README.md +1 -1
  5. data/briard.gemspec +2 -2
  6. data/lib/briard/doi_utils.rb +9 -7
  7. data/lib/briard/readers/crossref_reader.rb +3 -4
  8. data/lib/briard/readers/schema_org_reader.rb +1 -1
  9. data/lib/briard/utils.rb +882 -807
  10. data/lib/briard/version.rb +1 -1
  11. data/lib/briard/writers/datacite_json_writer.rb +5 -5
  12. data/lib/briard/writers/jats_writer.rb +12 -12
  13. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/default.yml +11 -13
  14. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_bibtex.yml +11 -13
  15. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_citation.yml +11 -13
  16. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_crossref.yml +11 -13
  17. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_datacite.yml +11 -13
  18. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_jats.yml +11 -13
  19. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_schema_org.yml +11 -13
  20. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/default.yml +14 -16
  21. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_bibtex.yml +14 -16
  22. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_citation.yml +14 -16
  23. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_datacite.yml +14 -16
  24. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_datacite_json.yml +14 -16
  25. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_jats.yml +14 -16
  26. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_schema_org.yml +14 -16
  27. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/schema_org/default.yml +13 -11
  28. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/schema_org/to_datacite.yml +9 -9
  29. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/schema_org/to_schema_org.yml +9 -9
  30. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/crossref.yml +5 -7
  31. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/datacite.yml +5 -7
  32. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/jalc.yml +5 -7
  33. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/kisti.yml +5 -7
  34. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/medra.yml +5 -7
  35. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/op.yml +5 -7
  36. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/author.yml +7 -7
  37. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/no_author.yml +7 -7
  38. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/single_author.yml +7 -7
  39. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/with_organization.yml +7 -7
  40. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_datacite_metadata/change_state.yml +14 -16
  41. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_datacite_metadata/change_title.yml +14 -16
  42. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/change_description.yml +6 -6
  43. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/change_identifiers.yml +6 -6
  44. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/change_license.yml +6 -6
  45. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/change_license_name.yml +6 -6
  46. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/change_license_url.yml +6 -6
  47. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/change_state.yml +6 -6
  48. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/validates_against_schema.yml +6 -6
  49. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/with_data_citation.yml +6 -6
  50. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/doi.yml +7 -7
  51. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/doi_with_protocol.yml +6 -6
  52. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/dx_doi_org_url.yml +6 -6
  53. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/force_test_resolver.yml +6 -6
  54. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/https_url.yml +7 -7
  55. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/test_resolver.yml +7 -7
  56. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_api_url/test_resolver_http.yml +6 -6
  57. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_from_url/doi.yml +6 -6
  58. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_from_url/doi_with_special_characters.yml +6 -6
  59. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_from_url/not_a_doi.yml +7 -7
  60. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_from_url/sandbox_url.yml +7 -7
  61. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_from_url/url.yml +6 -6
  62. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/crossref.yml +12 -14
  63. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/datacite.yml +11 -13
  64. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/jalc.yml +11 -13
  65. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/kisti.yml +11 -13
  66. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/medra.yml +11 -13
  67. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/not_a_valid_prefix.yml +7 -7
  68. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/not_found.yml +11 -13
  69. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/op.yml +11 -13
  70. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/doi.yml +7 -7
  71. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/doi_with_protocol.yml +7 -7
  72. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/dx_doi_org_url.yml +6 -6
  73. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/force_stage_resolver.yml +6 -6
  74. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/https_url.yml +7 -7
  75. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/stage_resolver.yml +6 -6
  76. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_resolver/stage_resolver_http.yml +7 -7
  77. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/crossref.yml +19 -23
  78. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +19 -23
  79. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/datacite.yml +19 -23
  80. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/datacite_doi_http.yml +19 -23
  81. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/github.yml +14 -16
  82. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/orcid.yml +14 -16
  83. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/schema_org.yml +14 -16
  84. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml +19 -23
  85. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/bibtex.yml +14 -16
  86. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/citeproc.yml +14 -16
  87. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/codemeta.yml +14 -16
  88. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/crosscite.yml +14 -16
  89. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/crossref.yml +14 -16
  90. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/datacite.yml +14 -16
  91. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/datacite_json.yml +14 -16
  92. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/ris.yml +14 -16
  93. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_file/schema_org.yml +14 -16
  94. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_from_string/crosscite.yml +14 -16
  95. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_for_match.yml +6 -6
  96. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_for_with_schemeUri_in_hash.yml +6 -6
  97. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_match.yml +6 -6
  98. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_no_match.yml +6 -6
  99. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/name_to_fos_for_match.yml +6 -6
  100. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/name_to_fos_match.yml +7 -7
  101. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/name_to_fos_no_match.yml +6 -6
  102. data/spec/fixtures/vcr_cassettes/Briard_Metadata/from_schema_org/with_id.yml +6 -6
  103. data/spec/fixtures/vcr_cassettes/Briard_Metadata/from_schema_org_creators/with_affiliation.yml +7 -7
  104. data/spec/fixtures/vcr_cassettes/Briard_Metadata/from_schema_org_creators/without_affiliation.yml +7 -7
  105. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/cff-converter-python.yml +8 -8
  106. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff.yml +13 -13
  107. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff_repository_url.yml +13 -13
  108. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/maremma.yml +11 -11
  109. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/metadata_reports.yml +8 -8
  110. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/DOI_with_ORCID_ID.yml +13 -15
  111. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/DOI_with_SICI_DOI.yml +13 -15
  112. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/DOI_with_data_citation.yml +11 -13
  113. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/JaLC.yml +11 -13
  114. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/KISTI.yml +11 -13
  115. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/OP.yml +13 -15
  116. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/affiliation_is_space.yml +13 -15
  117. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/another_book.yml +12 -14
  118. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/another_book_chapter.yml +11 -13
  119. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/article_id_as_page_number.yml +12 -14
  120. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/author_literal.yml +13 -15
  121. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book.yml +13 -15
  122. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book_chapter.yml +11 -13
  123. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book_chapter_with_RDF_for_container.yml +11 -13
  124. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book_oup.yml +11 -13
  125. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/component.yml +13 -15
  126. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/dataset.yml +11 -13
  127. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/dataset_usda.yml +11 -13
  128. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/date_in_future.yml +11 -13
  129. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/dissertation.yml +11 -13
  130. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/empty_given_name.yml +11 -13
  131. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/invalid_date.yml +11 -13
  132. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article.yml +13 -15
  133. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_original_language_title.yml +11 -13
  134. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_with.yml +13 -15
  135. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_with_RDF_for_container.yml +12 -14
  136. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_with_funding.yml +13 -15
  137. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_issue.yml +13 -15
  138. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/mEDRA.yml +12 -14
  139. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/markup.yml +13 -15
  140. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/missing_creator.yml +11 -13
  141. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/multiple_issn.yml +11 -13
  142. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/multiple_titles.yml +11 -13
  143. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/multiple_titles_with_missing.yml +12 -14
  144. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/not_found_error.yml +11 -13
  145. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/peer_review.yml +11 -13
  146. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/posted_content.yml +11 -13
  147. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/posted_content_copernicus.yml +11 -13
  148. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/report_osti.yml +12 -14
  149. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/vor_with_url.yml +13 -15
  150. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/yet_another_book.yml +11 -13
  151. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/yet_another_book_chapter.yml +13 -15
  152. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_json_metadata/metadata_from_api.yml +14 -16
  153. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/BlogPosting.yml +14 -16
  154. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/DOI_in_staging_system.yml +14 -16
  155. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/DOI_in_staging_system_schema_3.yml +14 -16
  156. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/DOI_in_with_related_id_system.yml +14 -16
  157. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/DOI_not_found.yml +13 -15
  158. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/Dataset.yml +14 -16
  159. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/Funding.yml +14 -16
  160. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/Funding_empty_awardTitle.yml +14 -16
  161. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/Funding_schema_version_4.yml +14 -16
  162. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/Referee_report_in_staging_system.yml +14 -16
  163. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/Schema_org_type.yml +14 -16
  164. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/author_only_full_name.yml +14 -16
  165. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/author_with_scheme.yml +14 -16
  166. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/author_with_wrong_orcid_scheme.yml +14 -16
  167. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/cc-by_3_0_us.yml +14 -16
  168. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/content_url.yml +14 -16
  169. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/date.yml +14 -16
  170. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/dissertation.yml +14 -16
  171. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/doi_with_sign.yml +14 -16
  172. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/empty_subject.yml +14 -16
  173. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/even_more_subject_scheme_FOR.yml +14 -16
  174. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/funding_references.yml +14 -16
  175. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/funding_schema_version_3.yml +14 -16
  176. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/is_identical_to.yml +14 -16
  177. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/keywords_with_attributes.yml +14 -16
  178. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/leading_and_trailing_whitespace.yml +14 -16
  179. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/more_subject_scheme_FOR.yml +14 -16
  180. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/multiple_author_names_in_one_creatorsName.yml +14 -16
  181. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/multiple_licenses.yml +14 -16
  182. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/series-information.yml +14 -16
  183. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/subject_scheme.yml +14 -16
  184. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/subject_scheme_FOR.yml +14 -16
  185. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date/publication_date.yml +6 -6
  186. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_date_parts/date.yml +6 -6
  187. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_date_parts/year-month.yml +7 -7
  188. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_date_parts/year.yml +6 -6
  189. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_parts/date.yml +7 -7
  190. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_parts/year-month.yml +7 -7
  191. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_parts/year.yml +7 -7
  192. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_parts/date.yml +6 -6
  193. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_parts/year-month.yml +7 -7
  194. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_parts/year.yml +7 -7
  195. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/future.yml +6 -6
  196. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/invalid.yml +7 -7
  197. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/nil.yml +7 -7
  198. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/past.yml +6 -6
  199. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/present.yml +6 -6
  200. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_familyName.yml +9 -9
  201. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_name_in_Thai.yml +9 -9
  202. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_name_in_display-order.yml +9 -9
  203. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml +9 -9
  204. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_name_in_sort-order.yml +9 -9
  205. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/hyper-authorship.yml +9 -9
  206. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/is_organization.yml +6 -6
  207. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/multiple_author_names_in_one_field.yml +9 -9
  208. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/multiple_name_identifier.yml +9 -9
  209. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/name_with_affiliation.yml +9 -9
  210. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/name_with_affiliation_and_country.yml +8 -8
  211. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/name_with_role.yml +9 -9
  212. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/only_familyName_and_givenName.yml +11 -11
  213. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/BlogPosting.yml +19 -19
  214. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/BlogPosting_with_new_DOI.yml +19 -19
  215. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/get_schema_org_metadata_front_matter/BlogPosting.yml +20 -20
  216. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/harvard_dataverse.yml +7 -7
  217. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/pangaea.yml +11 -11
  218. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/zenodo.yml +10 -10
  219. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/only_title.yml +6 -6
  220. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/title_and_pages.yml +6 -6
  221. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/title_volume_and_pages.yml +6 -6
  222. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/title_volume_issue_and_pages.yml +7 -7
  223. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_as_cff_url.yml +7 -7
  224. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_as_codemeta_url.yml +6 -6
  225. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url.yml +7 -7
  226. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url_cff_file.yml +7 -7
  227. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url_file.yml +7 -7
  228. data/spec/fixtures/vcr_cassettes/Briard_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml +5 -7
  229. data/spec/fixtures/vcr_cassettes/Briard_Metadata/handle_input/unknown_DOI_prefix.yml +5 -7
  230. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_contributors/none.yml +9 -9
  231. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_creators/insert.yml +9 -9
  232. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_dates/insert.yml +9 -9
  233. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_descriptions/insert.yml +9 -9
  234. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_identifier/doi.yml +9 -9
  235. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_language/insert.yml +9 -9
  236. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_person/creator_only_name.yml +9 -9
  237. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_publication_year/insert.yml +9 -9
  238. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_publisher/insert.yml +9 -9
  239. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_related_identifiers/insert.yml +9 -9
  240. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_related_identifiers/related_identifier.yml +9 -9
  241. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_resource_type/insert.yml +9 -9
  242. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_rights_list/insert.yml +9 -9
  243. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_sizes/insert.yml +9 -9
  244. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_subjects/insert.yml +9 -9
  245. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_titles/insert.yml +9 -9
  246. data/spec/fixtures/vcr_cassettes/Briard_Metadata/insert_version/insert.yml +9 -9
  247. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_comma.yml +6 -6
  248. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_family_name.yml +6 -6
  249. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_id.yml +7 -7
  250. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_known_given_name.yml +7 -7
  251. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_no_info.yml +7 -7
  252. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_orcid_id.yml +6 -6
  253. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_type_organization.yml +6 -6
  254. data/spec/fixtures/vcr_cassettes/Briard_Metadata/jsonlint/missing_comma.yml +14 -16
  255. data/spec/fixtures/vcr_cassettes/Briard_Metadata/jsonlint/nil.yml +14 -16
  256. data/spec/fixtures/vcr_cassettes/Briard_Metadata/jsonlint/overlapping_keys.yml +14 -16
  257. data/spec/fixtures/vcr_cassettes/Briard_Metadata/jsonlint/valid.yml +14 -16
  258. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_cc_url/not_found.yml +7 -7
  259. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_cc_url/with_trailing_slash.yml +6 -6
  260. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_cc_url/with_trailing_slash_and_to_https.yml +6 -6
  261. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/SICI_doi.yml +7 -7
  262. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi.yml +6 -6
  263. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi_force_datacite_sandbox.yml +6 -6
  264. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi_from_datacite_sandbox.yml +6 -6
  265. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi_from_url_without_doi_proxy.yml +7 -7
  266. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi_prefix_too_long.yml +6 -6
  267. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi_prefix_with_string.yml +7 -7
  268. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/doi_with_protocol.yml +7 -7
  269. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/dx_doi_org_url.yml +6 -6
  270. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/https_url.yml +6 -6
  271. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/not_valid_doi_prefix.yml +6 -6
  272. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_doi/url_with_one_slash.yml +7 -7
  273. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/doi.yml +7 -7
  274. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/doi_as_url.yml +6 -6
  275. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/ftp.yml +7 -7
  276. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/invalid_url.yml +7 -7
  277. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/sandbox_via_options.yml +7 -7
  278. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/sandbox_via_url.yml +6 -6
  279. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/string.yml +6 -6
  280. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/url.yml +7 -7
  281. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/url_with_utf-8.yml +6 -6
  282. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_ids/doi.yml +7 -7
  283. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_ids/url.yml +6 -6
  284. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_array.yml +6 -6
  285. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_empty_array.yml +7 -7
  286. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_hash.yml +7 -7
  287. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_string.yml +7 -7
  288. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_url/uri.yml +6 -6
  289. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_url/with_trailing_slash.yml +7 -7
  290. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_url/with_trailing_slash_and_to_https.yml +6 -6
  291. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/array.yml +6 -6
  292. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/array_of_strings.yml +6 -6
  293. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/first.yml +7 -7
  294. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/hash.yml +7 -7
  295. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/nil.yml +6 -6
  296. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/string.yml +6 -6
  297. data/spec/fixtures/vcr_cassettes/Briard_Metadata/random_doi/decode_anothe_doi.yml +6 -6
  298. data/spec/fixtures/vcr_cassettes/Briard_Metadata/random_doi/decode_doi.yml +6 -6
  299. data/spec/fixtures/vcr_cassettes/Briard_Metadata/random_doi/encode_doi.yml +6 -6
  300. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +6 -6
  301. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +6 -6
  302. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/hsh_to_spdx_id.yml +6 -6
  303. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/hsh_to_spdx_not_found.yml +7 -7
  304. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/hsh_to_spdx_url.yml +6 -6
  305. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/name_to_spdx_exists.yml +6 -6
  306. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/name_to_spdx_id.yml +6 -6
  307. data/spec/fixtures/vcr_cassettes/Briard_Metadata/to_schema_org/with_id.yml +7 -7
  308. data/spec/fixtures/vcr_cassettes/Briard_Metadata/to_schema_org_identifiers/with_identifiers.yml +6 -6
  309. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_doi/doi.yml +7 -7
  310. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_10.yml +6 -6
  311. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_11.yml +7 -7
  312. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_12.yml +6 -6
  313. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_13.yml +6 -6
  314. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_14.yml +6 -6
  315. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_4.yml +6 -6
  316. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_5.yml +6 -6
  317. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_6.yml +7 -7
  318. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_7.yml +6 -6
  319. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_8.yml +7 -7
  320. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/1_7_9.yml +7 -7
  321. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/funder_doi.yml +6 -6
  322. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/funder_doi_without_prefix.yml +6 -6
  323. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_funder_doi/non-funder_doi.yml +6 -6
  324. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid.yml +6 -6
  325. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_https.yml +7 -7
  326. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_id.yml +7 -7
  327. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_sandbox.yml +6 -6
  328. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_sandbox_https.yml +7 -7
  329. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_with_spaces.yml +6 -6
  330. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_wrong_id.yml +7 -7
  331. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_www.yml +7 -7
  332. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme.yml +7 -7
  333. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme_https.yml +6 -6
  334. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme_trailing_slash.yml +6 -6
  335. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme_www.yml +6 -6
  336. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_prefix/doi.yml +6 -6
  337. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_prefix/doi_as_url.yml +6 -6
  338. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_prefix/doi_with_protocol.yml +7 -7
  339. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_prefix/only_prefix.yml +6 -6
  340. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/DOI.yml +6 -6
  341. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/ISSN.yml +7 -7
  342. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/URL.yml +7 -7
  343. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/string.yml +7 -7
  344. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/BlogPosting.yml +9 -9
  345. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/Dataset.yml +9 -9
  346. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/authors_with_affiliations.yml +8 -8
  347. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/climate_data.yml +9 -9
  348. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/from_schema_org.yml +19 -19
  349. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/keywords_subject_scheme.yml +9 -9
  350. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/maremma.yml +9 -9
  351. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/text.yml +9 -9
  352. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/with_data_citation.yml +6 -6
  353. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/with_pages.yml +6 -6
  354. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/Collection_of_Jupyter_notebooks.yml +9 -9
  355. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_Zenodo.yml +9 -9
  356. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_also_Zenodo.yml +9 -9
  357. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/ruby-cff.yml +12 -12
  358. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Dataset.yml +9 -9
  359. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Journal_article.yml +6 -6
  360. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Journal_article_vancouver_style.yml +6 -6
  361. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Missing_author.yml +6 -6
  362. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/interactive_resource_without_dates.yml +9 -9
  363. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/software_w/version.yml +9 -9
  364. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/Another_dataset.yml +9 -9
  365. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/BlogPosting.yml +9 -9
  366. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/BlogPosting_schema_org.yml +19 -19
  367. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/Dataset.yml +9 -9
  368. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/container_title.yml +9 -9
  369. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/interactive_resource_without_dates.yml +9 -9
  370. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/journal_article.yml +6 -6
  371. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/keywords_subject_scheme.yml +9 -9
  372. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/maremma.yml +9 -9
  373. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/missing_creator.yml +6 -6
  374. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/multiple_abstracts.yml +9 -9
  375. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/organization_author.yml +8 -8
  376. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/software.yml +9 -9
  377. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/software_w/version.yml +9 -9
  378. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/with_only_first_page.yml +6 -6
  379. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citeproc/with_pages.yml +6 -6
  380. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml +9 -9
  381. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite_check_codemeta_v2.yml +9 -9
  382. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crosscite/datacite_database_attributes.yml +9 -9
  383. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crosscite/maremma.yml +10 -10
  384. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crosscite/with_ORCID_ID.yml +6 -6
  385. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crosscite/with_data_citation.yml +6 -6
  386. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml +23 -23
  387. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml +9 -9
  388. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/posted_content.yml +11 -13
  389. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/schema_org_from_another_science_blog.yml +10 -14
  390. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/schema_org_from_front_matter.yml +23 -23
  391. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/climate_data.yml +9 -9
  392. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/maremma.yml +9 -9
  393. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/text.yml +9 -9
  394. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/with_data_citation.yml +6 -6
  395. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/with_pages.yml +8 -8
  396. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/from_schema_org.yml +19 -19
  397. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/maremma.yml +11 -11
  398. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/with_ORCID_ID.yml +6 -6
  399. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/with_data_citation.yml +6 -6
  400. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/DOI_not_found.yml +8 -8
  401. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/Dataset_in_schema_4_0.yml +9 -9
  402. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/Text_pass-thru.yml +9 -9
  403. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/Text_pass-thru_with_doi_in_options.yml +9 -9
  404. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/maremma.yml +9 -9
  405. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/with_ORCID_ID.yml +6 -6
  406. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/with_data_citation.yml +6 -6
  407. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/with_editor.yml +8 -8
  408. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/with_version.yml +9 -9
  409. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/Dataset_in_schema_4_0.yml +9 -9
  410. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/Text_pass-thru.yml +9 -9
  411. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/book_chapter.yml +8 -8
  412. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/from_schema_org.yml +21 -21
  413. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/interactive_resource_without_dates.yml +9 -9
  414. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/maremma.yml +9 -9
  415. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_ORCID_ID.yml +6 -6
  416. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_data_citation.yml +6 -6
  417. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_editor.yml +8 -8
  418. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/BlogPosting.yml +9 -9
  419. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/BlogPosting_schema_org.yml +19 -19
  420. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/journal_article.yml +6 -6
  421. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/maremma.yml +9 -9
  422. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/with_pages.yml +6 -6
  423. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/BlogPosting.yml +9 -9
  424. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/BlogPosting_schema_org.yml +19 -19
  425. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/Dataset.yml +9 -9
  426. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/alternate_name.yml +9 -9
  427. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/journal_article.yml +6 -6
  428. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/keywords_with_subject_scheme.yml +9 -9
  429. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/maremma.yml +9 -9
  430. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/with_pages.yml +8 -8
  431. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Another_Schema_org_JSON.yml +9 -9
  432. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Funding.yml +14 -16
  433. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Funding_OpenAIRE.yml +14 -16
  434. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON.yml +9 -9
  435. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON_Cyark.yml +14 -16
  436. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON_IsSupplementTo.yml +14 -16
  437. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/alternate_identifiers.yml +9 -9
  438. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/data_catalog.yml +9 -9
  439. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/geo_location_box.yml +9 -9
  440. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/interactive_resource_without_dates.yml +9 -9
  441. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/journal_article.yml +6 -6
  442. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/maremma_schema_org_JSON.yml +9 -9
  443. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/series_information.yml +9 -9
  444. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/subject_scheme.yml +9 -9
  445. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/subject_scheme_multiple_keywords.yml +9 -9
  446. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/BlogPosting.yml +9 -9
  447. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/BlogPosting_schema_org.yml +19 -19
  448. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/Dataset.yml +9 -9
  449. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/journal_article.yml +6 -6
  450. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/with_pages.yml +8 -8
  451. data/spec/readers/cff_reader_spec.rb +9 -9
  452. data/spec/readers/crossref_reader_spec.rb +5 -5
  453. data/spec/readers/schema_org_reader_spec.rb +1 -1
  454. data/spec/writers/cff_writer_spec.rb +1 -1
  455. data/spec/writers/crossref_writer_spec.rb +15 -14
  456. metadata +8 -22
  457. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/should_only_keep_specific_tags.yml +0 -65
  458. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/should_remove_a_tags.yml +0 -65
  459. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crosscite/with_data_citation_schema_org.yml +0 -106
  460. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/schema_org_from_zenodo.yml +0 -62
  461. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/with_data_citation_schema_org.yml +0 -108
  462. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_xml/with_data_citation_schema_org.yml +0 -106
  463. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_data_citation_schema_org.yml +0 -106
  464. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON_isReferencedBy.yml +0 -73
data/lib/briard/utils.rb CHANGED
@@ -3,486 +3,486 @@
3
3
  module Briard
4
4
  module Utils
5
5
  NORMALIZED_LICENSES = {
6
- "https://creativecommons.org/licenses/by/1.0" => "https://creativecommons.org/licenses/by/1.0/legalcode",
7
- "https://creativecommons.org/licenses/by/2.0" => "https://creativecommons.org/licenses/by/2.0/legalcode",
8
- "https://creativecommons.org/licenses/by/2.5" => "https://creativecommons.org/licenses/by/2.5/legalcode",
9
- "https://creativecommons.org/licenses/by/3.0" => "https://creativecommons.org/licenses/by/3.0/legalcode",
10
- "https://creativecommons.org/licenses/by/3.0/us" => "https://creativecommons.org/licenses/by/3.0/legalcode",
11
- "https://creativecommons.org/licenses/by/4.0" => "https://creativecommons.org/licenses/by/4.0/legalcode",
12
- "https://creativecommons.org/licenses/by-nc/1.0" => "https://creativecommons.org/licenses/by-nc/1.0/legalcode",
13
- "https://creativecommons.org/licenses/by-nc/2.0" => "https://creativecommons.org/licenses/by-nc/2.0/legalcode",
14
- "https://creativecommons.org/licenses/by-nc/2.5" => "https://creativecommons.org/licenses/by-nc/2.5/legalcode",
15
- "https://creativecommons.org/licenses/by-nc/3.0" => "https://creativecommons.org/licenses/by-nc/3.0/legalcode",
16
- "https://creativecommons.org/licenses/by-nc/4.0" => "https://creativecommons.org/licenses/by-nc/4.0/legalcode",
17
- "https://creativecommons.org/licenses/by-nd-nc/1.0" => "https://creativecommons.org/licenses/by-nd-nc/1.0/legalcode",
18
- "https://creativecommons.org/licenses/by-nd-nc/2.0" => "https://creativecommons.org/licenses/by-nd-nc/2.0/legalcode",
19
- "https://creativecommons.org/licenses/by-nd-nc/2.5" => "https://creativecommons.org/licenses/by-nd-nc/2.5/legalcode",
20
- "https://creativecommons.org/licenses/by-nd-nc/3.0" => "https://creativecommons.org/licenses/by-nd-nc/3.0/legalcode",
21
- "https://creativecommons.org/licenses/by-nd-nc/4.0" => "https://creativecommons.org/licenses/by-nd-nc/4.0/legalcode",
22
- "https://creativecommons.org/licenses/by-nc-sa/1.0" => "https://creativecommons.org/licenses/by-nc-sa/1.0/legalcode",
23
- "https://creativecommons.org/licenses/by-nc-sa/2.0" => "https://creativecommons.org/licenses/by-nc-sa/2.0/legalcode",
24
- "https://creativecommons.org/licenses/by-nc-sa/2.5" => "https://creativecommons.org/licenses/by-nc-sa/2.5/legalcode",
25
- "https://creativecommons.org/licenses/by-nc-sa/3.0" => "https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode",
26
- "https://creativecommons.org/licenses/by-nc-sa/4.0" => "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode",
27
- "https://creativecommons.org/licenses/by-nd/1.0" => "https://creativecommons.org/licenses/by-nd/1.0/legalcode",
28
- "https://creativecommons.org/licenses/by-nd/2.0" => "https://creativecommons.org/licenses/by-nd/2.0/legalcode",
29
- "https://creativecommons.org/licenses/by-nd/2.5" => "https://creativecommons.org/licenses/by-nd/2.5/legalcode",
30
- "https://creativecommons.org/licenses/by-nd/3.0" => "https://creativecommons.org/licenses/by-nd/3.0/legalcode",
31
- "https://creativecommons.org/licenses/by-nd/4.0" => "https://creativecommons.org/licenses/by-nd/2.0/legalcode",
32
- "https://creativecommons.org/licenses/by-sa/1.0" => "https://creativecommons.org/licenses/by-sa/1.0/legalcode",
33
- "https://creativecommons.org/licenses/by-sa/2.0" => "https://creativecommons.org/licenses/by-sa/2.0/legalcode",
34
- "https://creativecommons.org/licenses/by-sa/2.5" => "https://creativecommons.org/licenses/by-sa/2.5/legalcode",
35
- "https://creativecommons.org/licenses/by-sa/3.0" => "https://creativecommons.org/licenses/by-sa/3.0/legalcode",
36
- "https://creativecommons.org/licenses/by-sa/4.0" => "https://creativecommons.org/licenses/by-sa/4.0/legalcode",
37
- "https://creativecommons.org/licenses/by-nc-nd/1.0" => "https://creativecommons.org/licenses/by-nc-nd/1.0/legalcode",
38
- "https://creativecommons.org/licenses/by-nc-nd/2.0" => "https://creativecommons.org/licenses/by-nc-nd/2.0/legalcode",
39
- "https://creativecommons.org/licenses/by-nc-nd/2.5" => "https://creativecommons.org/licenses/by-nc-nd/2.5/legalcode",
40
- "https://creativecommons.org/licenses/by-nc-nd/3.0" => "https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode",
41
- "https://creativecommons.org/licenses/by-nc-nd/4.0" => "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode",
42
- "https://creativecommons.org/licenses/publicdomain" => "https://creativecommons.org/licenses/publicdomain/",
43
- "https://creativecommons.org/publicdomain/zero/1.0" => "https://creativecommons.org/publicdomain/zero/1.0/legalcode",
6
+ 'https://creativecommons.org/licenses/by/1.0' => 'https://creativecommons.org/licenses/by/1.0/legalcode',
7
+ 'https://creativecommons.org/licenses/by/2.0' => 'https://creativecommons.org/licenses/by/2.0/legalcode',
8
+ 'https://creativecommons.org/licenses/by/2.5' => 'https://creativecommons.org/licenses/by/2.5/legalcode',
9
+ 'https://creativecommons.org/licenses/by/3.0' => 'https://creativecommons.org/licenses/by/3.0/legalcode',
10
+ 'https://creativecommons.org/licenses/by/3.0/us' => 'https://creativecommons.org/licenses/by/3.0/legalcode',
11
+ 'https://creativecommons.org/licenses/by/4.0' => 'https://creativecommons.org/licenses/by/4.0/legalcode',
12
+ 'https://creativecommons.org/licenses/by-nc/1.0' => 'https://creativecommons.org/licenses/by-nc/1.0/legalcode',
13
+ 'https://creativecommons.org/licenses/by-nc/2.0' => 'https://creativecommons.org/licenses/by-nc/2.0/legalcode',
14
+ 'https://creativecommons.org/licenses/by-nc/2.5' => 'https://creativecommons.org/licenses/by-nc/2.5/legalcode',
15
+ 'https://creativecommons.org/licenses/by-nc/3.0' => 'https://creativecommons.org/licenses/by-nc/3.0/legalcode',
16
+ 'https://creativecommons.org/licenses/by-nc/4.0' => 'https://creativecommons.org/licenses/by-nc/4.0/legalcode',
17
+ 'https://creativecommons.org/licenses/by-nd-nc/1.0' => 'https://creativecommons.org/licenses/by-nd-nc/1.0/legalcode',
18
+ 'https://creativecommons.org/licenses/by-nd-nc/2.0' => 'https://creativecommons.org/licenses/by-nd-nc/2.0/legalcode',
19
+ 'https://creativecommons.org/licenses/by-nd-nc/2.5' => 'https://creativecommons.org/licenses/by-nd-nc/2.5/legalcode',
20
+ 'https://creativecommons.org/licenses/by-nd-nc/3.0' => 'https://creativecommons.org/licenses/by-nd-nc/3.0/legalcode',
21
+ 'https://creativecommons.org/licenses/by-nd-nc/4.0' => 'https://creativecommons.org/licenses/by-nd-nc/4.0/legalcode',
22
+ 'https://creativecommons.org/licenses/by-nc-sa/1.0' => 'https://creativecommons.org/licenses/by-nc-sa/1.0/legalcode',
23
+ 'https://creativecommons.org/licenses/by-nc-sa/2.0' => 'https://creativecommons.org/licenses/by-nc-sa/2.0/legalcode',
24
+ 'https://creativecommons.org/licenses/by-nc-sa/2.5' => 'https://creativecommons.org/licenses/by-nc-sa/2.5/legalcode',
25
+ 'https://creativecommons.org/licenses/by-nc-sa/3.0' => 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode',
26
+ 'https://creativecommons.org/licenses/by-nc-sa/4.0' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode',
27
+ 'https://creativecommons.org/licenses/by-nd/1.0' => 'https://creativecommons.org/licenses/by-nd/1.0/legalcode',
28
+ 'https://creativecommons.org/licenses/by-nd/2.0' => 'https://creativecommons.org/licenses/by-nd/2.0/legalcode',
29
+ 'https://creativecommons.org/licenses/by-nd/2.5' => 'https://creativecommons.org/licenses/by-nd/2.5/legalcode',
30
+ 'https://creativecommons.org/licenses/by-nd/3.0' => 'https://creativecommons.org/licenses/by-nd/3.0/legalcode',
31
+ 'https://creativecommons.org/licenses/by-nd/4.0' => 'https://creativecommons.org/licenses/by-nd/2.0/legalcode',
32
+ 'https://creativecommons.org/licenses/by-sa/1.0' => 'https://creativecommons.org/licenses/by-sa/1.0/legalcode',
33
+ 'https://creativecommons.org/licenses/by-sa/2.0' => 'https://creativecommons.org/licenses/by-sa/2.0/legalcode',
34
+ 'https://creativecommons.org/licenses/by-sa/2.5' => 'https://creativecommons.org/licenses/by-sa/2.5/legalcode',
35
+ 'https://creativecommons.org/licenses/by-sa/3.0' => 'https://creativecommons.org/licenses/by-sa/3.0/legalcode',
36
+ 'https://creativecommons.org/licenses/by-sa/4.0' => 'https://creativecommons.org/licenses/by-sa/4.0/legalcode',
37
+ 'https://creativecommons.org/licenses/by-nc-nd/1.0' => 'https://creativecommons.org/licenses/by-nc-nd/1.0/legalcode',
38
+ 'https://creativecommons.org/licenses/by-nc-nd/2.0' => 'https://creativecommons.org/licenses/by-nc-nd/2.0/legalcode',
39
+ 'https://creativecommons.org/licenses/by-nc-nd/2.5' => 'https://creativecommons.org/licenses/by-nc-nd/2.5/legalcode',
40
+ 'https://creativecommons.org/licenses/by-nc-nd/3.0' => 'https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode',
41
+ 'https://creativecommons.org/licenses/by-nc-nd/4.0' => 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode',
42
+ 'https://creativecommons.org/licenses/publicdomain' => 'https://creativecommons.org/licenses/publicdomain/',
43
+ 'https://creativecommons.org/publicdomain/zero/1.0' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode'
44
44
  }
45
45
 
46
46
  DC_TO_SO_TRANSLATIONS = {
47
- "Audiovisual" => "MediaObject",
48
- "Book" => "Book",
49
- "BookChapter" => "Chapter",
50
- "Collection" => "Collection",
51
- "ComputationalNotebook" => "SoftwareSourceCode",
52
- "ConferencePaper" => "Article",
53
- "ConferenceProceeding" => "Periodical",
54
- "DataPaper" => "Article",
55
- "Dataset" => "Dataset",
56
- "Dissertation" => "Thesis",
57
- "Event" => "Event",
58
- "Image" => "ImageObject",
59
- "InteractiveResource" => nil,
60
- "Journal" => "Periodical",
61
- "JournalArticle" => "ScholarlyArticle",
62
- "Model" => nil,
63
- "OutputManagementPlan" => nil,
64
- "PeerReview" => "Review",
65
- "PhysicalObject" => nil,
66
- "Preprint" => nil,
67
- "Report" => "Report",
68
- "Service" => "Service",
69
- "Software" => "SoftwareSourceCode",
70
- "Sound" => "AudioObject",
71
- "Standard" => nil,
72
- "Text" => "ScholarlyArticle",
73
- "Workflow" => nil,
74
- "Other" => "CreativeWork",
47
+ 'Audiovisual' => 'MediaObject',
48
+ 'Book' => 'Book',
49
+ 'BookChapter' => 'Chapter',
50
+ 'Collection' => 'Collection',
51
+ 'ComputationalNotebook' => 'SoftwareSourceCode',
52
+ 'ConferencePaper' => 'Article',
53
+ 'ConferenceProceeding' => 'Periodical',
54
+ 'DataPaper' => 'Article',
55
+ 'Dataset' => 'Dataset',
56
+ 'Dissertation' => 'Thesis',
57
+ 'Event' => 'Event',
58
+ 'Image' => 'ImageObject',
59
+ 'InteractiveResource' => nil,
60
+ 'Journal' => 'Periodical',
61
+ 'JournalArticle' => 'ScholarlyArticle',
62
+ 'Model' => nil,
63
+ 'OutputManagementPlan' => nil,
64
+ 'PeerReview' => 'Review',
65
+ 'PhysicalObject' => nil,
66
+ 'Preprint' => nil,
67
+ 'Report' => 'Report',
68
+ 'Service' => 'Service',
69
+ 'Software' => 'SoftwareSourceCode',
70
+ 'Sound' => 'AudioObject',
71
+ 'Standard' => nil,
72
+ 'Text' => 'ScholarlyArticle',
73
+ 'Workflow' => nil,
74
+ 'Other' => 'CreativeWork',
75
75
  # not part of DataCite schema, but used internally
76
- "Periodical" => "Periodical",
77
- "DataCatalog" => "DataCatalog"
76
+ 'Periodical' => 'Periodical',
77
+ 'DataCatalog' => 'DataCatalog'
78
78
  }
79
79
 
80
80
  DC_TO_CP_TRANSLATIONS = {
81
- "Audiovisual" => "motion_picture",
82
- "Book" => "book",
83
- "BookChapter" => "chapter",
84
- "Collection" => nil,
85
- "ComputationalNotebook" => nil,
86
- "ConferencePaper" => "paper_conference",
87
- "ConferenceProceeding" => nil,
88
- "DataPaper" => "report",
89
- "Dataset" => "dataset",
90
- "Dissertation" => nil,
91
- "Event" => nil,
92
- "Image" => "graphic",
93
- "InteractiveResource" => nil,
94
- "Journal" => nil,
95
- "JournalArticle" => "article-journal",
96
- "Model" => nil,
97
- "OutputManagementPlan" => nil,
98
- "PeerReview" => "review",
99
- "PhysicalObject" => nil,
100
- "Preprint" => nil,
101
- "Report" => "report",
102
- "Service" => nil,
103
- "Sound" => "song",
104
- "Standard" => nil,
105
- "Text" => "report",
106
- "Workflow" => nil,
107
- "Other" => nil
81
+ 'Audiovisual' => 'motion_picture',
82
+ 'Book' => 'book',
83
+ 'BookChapter' => 'chapter',
84
+ 'Collection' => nil,
85
+ 'ComputationalNotebook' => nil,
86
+ 'ConferencePaper' => 'paper_conference',
87
+ 'ConferenceProceeding' => nil,
88
+ 'DataPaper' => 'report',
89
+ 'Dataset' => 'dataset',
90
+ 'Dissertation' => nil,
91
+ 'Event' => nil,
92
+ 'Image' => 'graphic',
93
+ 'InteractiveResource' => nil,
94
+ 'Journal' => nil,
95
+ 'JournalArticle' => 'article-journal',
96
+ 'Model' => nil,
97
+ 'OutputManagementPlan' => nil,
98
+ 'PeerReview' => 'review',
99
+ 'PhysicalObject' => nil,
100
+ 'Preprint' => nil,
101
+ 'Report' => 'report',
102
+ 'Service' => nil,
103
+ 'Sound' => 'song',
104
+ 'Standard' => nil,
105
+ 'Text' => 'report',
106
+ 'Workflow' => nil,
107
+ 'Other' => nil
108
108
  }
109
109
 
110
110
  CR_TO_CP_TRANSLATIONS = {
111
- "Proceedings" => nil,
112
- "ReferenceBook" => nil,
113
- "JournalIssue" => nil,
114
- "ProceedingsArticle" => "paper-conference",
115
- "Other" => nil,
116
- "Dissertation" => "thesis",
117
- "Dataset" => "dataset",
118
- "EditedBook" => "book",
119
- "JournalArticle" => "article-journal",
120
- "Journal" => nil,
121
- "Report" => "report",
122
- "BookSeries" => nil,
123
- "ReportSeries" => nil,
124
- "BookTrack" => nil,
125
- "Standard" => nil,
126
- "BookSection" => "chapter",
127
- "BookPart" => nil,
128
- "Book" => "book",
129
- "BookChapter" => "chapter",
130
- "StandardSeries" => nil,
131
- "Monograph" => "book",
132
- "Component" => nil,
133
- "ReferenceEntry" => "entry-dictionary",
134
- "JournalVolume" => nil,
135
- "BookSet" => nil
111
+ 'Proceedings' => nil,
112
+ 'ReferenceBook' => nil,
113
+ 'JournalIssue' => nil,
114
+ 'ProceedingsArticle' => 'paper-conference',
115
+ 'Other' => nil,
116
+ 'Dissertation' => 'thesis',
117
+ 'Dataset' => 'dataset',
118
+ 'EditedBook' => 'book',
119
+ 'JournalArticle' => 'article-journal',
120
+ 'Journal' => nil,
121
+ 'Report' => 'report',
122
+ 'BookSeries' => nil,
123
+ 'ReportSeries' => nil,
124
+ 'BookTrack' => nil,
125
+ 'Standard' => nil,
126
+ 'BookSection' => 'chapter',
127
+ 'BookPart' => nil,
128
+ 'Book' => 'book',
129
+ 'BookChapter' => 'chapter',
130
+ 'StandardSeries' => nil,
131
+ 'Monograph' => 'book',
132
+ 'Component' => nil,
133
+ 'ReferenceEntry' => 'entry-dictionary',
134
+ 'JournalVolume' => nil,
135
+ 'BookSet' => nil
136
136
  }
137
137
 
138
138
  CR_TO_SO_TRANSLATIONS = {
139
- "Proceedings" => nil,
140
- "ReferenceBook" => "Book",
141
- "JournalIssue" => "PublicationIssue",
142
- "ProceedingsArticle" => nil,
143
- "Other" => "CreativeWork",
144
- "Dissertation" => "Thesis",
145
- "Dataset" => "Dataset",
146
- "EditedBook" => "Book",
147
- "JournalArticle" => "ScholarlyArticle",
148
- "Journal" => nil,
149
- "Report" => "Report",
150
- "BookSeries" => nil,
151
- "ReportSeries" => nil,
152
- "BookTrack" => nil,
153
- "Standard" => nil,
154
- "BookSection" => nil,
155
- "BookPart" => nil,
156
- "Book" => "Book",
157
- "BookChapter" => "Chapter",
158
- "StandardSeries" => nil,
159
- "Monograph" => "Book",
160
- "Component" => "CreativeWork",
161
- "ReferenceEntry" => nil,
162
- "JournalVolume" => "PublicationVolume",
163
- "BookSet" => nil,
164
- "PostedContent" => "ScholarlyArticle",
165
- "PeerReview" => "Review"
139
+ 'Proceedings' => nil,
140
+ 'ReferenceBook' => 'Book',
141
+ 'JournalIssue' => 'PublicationIssue',
142
+ 'ProceedingsArticle' => nil,
143
+ 'Other' => 'CreativeWork',
144
+ 'Dissertation' => 'Thesis',
145
+ 'Dataset' => 'Dataset',
146
+ 'EditedBook' => 'Book',
147
+ 'JournalArticle' => 'ScholarlyArticle',
148
+ 'Journal' => nil,
149
+ 'Report' => 'Report',
150
+ 'BookSeries' => nil,
151
+ 'ReportSeries' => nil,
152
+ 'BookTrack' => nil,
153
+ 'Standard' => nil,
154
+ 'BookSection' => nil,
155
+ 'BookPart' => nil,
156
+ 'Book' => 'Book',
157
+ 'BookChapter' => 'Chapter',
158
+ 'StandardSeries' => nil,
159
+ 'Monograph' => 'Book',
160
+ 'Component' => 'CreativeWork',
161
+ 'ReferenceEntry' => nil,
162
+ 'JournalVolume' => 'PublicationVolume',
163
+ 'BookSet' => nil,
164
+ 'PostedContent' => 'ScholarlyArticle',
165
+ 'PeerReview' => 'Review'
166
166
  }
167
167
 
168
168
  CR_TO_BIB_TRANSLATIONS = {
169
- "Proceedings" => "proceedings",
170
- "ReferenceBook" => "book",
171
- "JournalIssue" => nil,
172
- "ProceedingsArticle" => nil,
173
- "Other" => nil,
174
- "Dissertation" => "phdthesis",
175
- "Dataset" => nil,
176
- "EditedBook" => "book",
177
- "JournalArticle" => "article",
178
- "Journal" => nil,
179
- "Report" => "techreport",
180
- "BookSeries" => nil,
181
- "ReportSeries" => nil,
182
- "BookTrack" => nil,
183
- "Standard" => nil,
184
- "BookSection" => "inbook",
185
- "BookPart" => nil,
186
- "Book" => "book",
187
- "BookChapter" => "inbook",
188
- "StandardSeries" => nil,
189
- "Monograph" => "book",
190
- "Component" => nil,
191
- "ReferenceEntry" => nil,
192
- "JournalVolume" => nil,
193
- "BookSet" => nil,
194
- "PostedContent" => "article"
169
+ 'Proceedings' => 'proceedings',
170
+ 'ReferenceBook' => 'book',
171
+ 'JournalIssue' => nil,
172
+ 'ProceedingsArticle' => nil,
173
+ 'Other' => nil,
174
+ 'Dissertation' => 'phdthesis',
175
+ 'Dataset' => nil,
176
+ 'EditedBook' => 'book',
177
+ 'JournalArticle' => 'article',
178
+ 'Journal' => nil,
179
+ 'Report' => 'techreport',
180
+ 'BookSeries' => nil,
181
+ 'ReportSeries' => nil,
182
+ 'BookTrack' => nil,
183
+ 'Standard' => nil,
184
+ 'BookSection' => 'inbook',
185
+ 'BookPart' => nil,
186
+ 'Book' => 'book',
187
+ 'BookChapter' => 'inbook',
188
+ 'StandardSeries' => nil,
189
+ 'Monograph' => 'book',
190
+ 'Component' => nil,
191
+ 'ReferenceEntry' => nil,
192
+ 'JournalVolume' => nil,
193
+ 'BookSet' => nil,
194
+ 'PostedContent' => 'article'
195
195
  }
196
196
 
197
197
  BIB_TO_CR_TRANSLATIONS = {
198
- "proceedings" => "Proceedings",
199
- "phdthesis" => "Dissertation",
200
- "article" => "JournalArticle",
201
- "book" => "Book",
202
- "inbook" => "BookChapter"
198
+ 'proceedings' => 'Proceedings',
199
+ 'phdthesis' => 'Dissertation',
200
+ 'article' => 'JournalArticle',
201
+ 'book' => 'Book',
202
+ 'inbook' => 'BookChapter'
203
203
  }
204
204
 
205
205
  CR_TO_JATS_TRANSLATIONS = {
206
- "Proceedings" => "working-paper",
207
- "ReferenceBook" => "book",
208
- "JournalIssue" => "journal",
209
- "ProceedingsArticle" => "working-paper",
210
- "Other" => nil,
211
- "Dissertation" => nil,
212
- "Dataset" => "data",
213
- "EditedBook" => "book",
214
- "JournalArticle" => "journal",
215
- "Journal" => "journal",
216
- "Report" => "report",
217
- "BookSeries" => "book",
218
- "ReportSeries" => "report",
219
- "BookTrack" => "book",
220
- "Standard" => "standard",
221
- "BookSection" => "chapter",
222
- "BookPart" => "chapter",
223
- "Book" => "book",
224
- "BookChapter" => "chapter",
225
- "StandardSeries" => "standard",
226
- "Monograph" => "book",
227
- "Component" => nil,
228
- "ReferenceEntry" => nil,
229
- "JournalVolume" => "journal",
230
- "BookSet" => "book"
206
+ 'Proceedings' => 'working-paper',
207
+ 'ReferenceBook' => 'book',
208
+ 'JournalIssue' => 'journal',
209
+ 'ProceedingsArticle' => 'working-paper',
210
+ 'Other' => nil,
211
+ 'Dissertation' => nil,
212
+ 'Dataset' => 'data',
213
+ 'EditedBook' => 'book',
214
+ 'JournalArticle' => 'journal',
215
+ 'Journal' => 'journal',
216
+ 'Report' => 'report',
217
+ 'BookSeries' => 'book',
218
+ 'ReportSeries' => 'report',
219
+ 'BookTrack' => 'book',
220
+ 'Standard' => 'standard',
221
+ 'BookSection' => 'chapter',
222
+ 'BookPart' => 'chapter',
223
+ 'Book' => 'book',
224
+ 'BookChapter' => 'chapter',
225
+ 'StandardSeries' => 'standard',
226
+ 'Monograph' => 'book',
227
+ 'Component' => nil,
228
+ 'ReferenceEntry' => nil,
229
+ 'JournalVolume' => 'journal',
230
+ 'BookSet' => 'book'
231
231
  }
232
232
 
233
233
  CR_TO_DC_TRANSLATIONS = {
234
- "Proceedings" => nil,
235
- "ReferenceBook" => nil,
236
- "JournalIssue" => "Text",
237
- "ProceedingsArticle" => "ConferencePaper",
238
- "Other" => "Other",
239
- "Dissertation" => "Dissertation",
240
- "Dataset" => "Dataset",
241
- "EditedBook" => "Book",
242
- "JournalArticle" => "JournalArticle",
243
- "Journal" => "Journal",
244
- "Report" => "Report",
245
- "BookSeries" => nil,
246
- "ReportSeries" => nil,
247
- "BookTrack" => nil,
248
- "Standard" => "Standard",
249
- "BookSection" => "BookChapter",
250
- "BookPart" => nil,
251
- "Book" => "Book",
252
- "BookChapter" => "BookChapter",
253
- "SaComponent" => "Text",
254
- "StandardSeries" => "Standard",
255
- "Monograph" => "book",
256
- "Component" => nil,
257
- "ReferenceEntry" => nil,
258
- "JournalVolume" => nil,
259
- "BookSet" => nil,
260
- "PostedContent" => "Preprint",
261
- "PeerReview" => "PeerReview"
234
+ 'Proceedings' => nil,
235
+ 'ReferenceBook' => nil,
236
+ 'JournalIssue' => 'Text',
237
+ 'ProceedingsArticle' => 'ConferencePaper',
238
+ 'Other' => 'Other',
239
+ 'Dissertation' => 'Dissertation',
240
+ 'Dataset' => 'Dataset',
241
+ 'EditedBook' => 'Book',
242
+ 'JournalArticle' => 'JournalArticle',
243
+ 'Journal' => 'Journal',
244
+ 'Report' => 'Report',
245
+ 'BookSeries' => nil,
246
+ 'ReportSeries' => nil,
247
+ 'BookTrack' => nil,
248
+ 'Standard' => 'Standard',
249
+ 'BookSection' => 'BookChapter',
250
+ 'BookPart' => nil,
251
+ 'Book' => 'Book',
252
+ 'BookChapter' => 'BookChapter',
253
+ 'SaComponent' => 'Text',
254
+ 'StandardSeries' => 'Standard',
255
+ 'Monograph' => 'book',
256
+ 'Component' => nil,
257
+ 'ReferenceEntry' => nil,
258
+ 'JournalVolume' => nil,
259
+ 'BookSet' => nil,
260
+ 'PostedContent' => 'Preprint',
261
+ 'PeerReview' => 'PeerReview'
262
262
  }
263
263
 
264
264
  SO_TO_DC_TRANSLATIONS = {
265
- "Article" => "Preprint",
266
- "AudioObject" => "Sound",
267
- "Blog" => "Text",
268
- "BlogPosting" => "Preprint",
269
- "Book" => "Book",
270
- "Chapter" => "BookChapter",
271
- "Collection" => "Collection",
272
- "CreativeWork" => "Text",
273
- "DataCatalog" => "Dataset",
274
- "Dataset" => "Dataset",
275
- "Event" => "Event",
276
- "ImageObject" => "Image",
277
- "Movie" => "Audiovisual",
278
- "PublicationIssue" => "Text",
279
- "Report" => "Report",
280
- "ScholarlyArticle" => "Text",
281
- "Thesis" => "Text",
282
- "Service" => "Service",
283
- "Review" => "PeerReview",
284
- "SoftwareSourceCode" => "Software",
285
- "VideoObject" => "Audiovisual",
286
- "WebPage" => "Text",
287
- "WebSite" => "Text"
265
+ 'Article' => 'Preprint',
266
+ 'AudioObject' => 'Sound',
267
+ 'Blog' => 'Text',
268
+ 'BlogPosting' => 'Preprint',
269
+ 'Book' => 'Book',
270
+ 'Chapter' => 'BookChapter',
271
+ 'Collection' => 'Collection',
272
+ 'CreativeWork' => 'Text',
273
+ 'DataCatalog' => 'Dataset',
274
+ 'Dataset' => 'Dataset',
275
+ 'Event' => 'Event',
276
+ 'ImageObject' => 'Image',
277
+ 'Movie' => 'Audiovisual',
278
+ 'PublicationIssue' => 'Text',
279
+ 'Report' => 'Report',
280
+ 'ScholarlyArticle' => 'Text',
281
+ 'Thesis' => 'Text',
282
+ 'Service' => 'Service',
283
+ 'Review' => 'PeerReview',
284
+ 'SoftwareSourceCode' => 'Software',
285
+ 'VideoObject' => 'Audiovisual',
286
+ 'WebPage' => 'Text',
287
+ 'WebSite' => 'Text'
288
288
  }
289
289
 
290
290
  SO_TO_JATS_TRANSLATIONS = {
291
- "Article" => "journal",
292
- "AudioObject" => nil,
293
- "Blog" => nil,
294
- "BlogPosting" => nil,
295
- "Book" => "book",
296
- "Collection" => nil,
297
- "CreativeWork" => nil,
298
- "DataCatalog" => "data",
299
- "Dataset" => "data",
300
- "Event" => nil,
301
- "ImageObject" => nil,
302
- "Movie" => nil,
303
- "PublicationIssue" => "journal",
304
- "ScholarlyArticle" => "journal",
305
- "Service" => nil,
306
- "SoftwareSourceCode" => "software",
307
- "VideoObject" => nil,
308
- "WebPage" => nil,
309
- "WebSite" => "website"
291
+ 'Article' => 'journal',
292
+ 'AudioObject' => nil,
293
+ 'Blog' => nil,
294
+ 'BlogPosting' => nil,
295
+ 'Book' => 'book',
296
+ 'Collection' => nil,
297
+ 'CreativeWork' => nil,
298
+ 'DataCatalog' => 'data',
299
+ 'Dataset' => 'data',
300
+ 'Event' => nil,
301
+ 'ImageObject' => nil,
302
+ 'Movie' => nil,
303
+ 'PublicationIssue' => 'journal',
304
+ 'ScholarlyArticle' => 'journal',
305
+ 'Service' => nil,
306
+ 'SoftwareSourceCode' => 'software',
307
+ 'VideoObject' => nil,
308
+ 'WebPage' => nil,
309
+ 'WebSite' => 'website'
310
310
  }
311
311
 
312
312
  SO_TO_CP_TRANSLATIONS = {
313
- "Article" => "article-newspaper",
314
- "AudioObject" => "song",
315
- "Blog" => "report",
316
- "BlogPosting" => "post-weblog",
317
- "Collection" => nil,
318
- "CreativeWork" => nil,
319
- "DataCatalog" => "dataset",
320
- "Dataset" => "dataset",
321
- "Event" => nil,
322
- "ImageObject" => "graphic",
323
- "Movie" => "motion_picture",
324
- "PublicationIssue" => nil,
325
- "Report" => "report",
326
- "ScholarlyArticle" => "article-journal",
327
- "Service" => nil,
328
- "Thesis" => "thesis",
329
- "VideoObject" => "broadcast",
330
- "WebPage" => "webpage",
331
- "WebSite" => "webpage"
313
+ 'Article' => 'article-newspaper',
314
+ 'AudioObject' => 'song',
315
+ 'Blog' => 'report',
316
+ 'BlogPosting' => 'post-weblog',
317
+ 'Collection' => nil,
318
+ 'CreativeWork' => nil,
319
+ 'DataCatalog' => 'dataset',
320
+ 'Dataset' => 'dataset',
321
+ 'Event' => nil,
322
+ 'ImageObject' => 'graphic',
323
+ 'Movie' => 'motion_picture',
324
+ 'PublicationIssue' => nil,
325
+ 'Report' => 'report',
326
+ 'ScholarlyArticle' => 'article-journal',
327
+ 'Service' => nil,
328
+ 'Thesis' => 'thesis',
329
+ 'VideoObject' => 'broadcast',
330
+ 'WebPage' => 'webpage',
331
+ 'WebSite' => 'webpage'
332
332
  }
333
333
 
334
334
  SO_TO_RIS_TRANSLATIONS = {
335
- "Article" => "GEN",
336
- "AudioObject" => nil,
337
- "Blog" => nil,
338
- "BlogPosting" => "BLOG",
339
- "Collection" => nil,
340
- "CreativeWork" => "GEN",
341
- "DataCatalog" => "CTLG",
342
- "Dataset" => "DATA",
343
- "Event" => nil,
344
- "ImageObject" => "FIGURE",
345
- "Movie" => "MPCT",
346
- "Report" => "RPRT",
347
- "PublicationIssue" => nil,
348
- "ScholarlyArticle" => "JOUR",
349
- "Service" => nil,
350
- "SoftwareSourceCode" => "COMP",
351
- "VideoObject" => "VIDEO",
352
- "WebPage" => "ELEC",
353
- "WebSite" => nil
335
+ 'Article' => 'GEN',
336
+ 'AudioObject' => nil,
337
+ 'Blog' => nil,
338
+ 'BlogPosting' => 'BLOG',
339
+ 'Collection' => nil,
340
+ 'CreativeWork' => 'GEN',
341
+ 'DataCatalog' => 'CTLG',
342
+ 'Dataset' => 'DATA',
343
+ 'Event' => nil,
344
+ 'ImageObject' => 'FIGURE',
345
+ 'Movie' => 'MPCT',
346
+ 'Report' => 'RPRT',
347
+ 'PublicationIssue' => nil,
348
+ 'ScholarlyArticle' => 'JOUR',
349
+ 'Service' => nil,
350
+ 'SoftwareSourceCode' => 'COMP',
351
+ 'VideoObject' => 'VIDEO',
352
+ 'WebPage' => 'ELEC',
353
+ 'WebSite' => nil
354
354
  }
355
355
 
356
356
  CR_TO_RIS_TRANSLATIONS = {
357
- "Proceedings" => "CONF",
358
- "ReferenceBook" => "BOOK",
359
- "JournalIssue" => nil,
360
- "ProceedingsArticle" => "CPAPER",
361
- "Other" => "GEN",
362
- "Dissertation" => "THES",
363
- "Dataset" => "DATA",
364
- "EditedBook" => "BOOK",
365
- "JournalArticle" => "JOUR",
366
- "Journal" => nil,
367
- "Report" => "RPRT",
368
- "BookSeries" => nil,
369
- "ReportSeries" => nil,
370
- "BookTrack" => nil,
371
- "Standard" => "STAND",
372
- "BookSection" => "CHAP",
373
- "BookPart" => "CHAP",
374
- "Book" => "BOOK",
375
- "BookChapter" => "CHAP",
376
- "StandardSeries" => nil,
377
- "Monograph" => "BOOK",
378
- "Component" => nil,
379
- "ReferenceEntry" => "DICT",
380
- "JournalVolume" => nil,
381
- "BookSet" => nil
357
+ 'Proceedings' => 'CONF',
358
+ 'ReferenceBook' => 'BOOK',
359
+ 'JournalIssue' => nil,
360
+ 'ProceedingsArticle' => 'CPAPER',
361
+ 'Other' => 'GEN',
362
+ 'Dissertation' => 'THES',
363
+ 'Dataset' => 'DATA',
364
+ 'EditedBook' => 'BOOK',
365
+ 'JournalArticle' => 'JOUR',
366
+ 'Journal' => nil,
367
+ 'Report' => 'RPRT',
368
+ 'BookSeries' => nil,
369
+ 'ReportSeries' => nil,
370
+ 'BookTrack' => nil,
371
+ 'Standard' => 'STAND',
372
+ 'BookSection' => 'CHAP',
373
+ 'BookPart' => 'CHAP',
374
+ 'Book' => 'BOOK',
375
+ 'BookChapter' => 'CHAP',
376
+ 'StandardSeries' => nil,
377
+ 'Monograph' => 'BOOK',
378
+ 'Component' => nil,
379
+ 'ReferenceEntry' => 'DICT',
380
+ 'JournalVolume' => nil,
381
+ 'BookSet' => nil
382
382
  }
383
383
 
384
384
  DC_TO_RIS_TRANSLATIONS = {
385
- "Audiovisual" => "MPCT",
386
- "Book" => "BOOK",
387
- "BookChapter" => "CHAP",
388
- "Collection" => nil,
389
- "ComputationalNotebook" => "COMP",
390
- "ConferencePaper" => "CPAPER",
391
- "ConferenceProceeding" => "CONF",
392
- "DataPaper" => nil,
393
- "Dataset" => "DATA",
394
- "Dissertation" => "THES",
395
- "Event" => nil,
396
- "Image" => "FIGURE",
397
- "InteractiveResource" => nil,
398
- "Journal" => nil,
399
- "JournalArticle" => "JOUR",
400
- "Model" => nil,
401
- "OutputManagementPlan" => nil,
402
- "PeerReview" => nil,
403
- "PhysicalObject" => nil,
404
- "Preprint" => "RPRT",
405
- "Report" => "RRPT",
406
- "Service" => nil,
407
- "Software" => "COMP",
408
- "Sound" => "SOUND",
409
- "Standard" => nil,
410
- "Text" => "RPRT",
411
- "Workflow" => nil,
412
- "Other" => nil
385
+ 'Audiovisual' => 'MPCT',
386
+ 'Book' => 'BOOK',
387
+ 'BookChapter' => 'CHAP',
388
+ 'Collection' => nil,
389
+ 'ComputationalNotebook' => 'COMP',
390
+ 'ConferencePaper' => 'CPAPER',
391
+ 'ConferenceProceeding' => 'CONF',
392
+ 'DataPaper' => nil,
393
+ 'Dataset' => 'DATA',
394
+ 'Dissertation' => 'THES',
395
+ 'Event' => nil,
396
+ 'Image' => 'FIGURE',
397
+ 'InteractiveResource' => nil,
398
+ 'Journal' => nil,
399
+ 'JournalArticle' => 'JOUR',
400
+ 'Model' => nil,
401
+ 'OutputManagementPlan' => nil,
402
+ 'PeerReview' => nil,
403
+ 'PhysicalObject' => nil,
404
+ 'Preprint' => 'RPRT',
405
+ 'Report' => 'RRPT',
406
+ 'Service' => nil,
407
+ 'Software' => 'COMP',
408
+ 'Sound' => 'SOUND',
409
+ 'Standard' => nil,
410
+ 'Text' => 'RPRT',
411
+ 'Workflow' => nil,
412
+ 'Other' => nil
413
413
  }
414
414
 
415
415
  RIS_TO_DC_TRANSLATIONS = {
416
- "BLOG" => "Text",
417
- "GEN" => "Text",
418
- "CTLG" => "Collection",
419
- "DATA" => "Dataset",
420
- "FIGURE" => "Image",
421
- "THES" => "Dissertation",
422
- "MPCT" => "Audiovisual",
423
- "JOUR" => "JournalArticle",
424
- "COMP" => "Software",
425
- "VIDEO" => "Audiovisual",
426
- "ELEC" => "Text"
416
+ 'BLOG' => 'Text',
417
+ 'GEN' => 'Text',
418
+ 'CTLG' => 'Collection',
419
+ 'DATA' => 'Dataset',
420
+ 'FIGURE' => 'Image',
421
+ 'THES' => 'Dissertation',
422
+ 'MPCT' => 'Audiovisual',
423
+ 'JOUR' => 'JournalArticle',
424
+ 'COMP' => 'Software',
425
+ 'VIDEO' => 'Audiovisual',
426
+ 'ELEC' => 'Text'
427
427
  }
428
428
 
429
429
  BIB_TO_DC_TRANSLATIONS = {
430
- "article" => "JournalArticle",
431
- "book" => "Book",
432
- "inbook" => "BookChapter",
433
- "inproceedings" => nil,
434
- "manual" => nil,
435
- "misc" => "Other",
436
- "phdthesis" => "Dissertation",
437
- "proceedings" => "ConferenceProceeding",
438
- "techreport" => "Report",
439
- "unpublished" => nil
430
+ 'article' => 'JournalArticle',
431
+ 'book' => 'Book',
432
+ 'inbook' => 'BookChapter',
433
+ 'inproceedings' => nil,
434
+ 'manual' => nil,
435
+ 'misc' => 'Other',
436
+ 'phdthesis' => 'Dissertation',
437
+ 'proceedings' => 'ConferenceProceeding',
438
+ 'techreport' => 'Report',
439
+ 'unpublished' => nil
440
440
  }
441
441
 
442
442
  CP_TO_DC_TRANSLATIONS = {
443
- "song" => "Audiovisual",
444
- "post-weblog" => "Text",
445
- "dataset" => "Dataset",
446
- "graphic" => "Image",
447
- "motion_picture" => "Audiovisual",
448
- "article-journal" => "JournalArticle",
449
- "broadcast" => "Audiovisual",
450
- "webpage" => "Text"
443
+ 'song' => 'Audiovisual',
444
+ 'post-weblog' => 'Text',
445
+ 'dataset' => 'Dataset',
446
+ 'graphic' => 'Image',
447
+ 'motion_picture' => 'Audiovisual',
448
+ 'article-journal' => 'JournalArticle',
449
+ 'broadcast' => 'Audiovisual',
450
+ 'webpage' => 'Text'
451
451
  }
452
452
 
453
453
  SO_TO_BIB_TRANSLATIONS = {
454
- "Article" => "article",
455
- "AudioObject" => "misc",
456
- "Thesis" => "phdthesis",
457
- "Blog" => "misc",
458
- "BlogPosting" => "article",
459
- "Collection" => "misc",
460
- "CreativeWork" => "misc",
461
- "DataCatalog" => "misc",
462
- "Dataset" => "misc",
463
- "Event" => "misc",
464
- "ImageObject" => "misc",
465
- "Movie" => "misc",
466
- "PublicationIssue" => "misc",
467
- "ScholarlyArticle" => "article",
468
- "Service" => "misc",
469
- "SoftwareSourceCode" => "misc",
470
- "VideoObject" => "misc",
471
- "WebPage" => "misc",
472
- "WebSite" => "misc"
454
+ 'Article' => 'article',
455
+ 'AudioObject' => 'misc',
456
+ 'Thesis' => 'phdthesis',
457
+ 'Blog' => 'misc',
458
+ 'BlogPosting' => 'article',
459
+ 'Collection' => 'misc',
460
+ 'CreativeWork' => 'misc',
461
+ 'DataCatalog' => 'misc',
462
+ 'Dataset' => 'misc',
463
+ 'Event' => 'misc',
464
+ 'ImageObject' => 'misc',
465
+ 'Movie' => 'misc',
466
+ 'PublicationIssue' => 'misc',
467
+ 'ScholarlyArticle' => 'article',
468
+ 'Service' => 'misc',
469
+ 'SoftwareSourceCode' => 'misc',
470
+ 'VideoObject' => 'misc',
471
+ 'WebPage' => 'misc',
472
+ 'WebSite' => 'misc'
473
473
  }
474
474
 
475
475
  UNKNOWN_INFORMATION = {
476
- ":unac" => "temporarily inaccessible",
477
- ":unal" => "unallowed, suppressed intentionally",
478
- ":unap" => "not applicable, makes no sense",
479
- ":unas" => "value unassigned (e.g., Untitled)",
480
- ":unav" => "value unavailable, possibly unknown",
481
- ":unkn" => "known to be unknown (e.g., Anonymous, Inconnue)",
482
- ":none" => "never had a value, never will",
483
- ":null" => "explicitly and meaningfully empty",
484
- ":tba" => "to be assigned or announced later",
485
- ":etal" => "too numerous to list (et alia)"
476
+ ':unac' => 'temporarily inaccessible',
477
+ ':unal' => 'unallowed, suppressed intentionally',
478
+ ':unap' => 'not applicable, makes no sense',
479
+ ':unas' => 'value unassigned (e.g., Untitled)',
480
+ ':unav' => 'value unavailable, possibly unknown',
481
+ ':unkn' => 'known to be unknown (e.g., Anonymous, Inconnue)',
482
+ ':none' => 'never had a value, never will',
483
+ ':null' => 'explicitly and meaningfully empty',
484
+ ':tba' => 'to be assigned or announced later',
485
+ ':etal' => 'too numerous to list (et alia)'
486
486
  }
487
487
 
488
488
  def find_from_format(id: nil, string: nil, ext: nil, filename: nil)
@@ -493,93 +493,102 @@ module Briard
493
493
  elsif string.present?
494
494
  find_from_format_by_string(string)
495
495
  else
496
- "datacite"
496
+ 'datacite'
497
497
  end
498
498
  end
499
499
 
500
500
  def find_from_format_by_id(id)
501
501
  id = normalize_id(id)
502
502
 
503
- if /\A(?:(http|https):\/(\/)?(dx\.)?(doi\.org|handle\.stage\.datacite\.org)\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id)
503
+ if %r{\A(?:(http|https):/(/)?(dx\.)?(doi\.org|handle\.stage\.datacite\.org)/)?(doi:)?(10\.\d{4,5}/.+)\z}.match?(id)
504
504
  ra = get_doi_ra(id)
505
- %w(DataCite Crossref mEDRA KISTI JaLC OP).include?(ra) ? ra.downcase : nil
506
- elsif /\A(?:(http|https):\/(\/)?orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id)
507
- "orcid"
508
- elsif /\A(http|https):\/(\/)?github\.com\/(.+)\/package.json\z/.match(id)
509
- "npm"
510
- elsif /\A(http|https):\/(\/)?github\.com\/(.+)\/codemeta.json\z/.match(id)
511
- "codemeta"
512
- elsif /\A(http|https):\/(\/)?github\.com\/(.+)\/CITATION.cff\z/.match(id)
513
- "cff"
514
- elsif /\A(http|https):\/(\/)?github\.com\/(.+)\z/.match(id)
515
- "cff"
505
+ %w[DataCite Crossref mEDRA KISTI JaLC OP].include?(ra) ? ra.downcase : nil
506
+ elsif %r{\A(?:(http|https):/(/)?orcid\.org/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z}.match?(id)
507
+ 'orcid'
508
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)/package.json\z}.match?(id)
509
+ 'npm'
510
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)/codemeta.json\z}.match?(id)
511
+ 'codemeta'
512
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)/CITATION.cff\z}.match?(id)
513
+ 'cff'
514
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)\z}.match?(id)
515
+ 'cff'
516
516
  else
517
- "schema_org"
517
+ 'schema_org'
518
518
  end
519
519
  end
520
520
 
521
521
  def find_from_format_by_filename(filename)
522
- if filename == "package.json"
523
- "npm"
524
- elsif filename == "CITATION.cff"
525
- "cff"
522
+ if filename == 'package.json'
523
+ 'npm'
524
+ elsif filename == 'CITATION.cff'
525
+ 'cff'
526
526
  end
527
527
  end
528
528
 
529
- def find_from_format_by_ext(string, options={})
530
- if options[:ext] == ".bib"
531
- "bibtex"
532
- elsif options[:ext] == ".ris"
533
- "ris"
534
- elsif options[:ext] == ".xml" && Maremma.from_xml(string).to_h.dig("crossref_result", "query_result", "body", "query", "doi_record", "crossref")
535
- "crossref"
536
- elsif options[:ext] == ".xml" && Nokogiri::XML(string, nil, 'UTF-8', &:noblanks).collect_namespaces.find { |k, v| v.start_with?("http://datacite.org/schema/kernel") }
537
- "datacite"
538
- elsif options[:ext] == ".cff"
539
- "cff"
540
- elsif options[:ext] == ".json" && URI(Maremma.from_json(string).to_h.fetch("@context", "")).host == "schema.org"
541
- "schema_org"
542
- elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
543
- "codemeta"
544
- elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("schemaVersion").to_s.start_with?("http://datacite.org/schema/kernel")
545
- "datacite_json"
546
- elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("types") && Maremma.from_json(string).to_h.dig("publication_year").present?
547
- "crosscite"
548
- elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("issued", "date-parts").present?
549
- "citeproc"
529
+ def find_from_format_by_ext(string, options = {})
530
+ if options[:ext] == '.bib'
531
+ 'bibtex'
532
+ elsif options[:ext] == '.ris'
533
+ 'ris'
534
+ elsif options[:ext] == '.xml' && Maremma.from_xml(string).to_h.dig('crossref_result',
535
+ 'query_result', 'body', 'query', 'doi_record', 'crossref')
536
+ 'crossref'
537
+ elsif options[:ext] == '.xml' && Nokogiri::XML(string, nil, 'UTF-8',
538
+ &:noblanks).collect_namespaces.find do |_k, v|
539
+ v.start_with?('http://datacite.org/schema/kernel')
540
+ end
541
+ 'datacite'
542
+ elsif options[:ext] == '.cff'
543
+ 'cff'
544
+ elsif options[:ext] == '.json' && URI(Maremma.from_json(string).to_h.fetch('@context',
545
+ '')).host == 'schema.org'
546
+ 'schema_org'
547
+ elsif options[:ext] == '.json' && Maremma.from_json(string).to_h.dig('@context') == ('https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld')
548
+ 'codemeta'
549
+ elsif options[:ext] == '.json' && Maremma.from_json(string).to_h.dig('schemaVersion').to_s.start_with?('http://datacite.org/schema/kernel')
550
+ 'datacite_json'
551
+ elsif options[:ext] == '.json' && Maremma.from_json(string).to_h.dig('types') && Maremma.from_json(string).to_h.dig('publication_year').present?
552
+ 'crosscite'
553
+ elsif options[:ext] == '.json' && Maremma.from_json(string).to_h.dig('issued',
554
+ 'date-parts').present?
555
+ 'citeproc'
550
556
  end
551
557
  end
552
558
 
553
559
  def find_from_format_by_string(string)
554
- if Maremma.from_xml(string).to_h.dig("crossref_result", "query_result", "body", "query", "doi_record", "crossref").present?
555
- "crossref"
556
- elsif Nokogiri::XML(string, nil, 'UTF-8', &:noblanks).collect_namespaces.find { |k, v| v.start_with?("http://datacite.org/schema/kernel") }
557
- "datacite"
558
- elsif URI(Maremma.from_json(string).to_h.fetch("@context", "")).host == "schema.org"
559
- "schema_org"
560
- elsif Maremma.from_json(string).to_h.dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
561
- "codemeta"
562
- elsif Maremma.from_json(string).to_h.dig("schema-version").to_s.start_with?("http://datacite.org/schema/kernel")
563
- "datacite_json"
564
- elsif Maremma.from_json(string).to_h.dig("types").present? && Maremma.from_json(string).to_h.dig("publication_year").present?
565
- "crosscite"
566
- elsif Maremma.from_json(string).to_h.dig("issued", "date-parts").present?
567
- "citeproc"
568
- elsif string.start_with?("TY - ")
569
- "ris"
570
- elsif YAML.load(string).to_h.fetch("cff-version", nil).present?
571
- "cff"
560
+ if Maremma.from_xml(string).to_h.dig('crossref_result', 'query_result', 'body', 'query',
561
+ 'doi_record', 'crossref').present?
562
+ 'crossref'
563
+ elsif Nokogiri::XML(string, nil, 'UTF-8', &:noblanks).collect_namespaces.find do |_k, v|
564
+ v.start_with?('http://datacite.org/schema/kernel')
565
+ end
566
+ 'datacite'
567
+ elsif URI(Maremma.from_json(string).to_h.fetch('@context', '')).host == 'schema.org'
568
+ 'schema_org'
569
+ elsif Maremma.from_json(string).to_h.dig('@context') == ('https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld')
570
+ 'codemeta'
571
+ elsif Maremma.from_json(string).to_h.dig('schema-version').to_s.start_with?('http://datacite.org/schema/kernel')
572
+ 'datacite_json'
573
+ elsif Maremma.from_json(string).to_h.dig('types').present? && Maremma.from_json(string).to_h.dig('publication_year').present?
574
+ 'crosscite'
575
+ elsif Maremma.from_json(string).to_h.dig('issued', 'date-parts').present?
576
+ 'citeproc'
577
+ elsif string.start_with?('TY - ')
578
+ 'ris'
579
+ elsif YAML.load(string).to_h.fetch('cff-version', nil).present?
580
+ 'cff'
572
581
  elsif BibTeX.parse(string).first
573
- "bibtex"
582
+ 'bibtex'
574
583
  end
575
- rescue Psych::SyntaxError => error
576
- "bibtex"
577
- rescue BibTeX::ParseError => error
584
+ rescue Psych::SyntaxError => e
585
+ 'bibtex'
586
+ rescue BibTeX::ParseError => e
578
587
  nil
579
588
  end
580
589
 
581
590
  def orcid_from_url(url)
582
- Array(/\A:(http|https):\/\/orcid\.org\/(.+)/.match(url)).last
591
+ Array(%r{\A:(http|https)://orcid\.org/(.+)}.match(url)).last
583
592
  end
584
593
 
585
594
  def orcid_as_url(orcid)
@@ -587,40 +596,38 @@ module Briard
587
596
  end
588
597
 
589
598
  def validate_orcid(orcid)
590
- orcid = Array(/\A(?:(?:http|https):\/\/(?:(?:www|sandbox)?\.)?orcid\.org\/)?(\d{4}[[:space:]-]\d{4}[[:space:]-]\d{4}[[:space:]-]\d{3}[0-9X]+)\z/.match(orcid)).last
591
- orcid.gsub(/[[:space:]]/, "-") if orcid.present?
599
+ orcid = Array(%r{\A(?:(?:http|https)://(?:(?:www|sandbox)?\.)?orcid\.org/)?(\d{4}[[:space:]-]\d{4}[[:space:]-]\d{4}[[:space:]-]\d{3}[0-9X]+)\z}.match(orcid)).last
600
+ orcid.gsub(/[[:space:]]/, '-') if orcid.present?
592
601
  end
593
602
 
594
603
  def validate_orcid_scheme(orcid_scheme)
595
- Array(/\A(http|https):\/\/(www\.)?(orcid\.org)/.match(orcid_scheme)).last
604
+ Array(%r{\A(http|https)://(www\.)?(orcid\.org)}.match(orcid_scheme)).last
596
605
  end
597
606
 
598
607
  def validate_url(str)
599
- if /\A(?:(http|https):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(str)
600
- "DOI"
601
- elsif /\A(http|https):\/\//.match(str)
602
- "URL"
603
- elsif /\A(ISSN|eISSN) (\d{4}-\d{3}[0-9X]+)\z/.match(str)
604
- "ISSN"
608
+ if %r{\A(?:(http|https)://(dx\.)?doi.org/)?(doi:)?(10\.\d{4,5}/.+)\z}.match?(str)
609
+ 'DOI'
610
+ elsif %r{\A(http|https)://}.match?(str)
611
+ 'URL'
612
+ elsif /\A(ISSN|eISSN) (\d{4}-\d{3}[0-9X]+)\z/.match?(str)
613
+ 'ISSN'
605
614
  end
606
615
  end
607
616
 
608
- def parse_attributes(element, options={})
609
- content = options[:content] || "__content__"
617
+ def parse_attributes(element, options = {})
618
+ content = options[:content] || '__content__'
610
619
 
611
620
  if element.is_a?(String) && options[:content].nil?
612
621
  CGI.unescapeHTML(element)
613
622
  elsif element.is_a?(Hash)
614
- element.fetch( CGI.unescapeHTML(content), nil)
623
+ element.fetch(CGI.unescapeHTML(content), nil)
615
624
  elsif element.is_a?(Array)
616
625
  a = element.map { |e| e.is_a?(Hash) ? e.fetch(CGI.unescapeHTML(content), nil) : e }.uniq
617
626
  a = options[:first] ? a.first : a.unwrap
618
- else
619
- nil
620
627
  end
621
628
  end
622
629
 
623
- def normalize_id(id, options={})
630
+ def normalize_id(id, options = {})
624
631
  return nil unless id.present?
625
632
 
626
633
  # check for valid DOI
@@ -629,7 +636,7 @@ module Briard
629
636
 
630
637
  # check for valid HTTP uri
631
638
  uri = Addressable::URI.parse(id)
632
- return nil unless uri && uri.host && %w(http https).include?(uri.scheme)
639
+ return nil unless uri && uri.host && %w[http https].include?(uri.scheme)
633
640
 
634
641
  # clean up URL
635
642
  PostRank::URI.clean(id)
@@ -637,19 +644,19 @@ module Briard
637
644
  nil
638
645
  end
639
646
 
640
- def normalize_url(id, options={})
647
+ def normalize_url(id, options = {})
641
648
  return nil unless id.present?
642
649
 
643
650
  # handle info URIs
644
- return id if id.to_s.start_with?("info")
651
+ return id if id.to_s.start_with?('info')
645
652
 
646
653
  # check for valid HTTP uri
647
654
  uri = Addressable::URI.parse(id)
648
655
 
649
- return nil unless uri && uri.host && %w(http https ftp).include?(uri.scheme)
656
+ return nil unless uri && uri.host && %w[http https ftp].include?(uri.scheme)
650
657
 
651
658
  # optionally turn into https URL
652
- uri.scheme = "https" if options[:https]
659
+ uri.scheme = 'https' if options[:https]
653
660
 
654
661
  # clean up URL
655
662
  uri.path = PostRank::URI.clean(uri.path)
@@ -669,74 +676,74 @@ module Briard
669
676
  return nil unless orcid.present?
670
677
 
671
678
  # turn ORCID ID into URL
672
- "https://orcid.org/" + Addressable::URI.encode(orcid)
679
+ 'https://orcid.org/' + Addressable::URI.encode(orcid)
673
680
  end
674
681
 
675
682
  def normalize_ids(ids: nil, relation_type: nil)
676
- Array.wrap(ids).select { |idx| idx["@id"].present? }.map do |idx|
677
- id = normalize_id(idx["@id"])
678
- related_identifier_type = doi_from_url(id).present? ? "DOI" : "URL"
683
+ Array.wrap(ids).select { |idx| idx['@id'].present? }.map do |idx|
684
+ id = normalize_id(idx['@id'])
685
+ related_identifier_type = doi_from_url(id).present? ? 'DOI' : 'URL'
679
686
  id = doi_from_url(id) || id
680
687
 
681
- { "relatedIdentifier" => id,
682
- "relationType" => relation_type,
683
- "relatedIdentifierType" => related_identifier_type,
684
- "resourceTypeGeneral" => Metadata::SO_TO_DC_TRANSLATIONS[idx["@type"]] }.compact
688
+ { 'relatedIdentifier' => id,
689
+ 'relationType' => relation_type,
690
+ 'relatedIdentifierType' => related_identifier_type,
691
+ 'resourceTypeGeneral' => Metadata::SO_TO_DC_TRANSLATIONS[idx['@type']] }.compact
685
692
  end.unwrap
686
693
  end
687
694
 
688
695
  # pick electronic issn if there are multiple
689
696
  # format issn as xxxx-xxxx
690
- def normalize_issn(input, options={})
691
- content = options[:content] || "__content__"
697
+ def normalize_issn(input, options = {})
698
+ content = options[:content] || '__content__'
692
699
 
693
700
  issn = if input.blank?
694
- nil
695
- elsif input.is_a?(String) && options[:content].nil?
696
- input
697
- elsif input.is_a?(Hash)
698
- input.fetch(content, nil)
699
- elsif input.is_a?(Array)
700
- a = input.find { |a| a["media_type"] == "electronic" } || input.first
701
- a.fetch(content, nil)
702
- end
701
+ nil
702
+ elsif input.is_a?(String) && options[:content].nil?
703
+ input
704
+ elsif input.is_a?(Hash)
705
+ input.fetch(content, nil)
706
+ elsif input.is_a?(Array)
707
+ a = input.find { |a| a['media_type'] == 'electronic' } || input.first
708
+ a.fetch(content, nil)
709
+ end
703
710
 
704
711
  case issn.to_s.length
705
712
  when 9
706
713
  issn
707
714
  when 8
708
- issn[0..3] + "-" + issn[4..7]
709
- else
710
- nil
715
+ issn[0..3] + '-' + issn[4..7]
711
716
  end
712
717
  end
713
718
 
714
719
  # find Creative Commons or OSI license in licenses array, normalize url and name
715
720
  def normalize_licenses(licenses)
716
- standard_licenses = Array.wrap(licenses).map { |l| URI.parse(l["url"]) }.select { |li| li.host && li.host[/(creativecommons.org|opensource.org)$/] }
721
+ standard_licenses = Array.wrap(licenses).map do |l|
722
+ URI.parse(l['url'])
723
+ end.select { |li| li.host && li.host[/(creativecommons.org|opensource.org)$/] }
717
724
  return licenses unless standard_licenses.present?
718
725
 
719
726
  # use HTTPS
720
- uri.scheme = "https"
727
+ uri.scheme = 'https'
721
728
 
722
729
  # use host name without subdomain
723
730
  uri.host = Array(/(creativecommons.org|opensource.org)/.match uri.host).last
724
731
 
725
732
  # normalize URLs
726
- if uri.host == "creativecommons.org"
727
- uri.path = uri.path.split('/')[0..-2].join("/") if uri.path.split('/').last == "legalcode"
733
+ if uri.host == 'creativecommons.org'
734
+ uri.path = uri.path.split('/')[0..-2].join('/') if uri.path.split('/').last == 'legalcode'
728
735
  uri.path << '/' unless uri.path.end_with?('/')
729
736
  else
730
737
  uri.path = uri.path.gsub(/(-license|\.php|\.html)/, '')
731
738
  uri.path = uri.path.sub(/(mit|afl|apl|osl|gpl|ecl)/) { |match| match.upcase }
732
739
  uri.path = uri.path.sub(/(artistic|apache)/) { |match| match.titleize }
733
- uri.path = uri.path.sub(/([^0-9\-]+)(-)?([1-9])?(\.)?([0-9])?$/) do
740
+ uri.path = uri.path.sub(/([^0-9-]+)(-)?([1-9])?(\.)?([0-9])?$/) do
734
741
  m = Regexp.last_match
735
742
  text = m[1]
736
743
 
737
744
  if m[3].present?
738
- version = [m[3], m[5].presence || "0"].join(".")
739
- [text, version].join("-")
745
+ version = [m[3], m[5].presence || '0'].join('.')
746
+ [text, version].join('-')
740
747
  else
741
748
  text
742
749
  end
@@ -748,103 +755,111 @@ module Briard
748
755
  nil
749
756
  end
750
757
 
751
- def to_datacite_json(element, options={})
758
+ def to_datacite_json(element, options = {})
752
759
  a = Array.wrap(element).map do |e|
753
- e.inject({}) {|h, (k,v)| h[k.dasherize] = v; h }
760
+ e.each_with_object({}) do |(k, v), h|
761
+ h[k.dasherize] = v
762
+ end
754
763
  end
755
764
  options[:first] ? a.unwrap : a.presence
756
765
  end
757
766
 
758
767
  def from_datacite_json(element)
759
768
  Array.wrap(element).map do |e|
760
- e.inject({}) {|h, (k,v)| h[k.underscore] = v; h }
769
+ e.each_with_object({}) do |(k, v), h|
770
+ h[k.underscore] = v
771
+ end
761
772
  end
762
773
  end
763
774
 
764
775
  def to_schema_org(element)
765
- mapping = { "type" => "@type", "id" => "@id", "title" => "name" }
776
+ mapping = { 'type' => '@type', 'id' => '@id', 'title' => 'name' }
766
777
 
767
778
  map_hash_keys(element: element, mapping: mapping)
768
779
  end
769
780
 
770
781
  def to_schema_org_creators(element)
771
782
  element = Array.wrap(element).map do |c|
772
- c["affiliation"] = Array.wrap(c["affiliation"]).map do |a|
783
+ c['affiliation'] = Array.wrap(c['affiliation']).map do |a|
773
784
  if a.is_a?(String)
774
785
  name = a
775
786
  affiliation_identifier = nil
776
787
  else
777
- name = a["name"]
778
- affiliation_identifier = a["affiliationIdentifier"]
788
+ name = a['name']
789
+ affiliation_identifier = a['affiliationIdentifier']
779
790
  end
780
791
 
781
- {
782
- "@type" => "Organization",
783
- "@id" => affiliation_identifier,
784
- "name" => name }.compact
792
+ { '@type' => 'Organization', '@id' => affiliation_identifier, 'name' => name }.compact
785
793
  end.unwrap
786
- c["@type"] = c["nameType"].present? ? c["nameType"][0..-3] : nil
787
- c["@id"] = Array.wrap(c["nameIdentifiers"]).first.to_h.fetch("nameIdentifier", nil)
788
- c["name"] = c["familyName"].present? ? [c["givenName"], c["familyName"]].join(" ") : c["name"]
789
- c.except("nameIdentifiers", "nameType").compact
794
+ c['@type'] = c['nameType'].present? ? c['nameType'][0..-3] : nil
795
+ c['@id'] = Array.wrap(c['nameIdentifiers']).first.to_h.fetch('nameIdentifier', nil)
796
+ c['name'] =
797
+ c['familyName'].present? ? [c['givenName'], c['familyName']].join(' ') : c['name']
798
+ c.except('nameIdentifiers', 'nameType').compact
790
799
  end.unwrap
791
800
  end
792
801
 
793
802
  def to_schema_org_contributors(element)
794
803
  element = Array.wrap(element).map do |c|
795
- c["affiliation"] = Array.wrap(c["affiliation"]).map do |a|
804
+ c['affiliation'] = Array.wrap(c['affiliation']).map do |a|
796
805
  if a.is_a?(String)
797
806
  name = a
798
807
  affiliation_identifier = nil
799
808
  else
800
- name = a["name"]
801
- affiliation_identifier = a["affiliationIdentifier"]
809
+ name = a['name']
810
+ affiliation_identifier = a['affiliationIdentifier']
802
811
  end
803
812
 
804
- {
805
- "@type" => "Organization",
806
- "@id" => affiliation_identifier,
807
- "name" => name }.compact
813
+ { '@type' => 'Organization', '@id' => affiliation_identifier, 'name' => name }.compact
808
814
  end.unwrap
809
- c["@type"] = c["nameType"].present? ? c["nameType"][0..-3] : nil
810
- c["@id"] = Array.wrap(c["nameIdentifiers"]).first.to_h.fetch("nameIdentifier", nil)
811
- c["name"] = c["familyName"].present? ? [c["givenName"], c["familyName"]].join(" ") : c["name"]
812
- c.except("nameIdentifiers", "nameType").compact
815
+ c['@type'] = c['nameType'].present? ? c['nameType'][0..-3] : nil
816
+ c['@id'] = Array.wrap(c['nameIdentifiers']).first.to_h.fetch('nameIdentifier', nil)
817
+ c['name'] =
818
+ c['familyName'].present? ? [c['givenName'], c['familyName']].join(' ') : c['name']
819
+ c.except('nameIdentifiers', 'nameType').compact
813
820
  end.unwrap
814
821
  end
815
822
 
816
- def to_schema_org_container(element, options={})
817
- return nil unless (element.is_a?(Hash) || (element.nil? && options[:container_title].present?))
823
+ def to_schema_org_container(element, options = {})
824
+ return nil unless element.is_a?(Hash) || (element.nil? && options[:container_title].present?)
818
825
 
819
826
  {
820
- "@id" => element["identifier"],
821
- "@type" => (options[:type] == "Dataset") ? "DataCatalog" : "Periodical",
822
- "name" => element["title"] || options[:container_title] }.compact
827
+ '@id' => element['identifier'],
828
+ '@type' => options[:type] == 'Dataset' ? 'DataCatalog' : 'Periodical',
829
+ 'name' => element['title'] || options[:container_title]
830
+ }.compact
823
831
  end
824
832
 
825
- def to_schema_org_identifiers(element, options={})
833
+ def to_schema_org_identifiers(element, _options = {})
826
834
  Array.wrap(element).map do |ai|
827
835
  {
828
- "@type" => "PropertyValue",
829
- "propertyID" => ai["identifierType"],
830
- "value" => ai["identifier"] }
836
+ '@type' => 'PropertyValue',
837
+ 'propertyID' => ai['identifierType'],
838
+ 'value' => ai['identifier']
839
+ }
831
840
  end.unwrap
832
841
  end
833
842
 
834
843
  def to_schema_org_relation(related_identifiers: nil, relation_type: nil)
835
844
  return nil unless related_identifiers.present? && relation_type.present?
836
845
 
837
- relation_type = relation_type == "References" ? ["References", "Cites", "Documents"] : [relation_type]
838
-
839
- Array.wrap(related_identifiers).select { |ri| relation_type.include?(ri["relationType"]) }.map do |r|
840
- if r["relatedIdentifierType"] == "ISSN" && r["relationType"] == "IsPartOf"
841
- {
842
- "@type" => "Periodical",
843
- "issn" => r["relatedIdentifier"] }.compact
846
+ relation_type = if relation_type == 'References'
847
+ %w[References Cites
848
+ Documents]
849
+ else
850
+ [relation_type]
851
+ end
852
+
853
+ Array.wrap(related_identifiers).select do |ri|
854
+ relation_type.include?(ri['relationType'])
855
+ end.map do |r|
856
+ if r['relatedIdentifierType'] == 'ISSN' && r['relationType'] == 'IsPartOf'
857
+ { '@type' => 'Periodical', 'issn' => r['relatedIdentifier'] }.compact
844
858
  else
845
- {
846
- "@id" => normalize_id(r["relatedIdentifier"]),
847
- "@type" => DC_TO_SO_TRANSLATIONS[r["resourceTypeGeneral"]] || "CreativeWork" }.compact
859
+ {
860
+ '@id' => normalize_id(r['relatedIdentifier']),
861
+ '@type' => DC_TO_SO_TRANSLATIONS[r['resourceTypeGeneral']] || 'CreativeWork'
862
+ }.compact
848
863
  end
849
864
  end.unwrap
850
865
  end
@@ -854,132 +869,162 @@ module Briard
854
869
 
855
870
  Array.wrap(funding_references).map do |fr|
856
871
  {
857
- "@id" => fr["funderIdentifier"],
858
- "@type" => "Organization",
859
- "name" => fr["funderName"] }.compact
872
+ '@id' => fr['funderIdentifier'],
873
+ '@type' => 'Organization',
874
+ 'name' => fr['funderName']
875
+ }.compact
860
876
  end.unwrap
861
877
  end
862
878
 
863
879
  def to_schema_org_spatial_coverage(geo_location)
864
880
  return nil unless geo_location.present?
865
881
 
866
- Array.wrap(geo_location).reduce([]) do |sum, gl|
867
- if gl.fetch("geoLocationPoint", nil)
882
+ Array.wrap(geo_location).each_with_object([]) do |gl, sum|
883
+ if gl.fetch('geoLocationPoint', nil)
868
884
  sum << {
869
- "@type" => "Place",
870
- "geo" => {
871
- "@type" => "GeoCoordinates",
872
- "address" => gl["geoLocationPlace"],
873
- "latitude" => gl.dig("geoLocationPoint", "pointLatitude"),
874
- "longitude" => gl.dig("geoLocationPoint", "pointLongitude") }
885
+ '@type' => 'Place',
886
+ 'geo' => {
887
+ '@type' => 'GeoCoordinates',
888
+ 'address' => gl['geoLocationPlace'],
889
+ 'latitude' => gl.dig('geoLocationPoint', 'pointLatitude'),
890
+ 'longitude' => gl.dig('geoLocationPoint', 'pointLongitude')
891
+ }
875
892
  }.compact
876
893
  end
877
894
 
878
- if gl.fetch("geoLocationBox", nil)
895
+ if gl.fetch('geoLocationBox', nil)
879
896
  sum << {
880
- "@type" => "Place",
881
- "geo" => {
882
- "@type" => "GeoShape",
883
- "address" => gl["geoLocationPlace"],
884
- "box" => [gl.dig("geoLocationBox", "southBoundLatitude"),
885
- gl.dig("geoLocationBox", "westBoundLongitude"),
886
- gl.dig("geoLocationBox", "northBoundLatitude"),
887
- gl.dig("geoLocationBox", "eastBoundLongitude")].compact.join(" ").presence }.compact
897
+ '@type' => 'Place',
898
+ 'geo' => {
899
+ '@type' => 'GeoShape',
900
+ 'address' => gl['geoLocationPlace'],
901
+ 'box' => [gl.dig('geoLocationBox', 'southBoundLatitude'),
902
+ gl.dig('geoLocationBox', 'westBoundLongitude'),
903
+ gl.dig('geoLocationBox', 'northBoundLatitude'),
904
+ gl.dig('geoLocationBox', 'eastBoundLongitude')].compact.join(' ').presence
905
+ }.compact
888
906
  }.compact
889
907
  end
890
908
 
891
- if gl.fetch("geoLocationPolygon", nil)
909
+ if gl.fetch('geoLocationPolygon', nil)
892
910
  sum << {
893
- "@type" => "Place",
894
- "geo" => {
895
- "@type" => "GeoShape",
896
- "address" => gl["geoLocationPlace"],
897
- "polygon" => Array.wrap(gl.dig("geoLocationPolygon")).map do |glp|
911
+ '@type' => 'Place',
912
+ 'geo' => {
913
+ '@type' => 'GeoShape',
914
+ 'address' => gl['geoLocationPlace'],
915
+ 'polygon' => Array.wrap(gl.dig('geoLocationPolygon')).map do |glp|
898
916
  Array.wrap(glp).map do |glpp|
899
- [glpp.dig("polygonPoint", "pointLongitude"), glpp.dig("polygonPoint", "pointLatitude")].compact
917
+ [glpp.dig('polygonPoint', 'pointLongitude'),
918
+ glpp.dig('polygonPoint', 'pointLatitude')].compact
900
919
  end.compact
901
- end.compact.presence,
902
- }
920
+ end.compact.presence
921
+ }
903
922
  }
904
923
  end
905
924
 
906
- if gl.fetch("geoLocationPlace", nil) && !gl.fetch("geoLocationPoint", nil) && !gl.fetch("geoLocationBox", nil) && !gl.fetch("geoLocationPolygon", nil)
907
- sum << {
908
- "@type" => "Place",
909
- "geo" => {
910
- "@type" => "GeoCoordinates",
911
- "address" => gl["geoLocationPlace"] }
912
- }.compact
913
- end
914
-
915
- sum
925
+ next unless gl.fetch('geoLocationPlace',
926
+ nil) && !gl.fetch('geoLocationPoint',
927
+ nil) && !gl.fetch('geoLocationBox',
928
+ nil) && !gl.fetch(
929
+ 'geoLocationPolygon', nil
930
+ )
931
+
932
+ sum << {
933
+ '@type' => 'Place',
934
+ 'geo' => {
935
+ '@type' => 'GeoCoordinates',
936
+ 'address' => gl['geoLocationPlace']
937
+ }
938
+ }.compact
916
939
  end.unwrap
917
940
  end
918
941
 
919
942
  def from_schema_org(element)
920
- mapping = { "@type" => "type", "@id" => "id" }
943
+ mapping = { '@type' => 'type', '@id' => 'id' }
921
944
 
922
945
  map_hash_keys(element: element, mapping: mapping)
923
946
  end
924
947
 
925
948
  def from_schema_org_creators(element)
926
949
  element = Array.wrap(element).map do |c|
927
- if c["affiliation"].is_a?(String)
928
- c["affiliation"] = { "name" => c["affiliation"] }
950
+ if c['affiliation'].is_a?(String)
951
+ c['affiliation'] = { 'name' => c['affiliation'] }
929
952
  affiliation_identifier_scheme = nil
930
953
  scheme_uri = nil
931
- elsif c.dig("affiliation", "@id").to_s.starts_with?("https://ror.org")
932
- affiliation_identifier_scheme = "ROR"
933
- scheme_uri = "https://ror.org/"
934
- elsif c.dig("affiliation", "@id").to_s.starts_with?("https://isni.org")
935
- affiliation_identifier_scheme = "ISNI"
936
- scheme_uri = "https://isni.org/isni/"
954
+ elsif c.dig('affiliation', '@id').to_s.starts_with?('https://ror.org')
955
+ affiliation_identifier_scheme = 'ROR'
956
+ scheme_uri = 'https://ror.org/'
957
+ elsif c.dig('affiliation', '@id').to_s.starts_with?('https://isni.org')
958
+ affiliation_identifier_scheme = 'ISNI'
959
+ scheme_uri = 'https://isni.org/isni/'
937
960
  else
938
961
  affiliation_identifier_scheme = nil
939
962
  scheme_uri = nil
940
963
  end
941
964
 
942
965
  # alternatively find the nameIdentifier in the identifer attribute
943
- c["@id"] = c["identifier"] if c["identifier"].present? && c["@id"].blank?
966
+ c['@id'] = c['identifier'] if c['identifier'].present? && c['@id'].blank?
944
967
 
945
968
  # alternatively find the nameIdentifier in the sameAs attribute
946
- c["@id"] = c["sameAs"].first if Array(c["sameAs"]).find { |item| URI(item).host == "orcid.org" }
947
-
948
- c["nameIdentifier"] = [{ "__content__" => c["@id"], "nameIdentifierScheme" => "ORCID", "schemeUri" => "https://orcid.org" }] if normalize_orcid(c["@id"])
949
- c["@type"] = c["@type"].find { |t| %w(Person Organization).include?(t) } if c["@type"].is_a?(Array)
950
- c["creatorName"] = { "nameType" => c["@type"].present? ? c["@type"].titleize + "al" : nil, "__content__" => c["name"] }.compact
951
- c["affiliation"] = { "__content__" => c.dig("affiliation", "name"), "affiliationIdentifier" => c.dig("affiliation", "@id"), "affiliationIdentifierScheme" => affiliation_identifier_scheme, "schemeUri" => scheme_uri }.compact.presence
952
- c.except("@id", "@type", "name").compact
969
+ c['@id'] = c['sameAs'].first if Array(c['sameAs']).find do |item|
970
+ URI(item).host == 'orcid.org'
971
+ end
972
+
973
+ if normalize_orcid(c['@id'])
974
+ c['nameIdentifier'] =
975
+ [{ '__content__' => c['@id'], 'nameIdentifierScheme' => 'ORCID',
976
+ 'schemeUri' => 'https://orcid.org' }]
977
+ end
978
+ if c['@type'].is_a?(Array)
979
+ c['@type'] = c['@type'].find do |t|
980
+ %w[Person Organization].include?(t)
981
+ end
982
+ end
983
+ c['creatorName'] =
984
+ { 'nameType' => c['@type'].present? ? c['@type'].titleize + 'al' : nil,
985
+ '__content__' => c['name'] }.compact
986
+ c['affiliation'] =
987
+ { '__content__' => c.dig('affiliation', 'name'),
988
+ 'affiliationIdentifier' => c.dig('affiliation', '@id'), 'affiliationIdentifierScheme' => affiliation_identifier_scheme, 'schemeUri' => scheme_uri }.compact.presence
989
+ c.except('@id', '@type', 'name').compact
953
990
  end
954
991
  end
955
992
 
956
993
  def from_schema_org_contributors(element)
957
994
  element = Array.wrap(element).map do |c|
958
- if c["affiliation"].is_a?(String)
959
- c["affiliation"] = { "name" => c["affiliation"] }
995
+ if c['affiliation'].is_a?(String)
996
+ c['affiliation'] = { 'name' => c['affiliation'] }
960
997
  affiliation_identifier_scheme = nil
961
998
  scheme_uri = nil
962
- elsif c.dig("affiliation", "@id").to_s.starts_with?("https://ror.org")
963
- affiliation_identifier_scheme = "ROR"
964
- scheme_uri = "https://ror.org/"
965
- elsif c.dig("affiliation", "@id").to_s.starts_with?("https://isni.org")
966
- affiliation_identifier_scheme = "ISNI"
967
- scheme_uri = "https://isni.org/isni/"
999
+ elsif c.dig('affiliation', '@id').to_s.starts_with?('https://ror.org')
1000
+ affiliation_identifier_scheme = 'ROR'
1001
+ scheme_uri = 'https://ror.org/'
1002
+ elsif c.dig('affiliation', '@id').to_s.starts_with?('https://isni.org')
1003
+ affiliation_identifier_scheme = 'ISNI'
1004
+ scheme_uri = 'https://isni.org/isni/'
968
1005
  else
969
1006
  affiliation_identifier_scheme = nil
970
1007
  scheme_uri = nil
971
1008
  end
972
1009
 
973
- c["nameIdentifier"] = [{ "__content__" => c["@id"], "nameIdentifierScheme" => "ORCID", "schemeUri" => "https://orcid.org" }] if normalize_orcid(c["@id"])
974
- c["contributorName"] = { "nameType" => c["@type"].present? ? c["@type"].titleize + "al" : nil, "__content__" => c["name"] }.compact
975
- c["affiliation"] = { "__content__" => c.dig("affiliation", "name"), "affiliationIdentifier" => c.dig("affiliation", "@id"), "affiliationIdentifierScheme" => affiliation_identifier_scheme, "schemeUri" => scheme_uri }.compact.presence
976
- c.except("@id", "@type", "name").compact
1010
+ if normalize_orcid(c['@id'])
1011
+ c['nameIdentifier'] =
1012
+ [{ '__content__' => c['@id'], 'nameIdentifierScheme' => 'ORCID',
1013
+ 'schemeUri' => 'https://orcid.org' }]
1014
+ end
1015
+ c['contributorName'] =
1016
+ { 'nameType' => c['@type'].present? ? c['@type'].titleize + 'al' : nil,
1017
+ '__content__' => c['name'] }.compact
1018
+ c['affiliation'] =
1019
+ { '__content__' => c.dig('affiliation', 'name'),
1020
+ 'affiliationIdentifier' => c.dig('affiliation', '@id'), 'affiliationIdentifierScheme' => affiliation_identifier_scheme, 'schemeUri' => scheme_uri }.compact.presence
1021
+ c.except('@id', '@type', 'name').compact
977
1022
  end
978
1023
  end
979
1024
 
980
1025
  def map_hash_keys(element: nil, mapping: nil)
981
1026
  Array.wrap(element).map do |a|
982
- a.map {|k, v| [mapping.fetch(k, k), v] }.reduce({}) do |hsh, (k, v)|
1027
+ a.map { |k, v| [mapping.fetch(k, k), v] }.reduce({}) do |hsh, (k, v)|
983
1028
  if v.is_a?(Hash)
984
1029
  hsh[k] = to_schema_org(v)
985
1030
  hsh
@@ -993,48 +1038,50 @@ module Briard
993
1038
 
994
1039
  def to_identifier(identifier)
995
1040
  {
996
- "@type" => "PropertyValue",
997
- "propertyID" => identifier["relatedIdentifierType"],
998
- "value" => identifier["relatedIdentifier"] }
1041
+ '@type' => 'PropertyValue',
1042
+ 'propertyID' => identifier['relatedIdentifierType'],
1043
+ 'value' => identifier['relatedIdentifier']
1044
+ }
999
1045
  end
1000
1046
 
1001
1047
  def from_citeproc(element)
1002
1048
  Array.wrap(element).map do |a|
1003
- if a["literal"].present?
1004
- a["@type"] = "Organization"
1005
- a["name"] = a["literal"]
1049
+ if a['literal'].present?
1050
+ a['@type'] = 'Organization'
1051
+ a['name'] = a['literal']
1006
1052
  else
1007
- a["@type"] = "Person"
1008
- a["name"] = [a["given"], a["family"]].compact.join(" ")
1053
+ a['@type'] = 'Person'
1054
+ a['name'] = [a['given'], a['family']].compact.join(' ')
1009
1055
  end
1010
- a["givenName"] = a["given"]
1011
- a["familyName"] = a["family"]
1012
- a.except("given", "family", "literal").compact
1056
+ a['givenName'] = a['given']
1057
+ a['familyName'] = a['family']
1058
+ a.except('given', 'family', 'literal').compact
1013
1059
  end.unwrap
1014
1060
  end
1015
1061
 
1016
1062
  def to_citeproc(element)
1017
1063
  Array.wrap(element).map do |a|
1018
- a["family"] = a["familyName"]
1019
- a["given"] = a["givenName"]
1020
- a["literal"] = a["name"] unless a["familyName"].present?
1021
- a.except("nameType", "type", "@type", "id", "@id", "name", "familyName", "givenName", "affiliation", "nameIdentifiers", "contributorType").compact
1064
+ a['family'] = a['familyName']
1065
+ a['given'] = a['givenName']
1066
+ a['literal'] = a['name'] unless a['familyName'].present?
1067
+ a.except('nameType', 'type', '@type', 'id', '@id', 'name', 'familyName', 'givenName',
1068
+ 'affiliation', 'nameIdentifiers', 'contributorType').compact
1022
1069
  end.presence
1023
1070
  end
1024
1071
 
1025
1072
  def to_ris(element)
1026
1073
  Array.wrap(element).map do |a|
1027
- if a["familyName"].present?
1028
- [a["familyName"], a["givenName"]].join(", ")
1074
+ if a['familyName'].present?
1075
+ [a['familyName'], a['givenName']].join(', ')
1029
1076
  else
1030
- a["name"]
1077
+ a['name']
1031
1078
  end
1032
1079
  end.unwrap
1033
1080
  end
1034
1081
 
1035
- def sanitize(text, options={})
1036
- options[:tags] ||= Set.new(%w(strong em b i code pre sub sup br))
1037
- content = options[:content] || "__content__"
1082
+ def sanitize(text, options = {})
1083
+ options[:tags] ||= Set.new(%w[strong em b i code pre sub sup br])
1084
+ content = options[:content] || '__content__'
1038
1085
  custom_scrubber = Briard::WhitelistScrubber.new(options)
1039
1086
 
1040
1087
  if text.is_a?(String)
@@ -1045,20 +1092,16 @@ module Briard
1045
1092
  elsif text.is_a?(Array)
1046
1093
  a = text.map { |e| e.is_a?(Hash) ? sanitize(e.fetch(content, nil)) : sanitize(e) }.uniq
1047
1094
  a = options[:first] ? a.first : a.unwrap
1048
- else
1049
- nil
1050
1095
  end
1051
1096
  end
1052
1097
 
1053
1098
  def github_from_url(url)
1054
- return {} unless /\Ahttps:\/\/github\.com\/(.+)(?:\/)?(.+)?(?:\/tree\/)?(.*)\z/.match(url)
1099
+ return {} unless %r{\Ahttps://github\.com/(.+)(?:/)?(.+)?(?:/tree/)?(.*)\z}.match?(url)
1100
+
1055
1101
  words = URI.parse(url).path[1..-1].split('/')
1056
- path = words.length > 3 ? words[4...words.length].join("/") : nil
1102
+ path = words.length > 3 ? words[4...words.length].join('/') : nil
1057
1103
 
1058
- { owner: words[0],
1059
- repo: words[1],
1060
- release: words[3],
1061
- path: path }.compact
1104
+ { owner: words[0], repo: words[1], release: words[3], path: path }.compact
1062
1105
  end
1063
1106
 
1064
1107
  def github_repo_from_url(url)
@@ -1080,18 +1123,22 @@ module Briard
1080
1123
 
1081
1124
  def github_as_repo_url(url)
1082
1125
  github_hash = github_from_url(url)
1083
- "https://github.com/#{github_hash[:owner]}/#{github_hash[:repo]}" if github_hash[:repo].present?
1126
+ return unless github_hash[:repo].present?
1127
+
1128
+ "https://github.com/#{github_hash[:owner]}/#{github_hash[:repo]}"
1084
1129
  end
1085
1130
 
1086
1131
  def github_as_release_url(url)
1087
1132
  github_hash = github_from_url(url)
1088
- "https://github.com/#{github_hash[:owner]}/#{github_hash[:repo]}/tree/#{github_hash[:release]}" if github_hash[:release].present?
1133
+ return unless github_hash[:release].present?
1134
+
1135
+ "https://github.com/#{github_hash[:owner]}/#{github_hash[:repo]}/tree/#{github_hash[:release]}"
1089
1136
  end
1090
1137
 
1091
1138
  def github_as_codemeta_url(url)
1092
1139
  github_hash = github_from_url(url)
1093
1140
 
1094
- if github_hash[:path].to_s.end_with?("codemeta.json")
1141
+ if github_hash[:path].to_s.end_with?('codemeta.json')
1095
1142
  "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/#{github_hash[:release]}/#{github_hash[:path]}"
1096
1143
  elsif github_hash[:owner].present?
1097
1144
  "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/master/codemeta.json"
@@ -1101,7 +1148,7 @@ module Briard
1101
1148
  def github_as_cff_url(url)
1102
1149
  github_hash = github_from_url(url)
1103
1150
 
1104
- if github_hash[:path].to_s.end_with?("CITATION.cff")
1151
+ if github_hash[:path].to_s.end_with?('CITATION.cff')
1105
1152
  "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/#{github_hash[:release]}/#{github_hash[:path]}"
1106
1153
  elsif github_hash[:owner].present?
1107
1154
  "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/main/CITATION.cff"
@@ -1120,13 +1167,17 @@ module Briard
1120
1167
  end
1121
1168
 
1122
1169
  def get_date_from_date_parts(date_as_parts)
1123
- date_parts = date_as_parts.fetch("date-parts", []).first
1124
- year, month, day = date_parts[0], date_parts[1], date_parts[2]
1170
+ date_parts = date_as_parts.fetch('date-parts', []).first
1171
+ year = date_parts[0]
1172
+ month = date_parts[1]
1173
+ day = date_parts[2]
1125
1174
  get_date_from_parts(year, month, day)
1126
1175
  end
1127
1176
 
1128
1177
  def get_date_from_parts(year, month = nil, day = nil)
1129
- [year.to_s.rjust(4, '0'), month.to_s.rjust(2, '0'), day.to_s.rjust(2, '0')].reject { |part| part == "00" }.join("-")
1178
+ [year.to_s.rjust(4, '0'), month.to_s.rjust(2, '0'), day.to_s.rjust(2, '0')].reject do |part|
1179
+ part == '00'
1180
+ end.join('-')
1130
1181
  end
1131
1182
 
1132
1183
  def get_date_parts_from_parts(year, month = nil, day = nil)
@@ -1163,67 +1214,67 @@ module Briard
1163
1214
  # return nil if invalid iso8601 timestamp
1164
1215
  def get_datetime_from_iso8601(iso8601_time)
1165
1216
  ISO8601::DateTime.new(iso8601_time).to_time.utc
1166
- rescue
1217
+ rescue StandardError
1167
1218
  nil
1168
1219
  end
1169
1220
 
1170
1221
  # strip milliseconds if there is a time, as it interferes with edtc parsing
1171
1222
  # keep dates unchanged
1172
1223
  def strip_milliseconds(iso8601_time)
1173
- return iso8601_time.split(" ").first if iso8601_time.to_s.include? " "
1224
+ return iso8601_time.split(' ').first if iso8601_time.to_s.include? ' '
1174
1225
 
1175
- return iso8601_time.split(".").first + "Z" if iso8601_time.to_s.include? "."
1226
+ return iso8601_time.split('.').first + 'Z' if iso8601_time.to_s.include? '.'
1176
1227
 
1177
- return iso8601_time
1178
- end
1228
+ iso8601_time
1229
+ end
1179
1230
 
1180
1231
  # iso8601 datetime without hyphens and colons, used by Crossref
1181
1232
  # return nil if invalid
1182
1233
  def get_datetime_from_time(time)
1183
- DateTime.strptime(time.to_s, "%Y%m%d%H%M%S").strftime('%Y-%m-%dT%H:%M:%SZ')
1234
+ DateTime.strptime(time.to_s, '%Y%m%d%H%M%S').strftime('%Y-%m-%dT%H:%M:%SZ')
1184
1235
  rescue ArgumentError
1185
1236
  nil
1186
1237
  end
1187
1238
 
1188
1239
  def get_date(dates, date_type)
1189
- dd = Array.wrap(dates).find { |d| d["dateType"] == date_type } || {}
1190
- dd.fetch("date", nil)
1240
+ dd = Array.wrap(dates).find { |d| d['dateType'] == date_type } || {}
1241
+ dd.fetch('date', nil)
1191
1242
  end
1192
1243
 
1193
1244
  def get_contributor(contributor, contributor_type)
1194
- contributor.select { |c| c["contributorType"] == contributor_type }
1245
+ contributor.select { |c| c['contributorType'] == contributor_type }
1195
1246
  end
1196
1247
 
1197
1248
  def get_identifier(identifiers, identifier_type)
1198
- id = Array.wrap(identifiers).find { |i| i["identifierType"] == identifier_type } || {}
1199
- id.fetch("identifier", nil)
1249
+ id = Array.wrap(identifiers).find { |i| i['identifierType'] == identifier_type } || {}
1250
+ id.fetch('identifier', nil)
1200
1251
  end
1201
1252
 
1202
1253
  def get_identifier_type(identifier_type)
1203
1254
  return nil unless identifier_type.present?
1204
1255
 
1205
1256
  identifierTypes = {
1206
- "ark" => "ARK",
1207
- "arxiv" => "arXiv",
1208
- "bibcode" => "bibcode",
1209
- "doi" => "DOI",
1210
- "ean13" => "EAN13",
1211
- "eissn" => "EISSN",
1212
- "handle" => "Handle",
1213
- "igsn" => "IGSN",
1214
- "isbn" => "ISBN",
1215
- "issn" => "ISSN",
1216
- "istc" => "ISTC",
1217
- "lissn" => "LISSN",
1218
- "lsid" => "LSID",
1219
- "pmid" => "PMID",
1220
- "purl" => "PURL",
1221
- "upc" => "UPC",
1222
- "url" => "URL",
1223
- "urn" => "URN",
1224
- "md5" => "md5",
1225
- "minid" => "minid",
1226
- "dataguid" => "dataguid"
1257
+ 'ark' => 'ARK',
1258
+ 'arxiv' => 'arXiv',
1259
+ 'bibcode' => 'bibcode',
1260
+ 'doi' => 'DOI',
1261
+ 'ean13' => 'EAN13',
1262
+ 'eissn' => 'EISSN',
1263
+ 'handle' => 'Handle',
1264
+ 'igsn' => 'IGSN',
1265
+ 'isbn' => 'ISBN',
1266
+ 'issn' => 'ISSN',
1267
+ 'istc' => 'ISTC',
1268
+ 'lissn' => 'LISSN',
1269
+ 'lsid' => 'LSID',
1270
+ 'pmid' => 'PMID',
1271
+ 'purl' => 'PURL',
1272
+ 'upc' => 'UPC',
1273
+ 'url' => 'URL',
1274
+ 'urn' => 'URN',
1275
+ 'md5' => 'md5',
1276
+ 'minid' => 'minid',
1277
+ 'dataguid' => 'dataguid'
1227
1278
  }
1228
1279
 
1229
1280
  identifierTypes[identifier_type.downcase] || identifier_type
@@ -1232,26 +1283,27 @@ module Briard
1232
1283
  def get_series_information(str)
1233
1284
  return {} unless str.present?
1234
1285
 
1235
- str = str.split(",").map(&:strip)
1286
+ str = str.split(',').map(&:strip)
1236
1287
 
1237
1288
  title = str.first
1238
1289
  volume_issue = str.length > 2 ? str[1].rpartition(/\(([^)]+)\)/) : nil
1239
1290
  volume = volume_issue.present? ? volume_issue[0].presence || volume_issue[2].presence : nil
1240
1291
  issue = volume_issue.present? ? volume_issue[1][1...-1].presence : nil
1241
1292
  pages = str.length > 1 ? str.last : nil
1242
- first_page = pages.present? ? pages.split("-").map(&:strip)[0] : nil
1243
- last_page = pages.present? ? pages.split("-").map(&:strip)[1] : nil
1293
+ first_page = pages.present? ? pages.split('-').map(&:strip)[0] : nil
1294
+ last_page = pages.present? ? pages.split('-').map(&:strip)[1] : nil
1244
1295
 
1245
1296
  {
1246
- "title" => title,
1247
- "volume" => volume,
1248
- "issue" => issue,
1249
- "firstPage" => first_page,
1250
- "lastPage" => last_page }.compact
1297
+ 'title' => title,
1298
+ 'volume' => volume,
1299
+ 'issue' => issue,
1300
+ 'firstPage' => first_page,
1301
+ 'lastPage' => last_page
1302
+ }.compact
1251
1303
  end
1252
1304
 
1253
1305
  def jsonlint(json)
1254
- return ["No JSON provided"] unless json.present?
1306
+ return ['No JSON provided'] unless json.present?
1255
1307
 
1256
1308
  error_array = []
1257
1309
  linter = JsonLint::Linter.new
@@ -1260,149 +1312,172 @@ module Briard
1260
1312
  end
1261
1313
 
1262
1314
  def name_to_spdx(name)
1263
- spdx = JSON.load(File.read(File.expand_path('../../../resources/spdx/licenses.json', __FILE__))).fetch("licenses")
1264
- license = spdx.find { |l| l["name"] == name || l["licenseId"] == name || l["seeAlso"].first == normalize_cc_url(name) }
1315
+ spdx = JSON.load(File.read(File.expand_path('../../resources/spdx/licenses.json',
1316
+ __dir__))).fetch('licenses')
1317
+ license = spdx.find do |l|
1318
+ l['name'] == name || l['licenseId'] == name || l['seeAlso'].first == normalize_cc_url(name)
1319
+ end
1265
1320
 
1266
1321
  if license
1267
1322
  {
1268
- "rights" => license["name"],
1269
- "rightsUri" => license["seeAlso"].first,
1270
- "rightsIdentifier" => license["licenseId"].downcase,
1271
- "rightsIdentifierScheme" => "SPDX",
1272
- "schemeUri" => "https://spdx.org/licenses/" }.compact
1323
+ 'rights' => license['name'],
1324
+ 'rightsUri' => license['seeAlso'].first,
1325
+ 'rightsIdentifier' => license['licenseId'].downcase,
1326
+ 'rightsIdentifierScheme' => 'SPDX',
1327
+ 'schemeUri' => 'https://spdx.org/licenses/'
1328
+ }.compact
1273
1329
  else
1274
- { "rights" => name }
1330
+ { 'rights' => name }
1275
1331
  end
1276
1332
  end
1277
1333
 
1278
1334
  def hsh_to_spdx(hsh)
1279
- spdx = JSON.load(File.read(File.expand_path('../../../resources/spdx/licenses.json', __FILE__))).fetch("licenses")
1280
- license = spdx.find { |l| l["licenseId"].casecmp?(hsh["rightsIdentifier"]) || l["seeAlso"].first == normalize_cc_url(hsh["rightsURI"]) || l["name"] == hsh["rights"] || l["seeAlso"].first == normalize_cc_url(hsh["rights"]) }
1335
+ spdx = JSON.load(File.read(File.expand_path('../../resources/spdx/licenses.json',
1336
+ __dir__))).fetch('licenses')
1337
+ license = spdx.find do |l|
1338
+ l['licenseId'].casecmp?(hsh['rightsIdentifier']) || l['seeAlso'].first == normalize_cc_url(hsh['rightsURI']) || l['name'] == hsh['rights'] || l['seeAlso'].first == normalize_cc_url(hsh['rights'])
1339
+ end
1281
1340
 
1282
1341
  if license
1283
1342
  {
1284
- "rights" => license["name"],
1285
- "rightsUri" => license["seeAlso"].first,
1286
- "rightsIdentifier" => license["licenseId"].downcase,
1287
- "rightsIdentifierScheme" => "SPDX",
1288
- "schemeUri" => "https://spdx.org/licenses/",
1289
- "lang" => hsh["lang"] }.compact
1343
+ 'rights' => license['name'],
1344
+ 'rightsUri' => license['seeAlso'].first,
1345
+ 'rightsIdentifier' => license['licenseId'].downcase,
1346
+ 'rightsIdentifierScheme' => 'SPDX',
1347
+ 'schemeUri' => 'https://spdx.org/licenses/',
1348
+ 'lang' => hsh['lang']
1349
+ }.compact
1290
1350
  else
1291
1351
  {
1292
- "rights" => hsh["__content__"] || hsh["rights"],
1293
- "rightsUri" => hsh["rightsURI"] || hsh["rightsUri"],
1294
- "rightsIdentifier" => hsh["rightsIdentifier"].present? ? hsh["rightsIdentifier"].downcase : nil,
1295
- "rightsIdentifierScheme" => hsh["rightsIdentifierScheme"],
1296
- "schemeUri" => hsh["schemeUri"],
1297
- "lang" => hsh["lang"] }.compact
1352
+ 'rights' => hsh['__content__'] || hsh['rights'],
1353
+ 'rightsUri' => hsh['rightsURI'] || hsh['rightsUri'],
1354
+ 'rightsIdentifier' => hsh['rightsIdentifier'].present? ? hsh['rightsIdentifier'].downcase : nil,
1355
+ 'rightsIdentifierScheme' => hsh['rightsIdentifierScheme'],
1356
+ 'schemeUri' => hsh['schemeUri'],
1357
+ 'lang' => hsh['lang']
1358
+ }.compact
1298
1359
  end
1299
1360
  end
1300
1361
 
1301
1362
  def name_to_fos(name)
1302
1363
  # first find subject in Fields of Science (OECD)
1303
- fos = JSON.load(File.read(File.expand_path('../../../resources/oecd/fos-mappings.json', __FILE__))).fetch("fosFields")
1364
+ fos = JSON.load(File.read(File.expand_path('../../resources/oecd/fos-mappings.json',
1365
+ __dir__))).fetch('fosFields')
1304
1366
 
1305
- subject = fos.find { |l| l["fosLabel"] == name || "FOS: " + l["fosLabel"] == name }
1367
+ subject = fos.find { |l| l['fosLabel'] == name || 'FOS: ' + l['fosLabel'] == name }
1306
1368
 
1307
1369
  if subject
1308
1370
  return [{
1309
- "subject" => sanitize(name).downcase
1371
+ 'subject' => sanitize(name).downcase
1310
1372
  },
1311
- {
1312
- "subject" => "FOS: " + subject["fosLabel"],
1313
- "subjectScheme" => "Fields of Science and Technology (FOS)",
1314
- "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf"
1315
- }]
1373
+ {
1374
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1375
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1376
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1377
+ }]
1316
1378
  end
1317
1379
 
1318
1380
  # if not found, look in Fields of Research (Australian and New Zealand Standard Research Classification)
1319
1381
  # and map to Fields of Science. Add an extra entry for the latter
1320
- fores = JSON.load(File.read(File.expand_path('../../../resources/oecd/for-mappings.json', __FILE__)))
1321
- for_fields = fores.fetch("forFields")
1322
- for_disciplines = fores.fetch("forDisciplines")
1382
+ fores = JSON.load(File.read(File.expand_path('../../resources/oecd/for-mappings.json',
1383
+ __dir__)))
1384
+ for_fields = fores.fetch('forFields')
1385
+ for_disciplines = fores.fetch('forDisciplines')
1323
1386
 
1324
- subject = for_fields.find { |l| l["forLabel"] == name } ||
1325
- for_disciplines.find { |l| l["forLabel"] == name }
1387
+ subject = for_fields.find { |l| l['forLabel'] == name } ||
1388
+ for_disciplines.find { |l| l['forLabel'] == name }
1326
1389
 
1327
1390
  if subject
1328
1391
  [{
1329
- "subject" => sanitize(name).downcase
1392
+ 'subject' => sanitize(name).downcase
1330
1393
  },
1331
- {
1332
- "subject" => "FOS: " + subject["fosLabel"],
1333
- "subjectScheme" => "Fields of Science and Technology (FOS)",
1334
- "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf"
1335
- }]
1394
+ {
1395
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1396
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1397
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1398
+ }]
1336
1399
  else
1337
- [{ "subject" => sanitize(name).downcase }]
1400
+ [{ 'subject' => sanitize(name).downcase }]
1338
1401
  end
1339
1402
  end
1340
1403
 
1341
1404
  def hsh_to_fos(hsh)
1342
1405
  # first find subject in Fields of Science (OECD)
1343
- fos = JSON.load(File.read(File.expand_path('../../../resources/oecd/fos-mappings.json', __FILE__))).fetch("fosFields")
1344
- subject = fos.find { |l| l["fosLabel"] == hsh["__content__"] || "FOS: " + l["fosLabel"] == hsh["__content__"] || l["fosLabel"] == hsh["subject"]}
1406
+ fos = JSON.load(File.read(File.expand_path('../../resources/oecd/fos-mappings.json',
1407
+ __dir__))).fetch('fosFields')
1408
+ subject = fos.find do |l|
1409
+ l['fosLabel'] == hsh['__content__'] || 'FOS: ' + l['fosLabel'] == hsh['__content__'] || l['fosLabel'] == hsh['subject']
1410
+ end
1345
1411
 
1346
1412
  if subject
1347
1413
  return [{
1348
- "subject" => sanitize(hsh["__content__"] || hsh["subject"]),
1349
- "subjectScheme" => hsh["subjectScheme"],
1350
- "schemeUri" => hsh["schemeURI"] || hsh["schemeUri"],
1351
- "valueUri" => hsh["valueURI"] || hsh["valueUri"],
1352
- "classificationCode" => hsh["classificationCode"],
1353
- "lang" => hsh["lang"] }.compact,
1354
- {
1355
- "subject" => "FOS: " + subject["fosLabel"],
1356
- "subjectScheme" => "Fields of Science and Technology (FOS)",
1357
- "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf" }.compact]
1414
+ 'subject' => sanitize(hsh['__content__'] || hsh['subject']),
1415
+ 'subjectScheme' => hsh['subjectScheme'],
1416
+ 'schemeUri' => hsh['schemeURI'] || hsh['schemeUri'],
1417
+ 'valueUri' => hsh['valueURI'] || hsh['valueUri'],
1418
+ 'classificationCode' => hsh['classificationCode'],
1419
+ 'lang' => hsh['lang']
1420
+ }.compact,
1421
+ {
1422
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1423
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1424
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1425
+ }.compact]
1358
1426
  end
1359
1427
 
1360
1428
  # if not found, look in Fields of Research (Australian and New Zealand Standard Research Classification)
1361
1429
  # and map to Fields of Science. Add an extra entry for the latter
1362
- fores = JSON.load(File.read(File.expand_path('../../../resources/oecd/for-mappings.json', __FILE__)))
1363
- for_fields = fores.fetch("forFields")
1364
- for_disciplines = fores.fetch("forDisciplines")
1430
+ fores = JSON.load(File.read(File.expand_path('../../resources/oecd/for-mappings.json',
1431
+ __dir__)))
1432
+ for_fields = fores.fetch('forFields')
1433
+ for_disciplines = fores.fetch('forDisciplines')
1365
1434
 
1366
1435
  # try to extract forId
1367
- if hsh["subjectScheme"] == "FOR"
1368
- for_id = hsh["__content__"].to_s.split(" ").first || hsh["subject"].to_s.split(" ").first
1369
- for_id = for_id.rjust(6, "0")
1436
+ if hsh['subjectScheme'] == 'FOR'
1437
+ for_id = hsh['__content__'].to_s.split(' ').first || hsh['subject'].to_s.split(' ').first
1438
+ for_id = for_id.rjust(6, '0')
1370
1439
 
1371
- subject = for_fields.find { |l| l["forId"] == for_id } ||
1372
- for_disciplines.find { |l| l["forId"] == for_id[0..3] }
1440
+ subject = for_fields.find { |l| l['forId'] == for_id } ||
1441
+ for_disciplines.find { |l| l['forId'] == for_id[0..3] }
1373
1442
  else
1374
- subject = for_fields.find { |l| l["forLabel"] == hsh["__content__"] || l["forLabel"] == hsh["subject"] } ||
1375
- for_disciplines.find { |l| l["forLabel"] == hsh["__content__"] || l["forLabel"] == hsh["subject"] }
1443
+ subject = for_fields.find do |l|
1444
+ l['forLabel'] == hsh['__content__'] || l['forLabel'] == hsh['subject']
1445
+ end ||
1446
+ for_disciplines.find do |l|
1447
+ l['forLabel'] == hsh['__content__'] || l['forLabel'] == hsh['subject']
1448
+ end
1376
1449
  end
1377
1450
 
1378
1451
  if subject
1379
1452
  [{
1380
- "subject" => sanitize(hsh["__content__"] || hsh["subject"]),
1381
- "subjectScheme" => hsh["subjectScheme"],
1382
- "classificationCode" => hsh["classificationCode"],
1383
- "schemeUri" => hsh["schemeURI"] || hsh["schemeUri"],
1384
- "valueUri" => hsh["valueURI"] || hsh["valueUri"],
1385
- "lang" => hsh["lang"] }.compact,
1386
- {
1387
- "subject" => "FOS: " + subject["fosLabel"],
1388
- "subjectScheme" => "Fields of Science and Technology (FOS)",
1389
- "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf"
1390
- }]
1453
+ 'subject' => sanitize(hsh['__content__'] || hsh['subject']),
1454
+ 'subjectScheme' => hsh['subjectScheme'],
1455
+ 'classificationCode' => hsh['classificationCode'],
1456
+ 'schemeUri' => hsh['schemeURI'] || hsh['schemeUri'],
1457
+ 'valueUri' => hsh['valueURI'] || hsh['valueUri'],
1458
+ 'lang' => hsh['lang']
1459
+ }.compact,
1460
+ {
1461
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1462
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1463
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1464
+ }]
1391
1465
  else
1392
1466
  [{
1393
- "subject" => sanitize(hsh["__content__"] || hsh["subject"]),
1394
- "subjectScheme" => hsh["subjectScheme"],
1395
- "classificationCode" => hsh["classificationCode"],
1396
- "schemeUri" => hsh["schemeURI"] || hsh["schemeUri"],
1397
- "valueUri" => hsh["valueURI"] || hsh["valueUri"],
1398
- "lang" => hsh["lang"] }.compact]
1467
+ 'subject' => sanitize(hsh['__content__'] || hsh['subject']),
1468
+ 'subjectScheme' => hsh['subjectScheme'],
1469
+ 'classificationCode' => hsh['classificationCode'],
1470
+ 'schemeUri' => hsh['schemeURI'] || hsh['schemeUri'],
1471
+ 'valueUri' => hsh['valueURI'] || hsh['valueUri'],
1472
+ 'lang' => hsh['lang']
1473
+ }.compact]
1399
1474
  end
1400
1475
  end
1401
1476
 
1402
1477
  def encode_doi(prefix)
1403
- random_int = SecureRandom.random_number(2**63..2**64-1)
1478
+ random_int = SecureRandom.random_number(2**63..(2**64) - 1)
1404
1479
  suffix = Base32::URL.encode(random_int)
1405
- str = "#{suffix[0,7]}-#{suffix[6,7]}"
1480
+ str = "#{suffix[0, 7]}-#{suffix[6, 7]}"
1406
1481
  "https://doi.org/#{prefix}/#{str}"
1407
1482
  end
1408
1483