commonmeta-ruby 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (791) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/build.yml +38 -0
  3. data/.github/workflows/changelog.yml +36 -0
  4. data/.github/workflows/codeql-analysis.yml +72 -0
  5. data/.github/workflows/rubocop.yml +50 -0
  6. data/.gitignore +59 -0
  7. data/.rubocop.yml +182 -0
  8. data/.rubocop_todo.yml +76 -0
  9. data/.tool-versions +1 -0
  10. data/CHANGELOG.md +124 -0
  11. data/CITATION +16 -0
  12. data/CITATION.cff +20 -0
  13. data/Gemfile +5 -0
  14. data/Gemfile.lock +270 -0
  15. data/LICENSE.md +21 -0
  16. data/README.md +733 -0
  17. data/Rakefile +13 -0
  18. data/bin/commonmeta +9 -0
  19. data/commonmeta.gemspec +68 -0
  20. data/lib/commonmeta/array.rb +13 -0
  21. data/lib/commonmeta/author_utils.rb +172 -0
  22. data/lib/commonmeta/cli.rb +70 -0
  23. data/lib/commonmeta/crossref_utils.rb +343 -0
  24. data/lib/commonmeta/doi_utils.rb +81 -0
  25. data/lib/commonmeta/metadata.rb +269 -0
  26. data/lib/commonmeta/metadata_utils.rb +184 -0
  27. data/lib/commonmeta/pubmed.rb +36 -0
  28. data/lib/commonmeta/readers/bibtex_reader.rb +62 -0
  29. data/lib/commonmeta/readers/cff_reader.rb +146 -0
  30. data/lib/commonmeta/readers/codemeta_reader.rb +90 -0
  31. data/lib/commonmeta/readers/crossref_reader.rb +186 -0
  32. data/lib/commonmeta/readers/crossref_xml_reader.rb +379 -0
  33. data/lib/commonmeta/readers/csl_reader.rb +85 -0
  34. data/lib/commonmeta/readers/datacite_reader.rb +169 -0
  35. data/lib/commonmeta/readers/npm_reader.rb +94 -0
  36. data/lib/commonmeta/readers/ris_reader.rb +66 -0
  37. data/lib/commonmeta/readers/schema_org_reader.rb +300 -0
  38. data/lib/commonmeta/schema_utils.rb +19 -0
  39. data/lib/commonmeta/string.rb +7 -0
  40. data/lib/commonmeta/utils.rb +1351 -0
  41. data/lib/commonmeta/version.rb +5 -0
  42. data/lib/commonmeta/whitelist_scrubber.rb +54 -0
  43. data/lib/commonmeta/writers/bibtex_writer.rb +36 -0
  44. data/lib/commonmeta/writers/cff_writer.rb +63 -0
  45. data/lib/commonmeta/writers/citation_writer.rb +14 -0
  46. data/lib/commonmeta/writers/codemeta_writer.rb +33 -0
  47. data/lib/commonmeta/writers/crossref_xml_writer.rb +11 -0
  48. data/lib/commonmeta/writers/csl_writer.rb +11 -0
  49. data/lib/commonmeta/writers/csv_writer.rb +26 -0
  50. data/lib/commonmeta/writers/datacite_writer.rb +94 -0
  51. data/lib/commonmeta/writers/jats_writer.rb +138 -0
  52. data/lib/commonmeta/writers/rdf_xml_writer.rb +11 -0
  53. data/lib/commonmeta/writers/ris_writer.rb +41 -0
  54. data/lib/commonmeta/writers/schema_org_writer.rb +61 -0
  55. data/lib/commonmeta/writers/turtle_writer.rb +11 -0
  56. data/lib/commonmeta/xml_converter.rb +14 -0
  57. data/lib/commonmeta.rb +35 -0
  58. data/resources/2008/09/xsd.xsl +997 -0
  59. data/resources/cff.json +1827 -0
  60. data/resources/commonmeta_v0.9.json +393 -0
  61. data/resources/crossref/AccessIndicators.xsd +47 -0
  62. data/resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd +10130 -0
  63. data/resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd +48 -0
  64. data/resources/crossref/JATS-journalpublishing1-elements.xsd +8705 -0
  65. data/resources/crossref/JATS-journalpublishing1-mathml3-elements.xsd +8608 -0
  66. data/resources/crossref/JATS-journalpublishing1-mathml3.xsd +49 -0
  67. data/resources/crossref/JATS-journalpublishing1.xsd +6176 -0
  68. data/resources/crossref/clinicaltrials.xsd +61 -0
  69. data/resources/crossref/common5.3.1.xsd +1530 -0
  70. data/resources/crossref/crossref5.3.1.xsd +1949 -0
  71. data/resources/crossref/crossref_query_output3.0.xsd +1097 -0
  72. data/resources/crossref/fundref.xsd +49 -0
  73. data/resources/crossref/module-ali.xsd +39 -0
  74. data/resources/crossref/relations.xsd +444 -0
  75. data/resources/datacite-contributorType-v4.xsd +35 -0
  76. data/resources/datacite-dateType-v4.xsd +25 -0
  77. data/resources/datacite-descriptionType-v4.xsd +19 -0
  78. data/resources/datacite-funderIdentifierType-v4.xsd +15 -0
  79. data/resources/datacite-nameType-v4.xsd +10 -0
  80. data/resources/datacite-relatedIdentifierType-v4.xsd +34 -0
  81. data/resources/datacite-relationType-v4.xsd +49 -0
  82. data/resources/datacite-resourceType-v4.xsd +28 -0
  83. data/resources/datacite-titleType-v4.xsd +14 -0
  84. data/resources/datacite-v3.json +508 -0
  85. data/resources/datacite-v4.json +512 -0
  86. data/resources/kernel-3.0/include/datacite-contributorType-v3.xsd +33 -0
  87. data/resources/kernel-3.0/include/datacite-dateType-v3.xsd +21 -0
  88. data/resources/kernel-3.0/include/datacite-descriptionType-v3.xsd +17 -0
  89. data/resources/kernel-3.0/include/datacite-relatedIdentifierType-v3.xsd +27 -0
  90. data/resources/kernel-3.0/include/datacite-relationType-v3.xsd +33 -0
  91. data/resources/kernel-3.0/include/datacite-resourceType-v3.xsd +26 -0
  92. data/resources/kernel-3.0/include/datacite-titleType-v3.xsd +12 -0
  93. data/resources/kernel-3.0/include/xml.xsd +286 -0
  94. data/resources/kernel-3.0/metadata.xsd +377 -0
  95. data/resources/kernel-4/include/datacite-contributorType-v4.xsd +35 -0
  96. data/resources/kernel-4/include/datacite-dateType-v4.xsd +25 -0
  97. data/resources/kernel-4/include/datacite-descriptionType-v4.xsd +19 -0
  98. data/resources/kernel-4/include/datacite-funderIdentifierType-v4.xsd +16 -0
  99. data/resources/kernel-4/include/datacite-nameType-v4.xsd +10 -0
  100. data/resources/kernel-4/include/datacite-numberType-v4.xsd +12 -0
  101. data/resources/kernel-4/include/datacite-relatedIdentifierType-v4.xsd +34 -0
  102. data/resources/kernel-4/include/datacite-relationType-v4.xsd +51 -0
  103. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +43 -0
  104. data/resources/kernel-4/include/datacite-titleType-v4.xsd +14 -0
  105. data/resources/kernel-4/include/xml.xsd +286 -0
  106. data/resources/kernel-4/metadata.xsd +707 -0
  107. data/resources/oecd/dfg-mappings.json +1866 -0
  108. data/resources/oecd/for-mappings.json +1099 -0
  109. data/resources/oecd/fos-mappings.json +198 -0
  110. data/resources/schema_org/jsonldcontext.json +7477 -0
  111. data/resources/spdx/licenses.json +5297 -0
  112. data/resources/xml.xsd +286 -0
  113. data/rubocop.sarif +0 -0
  114. data/sonar-project.properties +11 -0
  115. data/spec/array_spec.rb +22 -0
  116. data/spec/author_utils_spec.rb +132 -0
  117. data/spec/cli_spec.rb +309 -0
  118. data/spec/doi_utils_spec.rb +318 -0
  119. data/spec/find_from_format_spec.rb +144 -0
  120. data/spec/fixtures/CITATION.cff +83 -0
  121. data/spec/fixtures/aida.json +82 -0
  122. data/spec/fixtures/cgimp_package.json +18 -0
  123. data/spec/fixtures/cit_package.json +19 -0
  124. data/spec/fixtures/citeproc-no-author.json +26 -0
  125. data/spec/fixtures/citeproc-no-categories.json +21 -0
  126. data/spec/fixtures/citeproc.json +30 -0
  127. data/spec/fixtures/codemeta.json +86 -0
  128. data/spec/fixtures/codemeta_v2.json +86 -0
  129. data/spec/fixtures/crosscite.json +63 -0
  130. data/spec/fixtures/crossref.bib +14 -0
  131. data/spec/fixtures/crossref.json +572 -0
  132. data/spec/fixtures/crossref.ris +15 -0
  133. data/spec/fixtures/crossref.xml +606 -0
  134. data/spec/fixtures/datacite.json +86 -0
  135. data/spec/fixtures/datacite_software.json +21 -0
  136. data/spec/fixtures/datacite_software_missing_comma.json +18 -0
  137. data/spec/fixtures/datacite_software_overlapping_keys.json +18 -0
  138. data/spec/fixtures/datacite_software_version.json +74 -0
  139. data/spec/fixtures/edam_package.json +12 -0
  140. data/spec/fixtures/maremma/codemeta.json +36 -0
  141. data/spec/fixtures/pure.bib +14 -0
  142. data/spec/fixtures/pure.ris +15 -0
  143. data/spec/fixtures/pure.xml +188 -0
  144. data/spec/fixtures/ris_bug.ris +9 -0
  145. data/spec/fixtures/schema_4.0.xml +140 -0
  146. data/spec/fixtures/schema_org.json +49 -0
  147. data/spec/fixtures/schema_org_front-matter.json +32 -0
  148. data/spec/fixtures/schema_org_geolocation.json +82 -0
  149. data/spec/fixtures/schema_org_geoshape.json +550 -0
  150. data/spec/fixtures/schema_org_gtex.json +75 -0
  151. data/spec/fixtures/schema_org_list.json +12623 -0
  152. data/spec/fixtures/schema_org_tdl_iodp_invalid_authors.json +25 -0
  153. data/spec/fixtures/schema_org_topmed.json +53 -0
  154. data/spec/fixtures/schema_org_type_as_array.json +41 -0
  155. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref/default.yml +110 -0
  156. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref/to_bibtex.yml +110 -0
  157. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref/to_crossref_xml.yml +110 -0
  158. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref/to_datacite.yml +110 -0
  159. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref/to_schema_org.yml +110 -0
  160. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref_xml/default.yml +55 -0
  161. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref_xml/to_bibtex.yml +55 -0
  162. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref_xml/to_crossref_xml.yml +55 -0
  163. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref_xml/to_datacite.yml +55 -0
  164. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_file/crossref_xml/to_schema_org.yml +55 -0
  165. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/default.yml +299 -0
  166. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_bibtex.yml +299 -0
  167. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_citation.yml +299 -0
  168. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_crossref_xml.yml +299 -0
  169. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_datacite.yml +299 -0
  170. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_jats.yml +299 -0
  171. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/crossref/to_schema_org.yml +299 -0
  172. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/default.yml +172 -0
  173. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_bibtex.yml +172 -0
  174. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_citation.yml +172 -0
  175. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_datacite.yml +172 -0
  176. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_jats.yml +172 -0
  177. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/datacite/to_schema_org.yml +172 -0
  178. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/schema_org/default.yml +1098 -0
  179. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/schema_org/to_datacite.yml +1098 -0
  180. data/spec/fixtures/vcr_cassettes/Briard_CLI/convert_from_id/schema_org/to_schema_org.yml +1100 -0
  181. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/crossref.yml +55 -0
  182. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/datacite.yml +55 -0
  183. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/jalc.yml +55 -0
  184. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/kisti.yml +55 -0
  185. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/medra.yml +55 -0
  186. data/spec/fixtures/vcr_cassettes/Briard_CLI/find_from_format_by_id/op.yml +55 -0
  187. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/author.yml +164 -0
  188. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/no_author.yml +164 -0
  189. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/single_author.yml +164 -0
  190. data/spec/fixtures/vcr_cassettes/Briard_Metadata/authors_as_string/with_organization.yml +164 -0
  191. data/spec/fixtures/vcr_cassettes/Briard_Metadata/change_metadata_as_datacite_xml/with_data_citation.yml +247 -0
  192. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/crossref.yml +55 -0
  193. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/datacite.yml +55 -0
  194. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/jalc.yml +55 -0
  195. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/kisti.yml +55 -0
  196. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/medra.yml +55 -0
  197. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/not_found.yml +55 -0
  198. data/spec/fixtures/vcr_cassettes/Briard_Metadata/doi_registration_agency/op.yml +55 -0
  199. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/crossref.yml +55 -0
  200. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +55 -0
  201. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/datacite.yml +55 -0
  202. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/datacite_doi_http.yml +55 -0
  203. data/spec/fixtures/vcr_cassettes/Briard_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml +55 -0
  204. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_for_match.yml +221 -0
  205. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_for_with_schemeUri_in_hash.yml +221 -0
  206. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_match.yml +221 -0
  207. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/hsh_to_fos_no_match.yml +221 -0
  208. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/name_to_fos_for_match.yml +221 -0
  209. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/name_to_fos_match.yml +221 -0
  210. data/spec/fixtures/vcr_cassettes/Briard_Metadata/fos/name_to_fos_no_match.yml +221 -0
  211. data/spec/fixtures/vcr_cassettes/Briard_Metadata/from_schema_org/with_id.yml +221 -0
  212. data/spec/fixtures/vcr_cassettes/Briard_Metadata/from_schema_org_creators/with_affiliation.yml +221 -0
  213. data/spec/fixtures/vcr_cassettes/Briard_Metadata/from_schema_org_creators/without_affiliation.yml +221 -0
  214. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/cff-converter-python.yml +200 -0
  215. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff.yml +154 -0
  216. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff_repository_url.yml +154 -0
  217. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/maremma.yml +86 -0
  218. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/metadata_reports.yml +93 -0
  219. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/DOI_with_ORCID_ID.yml +337 -0
  220. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/DOI_with_SICI_DOI.yml +347 -0
  221. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/DOI_with_data_citation.yml +359 -0
  222. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/JaLC.yml +384 -0
  223. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/KISTI.yml +330 -0
  224. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/OP.yml +969 -0
  225. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/affiliation_is_space.yml +358 -0
  226. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/another_book.yml +312 -0
  227. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/another_book_chapter.yml +465 -0
  228. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/article_id_as_page_number.yml +276 -0
  229. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/author_literal.yml +492 -0
  230. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book.yml +523 -0
  231. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book_chapter.yml +377 -0
  232. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book_chapter_with_RDF_for_container.yml +336 -0
  233. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/book_oup.yml +289 -0
  234. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/component.yml +289 -0
  235. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/dataset.yml +299 -0
  236. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/dataset_usda.yml +341 -0
  237. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/date_in_future.yml +570 -0
  238. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/dissertation.yml +301 -0
  239. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/empty_given_name.yml +303 -0
  240. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/invalid_date.yml +307 -0
  241. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article.yml +461 -0
  242. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_original_language_title.yml +276 -0
  243. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_with.yml +470 -0
  244. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_with_RDF_for_container.yml +519 -0
  245. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_article_with_funding.yml +456 -0
  246. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/journal_issue.yml +270 -0
  247. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/mEDRA.yml +310 -0
  248. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/markup.yml +329 -0
  249. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/missing_creator.yml +307 -0
  250. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/multiple_issn.yml +393 -0
  251. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/multiple_titles.yml +265 -0
  252. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/multiple_titles_with_missing.yml +860 -0
  253. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/not_found_error.yml +209 -0
  254. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/peer_review.yml +287 -0
  255. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/posted_content.yml +326 -0
  256. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/posted_content_copernicus.yml +297 -0
  257. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/report_osti.yml +315 -0
  258. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/vor_with_url.yml +451 -0
  259. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/yet_another_book.yml +816 -0
  260. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_metadata/yet_another_book_chapter.yml +324 -0
  261. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_crossref_raw/journal_article.yml +110 -0
  262. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/dissertation.yml +152 -0
  263. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/funding_references.yml +175 -0
  264. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datacite_metadata/subject_scheme.yml +328 -0
  265. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date/publication_date.yml +221 -0
  266. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_date_parts/date.yml +221 -0
  267. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_date_parts/year-month.yml +221 -0
  268. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_date_parts/year.yml +221 -0
  269. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_parts/date.yml +221 -0
  270. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_parts/year-month.yml +221 -0
  271. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_from_parts/year.yml +221 -0
  272. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_parts/date.yml +221 -0
  273. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_parts/year-month.yml +221 -0
  274. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_date_parts/year.yml +221 -0
  275. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/future.yml +221 -0
  276. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/invalid.yml +221 -0
  277. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/nil.yml +221 -0
  278. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/past.yml +221 -0
  279. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_datetime_from_time/present.yml +221 -0
  280. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_familyName.yml +133 -0
  281. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml +153 -0
  282. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/is_organization.yml +164 -0
  283. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/name_with_affiliation_crossref.yml +247 -0
  284. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_one_author/only_familyName_and_givenName.yml +468 -0
  285. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/BlogPosting.yml +530 -0
  286. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/BlogPosting_with_new_DOI.yml +530 -0
  287. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/get_schema_org_metadata_front_matter/BlogPosting.yml +534 -0
  288. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/harvard_dataverse.yml +1838 -0
  289. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/pangaea.yml +468 -0
  290. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/upstream_blog.yml +885 -0
  291. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_schema_org_metadata/zenodo.yml +583 -0
  292. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/only_title.yml +221 -0
  293. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/title_and_pages.yml +221 -0
  294. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/title_volume_and_pages.yml +221 -0
  295. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_series_information/title_volume_issue_and_pages.yml +221 -0
  296. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_as_cff_url.yml +221 -0
  297. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_as_codemeta_url.yml +221 -0
  298. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url.yml +221 -0
  299. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url_cff_file.yml +221 -0
  300. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url_file.yml +221 -0
  301. data/spec/fixtures/vcr_cassettes/Briard_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml +55 -0
  302. data/spec/fixtures/vcr_cassettes/Briard_Metadata/handle_input/unknown_DOI_prefix.yml +55 -0
  303. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_comma.yml +164 -0
  304. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_family_name.yml +164 -0
  305. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_id.yml +164 -0
  306. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_known_given_name.yml +164 -0
  307. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_no_info.yml +164 -0
  308. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_orcid_id.yml +164 -0
  309. data/spec/fixtures/vcr_cassettes/Briard_Metadata/is_personal_name_/has_type_organization.yml +164 -0
  310. data/spec/fixtures/vcr_cassettes/Briard_Metadata/json_schema_errors/is_valid.yml +221 -0
  311. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_cc_url/not_found.yml +221 -0
  312. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_cc_url/with_trailing_slash.yml +221 -0
  313. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_cc_url/with_trailing_slash_and_to_https.yml +221 -0
  314. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/doi.yml +221 -0
  315. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/doi_as_url.yml +221 -0
  316. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/filename.yml +221 -0
  317. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/ftp.yml +221 -0
  318. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/invalid_url.yml +221 -0
  319. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/sandbox_via_options.yml +221 -0
  320. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/sandbox_via_url.yml +221 -0
  321. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/string.yml +221 -0
  322. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/url.yml +221 -0
  323. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_id/url_with_utf-8.yml +221 -0
  324. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_ids/doi.yml +221 -0
  325. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_ids/url.yml +221 -0
  326. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_array.yml +221 -0
  327. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_empty_array.yml +221 -0
  328. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_hash.yml +221 -0
  329. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_issn/from_string.yml +221 -0
  330. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_url/uri.yml +221 -0
  331. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_url/with_trailing_slash.yml +221 -0
  332. data/spec/fixtures/vcr_cassettes/Briard_Metadata/normalize_url/with_trailing_slash_and_to_https.yml +221 -0
  333. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/array.yml +221 -0
  334. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/array_of_strings.yml +221 -0
  335. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/first.yml +221 -0
  336. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/hash.yml +221 -0
  337. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/hash_with_array_value.yml +221 -0
  338. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/nil.yml +221 -0
  339. data/spec/fixtures/vcr_cassettes/Briard_Metadata/parse_attributes/string.yml +221 -0
  340. data/spec/fixtures/vcr_cassettes/Briard_Metadata/random_doi/decode_anothe_doi.yml +221 -0
  341. data/spec/fixtures/vcr_cassettes/Briard_Metadata/random_doi/decode_doi.yml +221 -0
  342. data/spec/fixtures/vcr_cassettes/Briard_Metadata/random_doi/encode_doi.yml +221 -0
  343. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +221 -0
  344. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +221 -0
  345. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/hsh_to_spdx_id.yml +221 -0
  346. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/hsh_to_spdx_not_found.yml +221 -0
  347. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/hsh_to_spdx_url.yml +221 -0
  348. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/name_to_spdx_exists.yml +221 -0
  349. data/spec/fixtures/vcr_cassettes/Briard_Metadata/spdx/name_to_spdx_id.yml +221 -0
  350. data/spec/fixtures/vcr_cassettes/Briard_Metadata/to_schema_org/with_id.yml +221 -0
  351. data/spec/fixtures/vcr_cassettes/Briard_Metadata/to_schema_org_identifiers/with_identifiers.yml +221 -0
  352. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid.yml +221 -0
  353. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_https.yml +221 -0
  354. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_id.yml +221 -0
  355. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_sandbox.yml +221 -0
  356. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_sandbox_https.yml +221 -0
  357. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_with_spaces.yml +221 -0
  358. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_wrong_id.yml +221 -0
  359. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid/validate_orcid_www.yml +221 -0
  360. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme.yml +221 -0
  361. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme_https.yml +221 -0
  362. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme_trailing_slash.yml +221 -0
  363. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_orcid_scheme/validate_orcid_scheme_www.yml +221 -0
  364. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/DOI.yml +221 -0
  365. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/ISSN.yml +221 -0
  366. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/URL.yml +221 -0
  367. data/spec/fixtures/vcr_cassettes/Briard_Metadata/validate_url/string.yml +221 -0
  368. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/BlogPosting.yml +81 -0
  369. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/Dataset.yml +120 -0
  370. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/authors_with_affiliations.yml +186 -0
  371. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/climate_data.yml +74 -0
  372. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/from_schema_org.yml +530 -0
  373. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/keywords_subject_scheme.yml +149 -0
  374. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/maremma.yml +86 -0
  375. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/text.yml +100 -0
  376. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/with_data_citation.yml +247 -0
  377. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_bibtex/with_pages.yml +228 -0
  378. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/Collection_of_Jupyter_notebooks.yml +143 -0
  379. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_Zenodo.yml +150 -0
  380. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_also_Zenodo.yml +93 -0
  381. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/ruby-cff.yml +154 -0
  382. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Dataset.yml +120 -0
  383. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Journal_article.yml +247 -0
  384. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Journal_article_vancouver_style.yml +299 -0
  385. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/Missing_author.yml +199 -0
  386. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/interactive_resource_without_dates.yml +75 -0
  387. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_citation/software_w/version.yml +86 -0
  388. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml +76 -0
  389. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite_check_codemeta_v2.yml +76 -0
  390. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml +541 -0
  391. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/journal_article.yml +55 -0
  392. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml +85 -0
  393. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/posted_content.yml +283 -0
  394. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/schema_org_from_another_science_blog.yml +123 -0
  395. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/schema_org_from_front_matter.yml +477 -0
  396. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_crossref/schema_org_from_upstream_blog.yml +1025 -0
  397. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/Another_dataset.yml +110 -0
  398. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/BlogPosting.yml +81 -0
  399. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/BlogPosting_schema_org.yml +530 -0
  400. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/Dataset.yml +120 -0
  401. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/container_title.yml +153 -0
  402. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/interactive_resource_without_dates.yml +75 -0
  403. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/journal_article.yml +247 -0
  404. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/keywords_subject_scheme.yml +149 -0
  405. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/maremma.yml +86 -0
  406. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/missing_creator.yml +199 -0
  407. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/multiple_abstracts.yml +101 -0
  408. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/organization_author.yml +314 -0
  409. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/software.yml +90 -0
  410. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/software_w/version.yml +86 -0
  411. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/with_only_first_page.yml +333 -0
  412. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csl/with_pages.yml +228 -0
  413. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/climate_data.yml +74 -0
  414. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/maremma.yml +86 -0
  415. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/text.yml +100 -0
  416. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/with_data_citation.yml +247 -0
  417. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_csv/with_pages.yml +228 -0
  418. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite/from_schema_org.yml +530 -0
  419. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite/maremma.yml +86 -0
  420. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite/with_ORCID_ID.yml +228 -0
  421. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite/with_data_citation.yml +247 -0
  422. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/from_schema_org.yml +530 -0
  423. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/maremma.yml +86 -0
  424. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/with_ORCID_ID.yml +228 -0
  425. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_datacite_json/with_data_citation.yml +247 -0
  426. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/Dataset_in_schema_4_0.yml +120 -0
  427. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/Text_pass-thru.yml +106 -0
  428. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/book_chapter.yml +163 -0
  429. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/from_schema_org.yml +530 -0
  430. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/interactive_resource_without_dates.yml +75 -0
  431. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/maremma.yml +86 -0
  432. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_ORCID_ID.yml +228 -0
  433. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_data_citation.yml +247 -0
  434. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_jats_xml/with_editor.yml +355 -0
  435. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/BlogPosting.yml +81 -0
  436. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/BlogPosting_schema_org.yml +530 -0
  437. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/journal_article.yml +247 -0
  438. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/maremma.yml +86 -0
  439. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_rdf_xml/with_pages.yml +228 -0
  440. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/BlogPosting.yml +81 -0
  441. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/BlogPosting_schema_org.yml +530 -0
  442. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/Dataset.yml +120 -0
  443. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/alternate_name.yml +138 -0
  444. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/journal_article.yml +115 -0
  445. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/keywords_with_subject_scheme.yml +149 -0
  446. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/maremma.yml +86 -0
  447. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_ris/with_pages.yml +112 -0
  448. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Another_Schema_org_JSON.yml +120 -0
  449. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Funding.yml +192 -0
  450. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Funding_OpenAIRE.yml +150 -0
  451. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON.yml +98 -0
  452. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON_Cyark.yml +160 -0
  453. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/Schema_org_JSON_IsSupplementTo.yml +153 -0
  454. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/alternate_identifiers.yml +131 -0
  455. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/data_catalog.yml +136 -0
  456. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/geo_location_box.yml +181 -0
  457. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/interactive_resource_without_dates.yml +127 -0
  458. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/journal_article.yml +247 -0
  459. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/maremma_schema_org_JSON.yml +86 -0
  460. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/series_information.yml +174 -0
  461. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/subject_scheme.yml +199 -0
  462. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_schema_org/subject_scheme_multiple_keywords.yml +201 -0
  463. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/BlogPosting.yml +81 -0
  464. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/BlogPosting_schema_org.yml +530 -0
  465. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/Dataset.yml +120 -0
  466. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/journal_article.yml +247 -0
  467. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_turtle/with_pages.yml +228 -0
  468. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref/default.yml +110 -0
  469. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref/to_bibtex.yml +110 -0
  470. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref/to_crossref_xml.yml +110 -0
  471. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref/to_datacite.yml +110 -0
  472. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref/to_schema_org.yml +110 -0
  473. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref_xml/default.yml +55 -0
  474. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref_xml/to_bibtex.yml +55 -0
  475. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref_xml/to_crossref_xml.yml +55 -0
  476. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref_xml/to_datacite.yml +55 -0
  477. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_file/crossref_xml/to_schema_org.yml +55 -0
  478. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/default.yml +299 -0
  479. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/to_bibtex.yml +299 -0
  480. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/to_citation.yml +299 -0
  481. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/to_crossref_xml.yml +299 -0
  482. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/to_datacite.yml +299 -0
  483. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/to_jats.yml +299 -0
  484. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/crossref/to_schema_org.yml +299 -0
  485. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/datacite/default.yml +172 -0
  486. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/datacite/to_bibtex.yml +172 -0
  487. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/datacite/to_citation.yml +172 -0
  488. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/datacite/to_datacite.yml +172 -0
  489. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/datacite/to_jats.yml +172 -0
  490. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/datacite/to_schema_org.yml +172 -0
  491. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/default.yml +1096 -0
  492. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_datacite.yml +1096 -0
  493. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/convert_from_id/schema_org/to_schema_org.yml +1098 -0
  494. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/crossref.yml +55 -0
  495. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/datacite.yml +55 -0
  496. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/jalc.yml +55 -0
  497. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/kisti.yml +55 -0
  498. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/medra.yml +55 -0
  499. data/spec/fixtures/vcr_cassettes/Commonmeta_CLI/find_from_format_by_id/op.yml +55 -0
  500. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/change_metadata_as_datacite_xml/with_data_citation.yml +247 -0
  501. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/crossref.yml +55 -0
  502. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/datacite.yml +55 -0
  503. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/jalc.yml +55 -0
  504. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/kisti.yml +55 -0
  505. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/medra.yml +55 -0
  506. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/not_found.yml +55 -0
  507. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/doi_registration_agency/op.yml +55 -0
  508. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/crossref.yml +55 -0
  509. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +55 -0
  510. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/datacite.yml +55 -0
  511. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/datacite_doi_http.yml +55 -0
  512. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml +55 -0
  513. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/hsh_to_fos_for_match.yml +221 -0
  514. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/hsh_to_fos_for_with_schemeUri_in_hash.yml +221 -0
  515. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/hsh_to_fos_match.yml +221 -0
  516. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/hsh_to_fos_no_match.yml +221 -0
  517. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/name_to_fos_for_match.yml +221 -0
  518. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/name_to_fos_match.yml +221 -0
  519. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/fos/name_to_fos_no_match.yml +221 -0
  520. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/from_schema_org/with_id.yml +221 -0
  521. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_cff_metadata/cff-converter-python.yml +200 -0
  522. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_cff_metadata/ruby-cff.yml +154 -0
  523. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_cff_metadata/ruby-cff_repository_url.yml +154 -0
  524. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_codemeta_metadata/maremma.yml +86 -0
  525. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_codemeta_metadata/metadata_reports.yml +93 -0
  526. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/DOI_with_ORCID_ID.yml +337 -0
  527. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/DOI_with_SICI_DOI.yml +347 -0
  528. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/DOI_with_data_citation.yml +170 -0
  529. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/JaLC.yml +384 -0
  530. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/KISTI.yml +330 -0
  531. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/OP.yml +969 -0
  532. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/affiliation_is_space.yml +358 -0
  533. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/another_book.yml +312 -0
  534. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/another_book_chapter.yml +465 -0
  535. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/article_id_as_page_number.yml +276 -0
  536. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/author_literal.yml +492 -0
  537. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/book.yml +523 -0
  538. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/book_chapter.yml +377 -0
  539. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/book_chapter_with_RDF_for_container.yml +336 -0
  540. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/book_oup.yml +289 -0
  541. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/component.yml +289 -0
  542. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/dataset.yml +300 -0
  543. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/dataset_usda.yml +341 -0
  544. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/date_in_future.yml +570 -0
  545. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/dissertation.yml +301 -0
  546. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/empty_given_name.yml +303 -0
  547. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/invalid_date.yml +307 -0
  548. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_article.yml +461 -0
  549. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_article_original_language_title.yml +276 -0
  550. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_article_with.yml +908 -0
  551. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_article_with_RDF_for_container.yml +519 -0
  552. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_article_with_funding.yml +456 -0
  553. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_issue.yml +270 -0
  554. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/mEDRA.yml +310 -0
  555. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/markup.yml +329 -0
  556. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/missing_creator.yml +307 -0
  557. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/multiple_issn.yml +393 -0
  558. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/multiple_titles.yml +265 -0
  559. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/multiple_titles_with_missing.yml +860 -0
  560. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/not_found_error.yml +209 -0
  561. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/peer_review.yml +287 -0
  562. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/posted_content.yml +326 -0
  563. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/posted_content_copernicus.yml +297 -0
  564. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/report_osti.yml +315 -0
  565. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/vor_with_url.yml +451 -0
  566. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/yet_another_book.yml +816 -0
  567. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/yet_another_book_chapter.yml +324 -0
  568. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_raw/journal_article.yml +110 -0
  569. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/dissertation.yml +152 -0
  570. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/funding_references.yml +175 -0
  571. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/subject_scheme.yml +328 -0
  572. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date/publication_date.yml +221 -0
  573. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_from_date_parts/date.yml +221 -0
  574. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_from_date_parts/year-month.yml +221 -0
  575. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_from_date_parts/year.yml +221 -0
  576. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_from_parts/date.yml +221 -0
  577. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_from_parts/year-month.yml +221 -0
  578. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_from_parts/year.yml +221 -0
  579. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_parts/date.yml +221 -0
  580. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_parts/year-month.yml +221 -0
  581. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_date_parts/year.yml +221 -0
  582. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/future.yml +221 -0
  583. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/invalid.yml +221 -0
  584. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/nil.yml +221 -0
  585. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/past.yml +221 -0
  586. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datetime_from_time/present.yml +221 -0
  587. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/has_familyName.yml +133 -0
  588. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml +153 -0
  589. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/name_with_affiliation_crossref.yml +247 -0
  590. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_one_author/only_familyName_and_givenName.yml +467 -0
  591. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/BlogPosting.yml +530 -0
  592. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/BlogPosting_with_new_DOI.yml +530 -0
  593. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/get_schema_org_metadata_front_matter/BlogPosting.yml +534 -0
  594. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/harvard_dataverse.yml +1838 -0
  595. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/pangaea.yml +467 -0
  596. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/upstream_blog.yml +885 -0
  597. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_schema_org_metadata/zenodo.yml +583 -0
  598. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_series_information/only_title.yml +221 -0
  599. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_series_information/title_and_pages.yml +221 -0
  600. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_series_information/title_volume_and_pages.yml +221 -0
  601. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_series_information/title_volume_issue_and_pages.yml +221 -0
  602. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/github/github_as_cff_url.yml +221 -0
  603. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/github/github_as_codemeta_url.yml +221 -0
  604. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/github/github_from_url.yml +221 -0
  605. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/github/github_from_url_cff_file.yml +221 -0
  606. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/github/github_from_url_file.yml +221 -0
  607. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml +55 -0
  608. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/handle_input/unknown_DOI_prefix.yml +55 -0
  609. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/json_schema_errors/is_valid.yml +221 -0
  610. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_cc_url/not_found.yml +221 -0
  611. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_cc_url/with_trailing_slash.yml +221 -0
  612. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_cc_url/with_trailing_slash_and_to_https.yml +221 -0
  613. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/doi.yml +221 -0
  614. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/doi_as_url.yml +221 -0
  615. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/filename.yml +221 -0
  616. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/ftp.yml +221 -0
  617. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/invalid_url.yml +221 -0
  618. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/sandbox_via_options.yml +221 -0
  619. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/sandbox_via_url.yml +221 -0
  620. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/string.yml +221 -0
  621. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/url.yml +221 -0
  622. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_id/url_with_utf-8.yml +221 -0
  623. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_issn/from_array.yml +221 -0
  624. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_issn/from_empty_array.yml +221 -0
  625. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_issn/from_hash.yml +221 -0
  626. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_issn/from_string.yml +221 -0
  627. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_url/uri.yml +221 -0
  628. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_url/with_trailing_slash.yml +221 -0
  629. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/normalize_url/with_trailing_slash_and_to_https.yml +221 -0
  630. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/array.yml +221 -0
  631. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/array_of_strings.yml +221 -0
  632. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/first.yml +221 -0
  633. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/hash.yml +221 -0
  634. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/hash_with_array_value.yml +221 -0
  635. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/nil.yml +221 -0
  636. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/parse_attributes/string.yml +221 -0
  637. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_doi/decode_anothe_doi.yml +221 -0
  638. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_doi/decode_doi.yml +221 -0
  639. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_doi/encode_doi.yml +221 -0
  640. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/sanitize/onlies_keep_specific_tags.yml +221 -0
  641. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/sanitize/removes_a_tags.yml +221 -0
  642. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/spdx/hsh_to_spdx_id.yml +221 -0
  643. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/spdx/hsh_to_spdx_not_found.yml +221 -0
  644. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/spdx/hsh_to_spdx_url.yml +221 -0
  645. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/spdx/name_to_spdx_exists.yml +221 -0
  646. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/spdx/name_to_spdx_id.yml +221 -0
  647. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/to_schema_org/with_id.yml +221 -0
  648. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/to_schema_org_identifiers/with_identifiers.yml +221 -0
  649. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid.yml +221 -0
  650. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_https.yml +221 -0
  651. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_id.yml +221 -0
  652. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_sandbox.yml +221 -0
  653. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_sandbox_https.yml +221 -0
  654. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_with_spaces.yml +221 -0
  655. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_wrong_id.yml +221 -0
  656. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid/validate_orcid_www.yml +221 -0
  657. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid_scheme/validate_orcid_scheme.yml +221 -0
  658. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid_scheme/validate_orcid_scheme_https.yml +221 -0
  659. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid_scheme/validate_orcid_scheme_trailing_slash.yml +221 -0
  660. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_orcid_scheme/validate_orcid_scheme_www.yml +221 -0
  661. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_url/DOI.yml +221 -0
  662. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_url/ISSN.yml +221 -0
  663. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_url/URL.yml +221 -0
  664. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/validate_url/string.yml +221 -0
  665. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/BlogPosting.yml +81 -0
  666. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/Dataset.yml +120 -0
  667. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/authors_with_affiliations.yml +186 -0
  668. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/climate_data.yml +74 -0
  669. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/from_schema_org.yml +530 -0
  670. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/keywords_subject_scheme.yml +149 -0
  671. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/maremma.yml +86 -0
  672. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/text.yml +100 -0
  673. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/with_data_citation.yml +247 -0
  674. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_bibtex/with_pages.yml +228 -0
  675. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_cff/Collection_of_Jupyter_notebooks.yml +143 -0
  676. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_cff/SoftwareSourceCode_Zenodo.yml +150 -0
  677. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_cff/SoftwareSourceCode_also_Zenodo.yml +93 -0
  678. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_cff/ruby-cff.yml +154 -0
  679. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_citation/Dataset.yml +120 -0
  680. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_citation/Journal_article.yml +247 -0
  681. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_citation/Journal_article_vancouver_style.yml +299 -0
  682. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_citation/Missing_author.yml +199 -0
  683. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_citation/interactive_resource_without_dates.yml +75 -0
  684. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_citation/software_w/version.yml +86 -0
  685. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml +76 -0
  686. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite_check_codemeta_v2.yml +76 -0
  687. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml +541 -0
  688. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml +55 -0
  689. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml +85 -0
  690. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/posted_content.yml +283 -0
  691. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/schema_org_from_another_science_blog.yml +123 -0
  692. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/schema_org_from_front_matter.yml +477 -0
  693. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/schema_org_from_upstream_blog.yml +1025 -0
  694. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/Another_dataset.yml +110 -0
  695. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/BlogPosting.yml +81 -0
  696. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/BlogPosting_schema_org.yml +530 -0
  697. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/Dataset.yml +120 -0
  698. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/container_title.yml +153 -0
  699. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/interactive_resource_without_dates.yml +75 -0
  700. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/journal_article.yml +247 -0
  701. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/keywords_subject_scheme.yml +149 -0
  702. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/maremma.yml +86 -0
  703. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/missing_creator.yml +199 -0
  704. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/multiple_abstracts.yml +101 -0
  705. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/organization_author.yml +314 -0
  706. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/software.yml +90 -0
  707. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/software_w/version.yml +86 -0
  708. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/with_only_first_page.yml +333 -0
  709. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csl/with_pages.yml +228 -0
  710. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csv/climate_data.yml +74 -0
  711. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csv/maremma.yml +86 -0
  712. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csv/text.yml +100 -0
  713. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csv/with_data_citation.yml +247 -0
  714. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_csv/with_pages.yml +228 -0
  715. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_datacite/dissertation.yml +218 -0
  716. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_datacite/from_schema_org.yml +530 -0
  717. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_datacite/journal_article.yml +407 -0
  718. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_datacite/maremma.yml +86 -0
  719. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_datacite/with_ORCID_ID.yml +228 -0
  720. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_datacite/with_data_citation.yml +247 -0
  721. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/Dataset_in_schema_4_0.yml +120 -0
  722. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/Text_pass-thru.yml +106 -0
  723. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/book_chapter.yml +163 -0
  724. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/from_schema_org.yml +530 -0
  725. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/interactive_resource_without_dates.yml +75 -0
  726. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/maremma.yml +86 -0
  727. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/with_ORCID_ID.yml +228 -0
  728. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/with_data_citation.yml +247 -0
  729. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_jats_xml/with_editor.yml +355 -0
  730. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_rdf_xml/BlogPosting.yml +81 -0
  731. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_rdf_xml/BlogPosting_schema_org.yml +530 -0
  732. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_rdf_xml/journal_article.yml +247 -0
  733. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_rdf_xml/maremma.yml +86 -0
  734. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_rdf_xml/with_pages.yml +228 -0
  735. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/BlogPosting.yml +81 -0
  736. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/BlogPosting_schema_org.yml +530 -0
  737. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/Dataset.yml +120 -0
  738. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/alternate_name.yml +138 -0
  739. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/journal_article.yml +115 -0
  740. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/keywords_with_subject_scheme.yml +149 -0
  741. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/maremma.yml +86 -0
  742. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_ris/with_pages.yml +112 -0
  743. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/Another_Schema_org_JSON.yml +120 -0
  744. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/Funding.yml +192 -0
  745. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/Funding_OpenAIRE.yml +150 -0
  746. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/Schema_org_JSON.yml +98 -0
  747. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/Schema_org_JSON_Cyark.yml +160 -0
  748. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/Schema_org_JSON_IsSupplementTo.yml +153 -0
  749. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/alternate_identifiers.yml +131 -0
  750. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/data_catalog.yml +136 -0
  751. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/geo_location_box.yml +181 -0
  752. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/interactive_resource_without_dates.yml +127 -0
  753. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/journal_article.yml +247 -0
  754. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/maremma_schema_org_JSON.yml +86 -0
  755. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/series_information.yml +174 -0
  756. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/subject_scheme.yml +199 -0
  757. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_schema_org/subject_scheme_multiple_keywords.yml +201 -0
  758. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_turtle/BlogPosting.yml +81 -0
  759. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_turtle/BlogPosting_schema_org.yml +530 -0
  760. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_turtle/Dataset.yml +120 -0
  761. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_turtle/journal_article.yml +247 -0
  762. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_turtle/with_pages.yml +228 -0
  763. data/spec/fixtures/vivli.xml +17 -0
  764. data/spec/metadata_spec.rb +147 -0
  765. data/spec/readers/bibtex_reader_spec.rb +58 -0
  766. data/spec/readers/cff_reader_spec.rb +148 -0
  767. data/spec/readers/codemeta_reader_spec.rb +116 -0
  768. data/spec/readers/crossref_reader_spec.rb +919 -0
  769. data/spec/readers/crossref_xml_reader_spec.rb +948 -0
  770. data/spec/readers/csl_reader_spec.rb +61 -0
  771. data/spec/readers/datacite_reader_spec.rb +156 -0
  772. data/spec/readers/npm_reader_spec.rb +69 -0
  773. data/spec/readers/ris_reader_spec.rb +70 -0
  774. data/spec/readers/schema_org_reader_spec.rb +416 -0
  775. data/spec/schema_utils_spec.rb +16 -0
  776. data/spec/spec_helper.rb +96 -0
  777. data/spec/utils_spec.rb +631 -0
  778. data/spec/writers/bibtex_writer_spec.rb +160 -0
  779. data/spec/writers/cff_writer_spec.rb +118 -0
  780. data/spec/writers/citation_writer_spec.rb +51 -0
  781. data/spec/writers/codemeta_writer_spec.rb +47 -0
  782. data/spec/writers/crossref_xml_writer_spec.rb +173 -0
  783. data/spec/writers/csl_writer_spec.rb +291 -0
  784. data/spec/writers/csv_writer_spec.rb +82 -0
  785. data/spec/writers/datacite_writer_spec.rb +150 -0
  786. data/spec/writers/jats_writer_spec.rb +210 -0
  787. data/spec/writers/rdf_xml_writer_spec.rb +91 -0
  788. data/spec/writers/ris_writer_spec.rb +206 -0
  789. data/spec/writers/schema_org_writer_spec.rb +301 -0
  790. data/spec/writers/turtle_writer_spec.rb +85 -0
  791. metadata +1514 -0
@@ -0,0 +1,1351 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Commonmeta
4
+ module Utils
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'
44
+ }
45
+
46
+ # source: https://www.bibtex.com/e/entry-types/
47
+ BIB_TO_CM_TRANSLATIONS = {
48
+ 'article' => 'JournalArticle',
49
+ 'book' => 'Book',
50
+ 'booklet' => 'Book',
51
+ 'inbook' => 'BookChapter',
52
+ 'inproceedings' => 'ProceedingsArticle',
53
+ 'manual' => 'Report',
54
+ 'mastersthesis' => 'Dissertation',
55
+ 'misc' => 'Other',
56
+ 'phdthesis' => 'Dissertation',
57
+ 'proceedings' => 'Proceedings',
58
+ 'techreport' => 'Report',
59
+ 'unpublished' => 'Manuscript'
60
+ }
61
+
62
+ CM_TO_BIB_TRANSLATIONS = {
63
+ 'Article' => 'article',
64
+ 'Book' => 'book',
65
+ 'BookChapter' => 'inbook',
66
+ 'Dissertation' => 'phdthesis',
67
+ 'JournalArticle' => 'article',
68
+ 'Manuscript' => 'unpublished',
69
+ 'Other' => 'misc',
70
+ 'Proceedings' => 'proceedings',
71
+ 'ProceedingsArticle' => 'inproceedings',
72
+ 'Report' => 'techreport'
73
+ }
74
+
75
+ # source: https://docs.citationstyles.org/en/stable/specification.html?highlight=book#appendix-iii-types
76
+ CSL_TO_CM_TRANSLATIONS = {
77
+ 'article' => 'Article',
78
+ 'article-journal' => 'JournalArticle',
79
+ 'article-magazine' => 'Article',
80
+ 'article-newspaper' => 'Article',
81
+ 'bill' => 'LegalDocument',
82
+ 'book' => 'Book',
83
+ 'broadcast' => 'Audiovisual',
84
+ 'chapter' => 'BookChapter',
85
+ 'classic' => 'Book',
86
+ 'collection' => 'Collection',
87
+ 'dataset' => 'Dataset',
88
+ 'document' => 'Document',
89
+ 'entry' => 'Entry',
90
+ 'entry-dictionary' => 'Entry',
91
+ 'entry-encyclopedia' => 'Entry',
92
+ 'event' => 'Event',
93
+ 'figure' => 'Figure',
94
+ 'graphic' => 'Image',
95
+ 'hearing' => 'LegalDocument',
96
+ 'interview' => 'Document',
97
+ 'legal_case' => 'LegalDocument',
98
+ 'legislation' => 'LegalDocument',
99
+ 'manuscript' => 'Manuscript',
100
+ 'map' => 'Map',
101
+ 'motion_picture' => 'Audiovisual',
102
+ 'musical_score' => 'Document',
103
+ 'pamphlet' => 'Document',
104
+ 'paper-conference' => 'ProceedingsArticle',
105
+ 'patent' => 'Patent',
106
+ 'performance' => 'Performance',
107
+ 'periodical' => 'Journal',
108
+ 'personal_communication' => 'PersonalCommunication',
109
+ 'post' => 'Post',
110
+ 'post-weblog' => 'Article',
111
+ 'regulation' => 'LegalDocument',
112
+ 'report' => 'Report',
113
+ 'review' => 'Review',
114
+ 'review-book' => 'Review',
115
+ 'software' => 'Software',
116
+ 'song' => 'Audiovisual',
117
+ 'speech' => 'Speech',
118
+ 'standard' => 'Standard',
119
+ 'thesis' => 'Dissertation',
120
+ 'treaty' => 'LegalDocument',
121
+ 'webpage' => 'WebPage'
122
+ }
123
+
124
+ CM_TO_CSL_TRANSLATIONS = {
125
+ 'Article' => 'article',
126
+ 'JournalArticle' => 'article-journal',
127
+ 'Book' => 'book',
128
+ 'BookChapter' => 'chapter',
129
+ 'Collection' => 'collection',
130
+ 'Dataset' => 'dataset',
131
+ 'Document' => 'document',
132
+ 'Entry' => 'entry',
133
+ 'Event' => 'event',
134
+ 'Figure' => 'figure',
135
+ 'Image' => 'graphic',
136
+ 'LegalDocument' => 'legal_case',
137
+ 'Manuscript' => 'manuscript',
138
+ 'Map' => 'map',
139
+ 'Audiovisual' => 'motion_picture',
140
+ 'Patent' => 'patent',
141
+ 'Performance' => 'performance',
142
+ 'Journal' => 'periodical',
143
+ 'PersonalCommunication' => 'personal_communication',
144
+ 'Post' => 'post',
145
+ 'Report' => 'report',
146
+ 'Review' => 'review',
147
+ 'Software' => 'software',
148
+ 'Speech' => 'speech',
149
+ 'Standard' => 'standard',
150
+ 'Dissertation' => 'thesis',
151
+ 'WebPage' => 'webpage'
152
+ }
153
+
154
+ # source: http://api.crossref.org/types
155
+ CR_TO_CM_TRANSLATIONS = {
156
+ 'BookChapter' => 'BookChapter',
157
+ 'BookPart' => 'BookPart',
158
+ 'BookSection' => 'BookSection',
159
+ 'BookSeries' => 'BookSeries',
160
+ 'BookSet' => 'BookSet',
161
+ 'BookTrack' => 'BookTrack',
162
+ 'Book' => 'Book',
163
+ 'Component' => 'Component',
164
+ 'Database' => 'Database',
165
+ 'Dataset' => 'Dataset',
166
+ 'Dissertation' => 'Dissertation',
167
+ 'EditedBook' => 'EditedBook',
168
+ 'Grant' => 'Grant',
169
+ 'JournalArticle' => 'JournalArticle',
170
+ 'JournalIssue' => 'JournalIssue',
171
+ 'JournalVolume' => 'JournalVolume',
172
+ 'Journal' => 'Journal',
173
+ 'Monograph' => 'Book',
174
+ 'Other' => 'Other',
175
+ 'PeerReview' => 'PeerReview',
176
+ 'PostedContent' => 'Article',
177
+ 'ProceedingsArticle' => 'ProceedingsArticle',
178
+ 'ProceedingsSeries' => 'ProceedingsSeries',
179
+ 'Proceedings' => 'Proceedings',
180
+ 'ReferenceBook' => 'ReferenceBook',
181
+ 'ReferenceEntry' => 'Entry',
182
+ 'ReportComponent' => 'ReportComponent',
183
+ 'ReportSeries' => 'ReportSeries',
184
+ 'Report' => 'Report',
185
+ 'Standard' => 'Standard'
186
+ }
187
+
188
+ CM_TO_CR_TRANSLATIONS = {
189
+ 'Article' => 'PostedContent',
190
+ 'BookChapter' => 'BookChapter',
191
+ 'BookSeries' => 'BookSeries',
192
+ 'Book' => 'Book',
193
+ 'Component' => 'Component',
194
+ 'Dataset' => 'Dataset',
195
+ 'Dissertation' => 'Dissertation',
196
+ 'Grant' => 'Grant',
197
+ 'JournalArticle' => 'JournalArticle',
198
+ 'JournalIssue' => 'JournalIssue',
199
+ 'JournalVolume' => 'JournalVolume',
200
+ 'Journal' => 'Journal',
201
+ 'ProceedingsArticle' => 'ProceedingsArticle',
202
+ 'ProceedingsSeries' => 'ProceedingsSeries',
203
+ 'Proceedings' => 'Proceedings',
204
+ 'ReportComponent' => 'ReportComponent',
205
+ 'ReportSeries' => 'ReportSeries',
206
+ 'Report' => 'Report',
207
+ 'PeerReview' => 'PeerReview',
208
+ 'Other' => 'Other'
209
+ }
210
+
211
+ # source: https://github.com/datacite/schema/blob/master/source/meta/kernel-4/include/datacite-resourceType-v4.xsd
212
+ DC_TO_CM_TRANSLATIONS = {
213
+ 'Audiovisual' => 'Audiovisual',
214
+ 'BlogPosting' => 'Article',
215
+ 'Book' => 'Book',
216
+ 'BookChapter' => 'BookChapter',
217
+ 'Collection' => 'Collection',
218
+ 'ComputationalNotebook' => 'ComputationalNotebook',
219
+ 'ConferencePaper' => 'ProceedingsArticle',
220
+ 'ConferenceProceeding' => 'Proceedings',
221
+ 'DataPaper' => 'JournalArticle',
222
+ 'Dataset' => 'Dataset',
223
+ 'Dissertation' => 'Dissertation',
224
+ 'Event' => 'Event',
225
+ 'Image' => 'Image',
226
+ 'InteractiveResource' => 'InteractiveResource',
227
+ 'Journal' => 'Journal',
228
+ 'JournalArticle' => 'JournalArticle',
229
+ 'Model' => 'Model',
230
+ 'OutputManagementPlan' => 'OutputManagementPlan',
231
+ 'PeerReview' => 'PeerReview',
232
+ 'PhysicalObject' => 'PhysicalObject',
233
+ 'Poster' => 'Speech',
234
+ 'Preprint' => 'Article',
235
+ 'Report' => 'Report',
236
+ 'Service' => 'Service',
237
+ 'Software' => 'Software',
238
+ 'Sound' => 'Sound',
239
+ 'Standard' => 'Standard',
240
+ 'Text' => 'Document',
241
+ 'Thesis' => 'Dissertation',
242
+ 'Workflow' => 'Workflow',
243
+ 'Other' => 'Other'
244
+ }
245
+
246
+ CM_TO_DC_TRANSLATIONS = {
247
+ 'Article' => 'Preprint',
248
+ 'Audiovisual' => 'Audiovisual',
249
+ 'Book' => 'Book',
250
+ 'BookChapter' => 'BookChapter',
251
+ 'Collection' => 'Collection',
252
+ 'Dataset' => 'Dataset',
253
+ 'Dissertation' => 'Dissertation',
254
+ 'Document' => 'Text',
255
+ 'Entry' => 'Text',
256
+ 'Event' => 'Event',
257
+ 'Figure' => 'Image',
258
+ 'Image' => 'Image',
259
+ 'JournalArticle' => 'JournalArticle',
260
+ 'LegalDocument' => 'Text',
261
+ 'Manuscript' => 'Text',
262
+ 'Map' => 'Image',
263
+ 'Patent' => 'Text',
264
+ 'Performance' => 'Audiovisual',
265
+ 'PersonalCommunication' => 'Text',
266
+ 'Post' => 'Text',
267
+ 'ProceedingsArticle' => 'ConferencePaper',
268
+ 'Proceedings' => 'ConferenceProceeding',
269
+ 'Report' => 'Report',
270
+ 'PeerReview' => 'PeerReview',
271
+ 'Software' => 'Software',
272
+ 'Sound' => 'Sound',
273
+ 'Standard' => 'Standard',
274
+ 'WebPage' => 'Text'
275
+ }
276
+
277
+ RIS_TO_CM_TRANSLATIONS = {
278
+ 'ABST' => 'Text',
279
+ 'ADVS' => 'Text',
280
+ 'AGGR' => 'Text',
281
+ 'ANCIENT' => 'Text',
282
+ 'ART' => 'Text',
283
+ 'BILL' => 'Text',
284
+ 'BLOG' => 'Text',
285
+ 'BOOK' => 'Book',
286
+ 'CASE' => 'Text',
287
+ 'CHAP' => 'BookChapter',
288
+ 'CHART' => 'Text',
289
+ 'CLSWK' => 'Text',
290
+ 'CTLG' => 'Collection',
291
+ 'COMP' => 'Software',
292
+ 'DATA' => 'Dataset',
293
+ 'DBASE' => 'Database',
294
+ 'DICT' => 'Dictionary',
295
+ 'EBOOK' => 'Book',
296
+ 'ECHAP' => 'BookChapter',
297
+ 'EDBOOK' => 'Book',
298
+ 'EJOUR' => 'JournalArticle',
299
+ 'ELEC' => 'Text',
300
+ 'ENCYC' => 'Encyclopedia',
301
+ 'EQUA' => 'Equation',
302
+ 'FIGURE' => 'Image',
303
+ 'GEN' => 'CreativeWork',
304
+ 'GOVDOC' => 'GovernmentDocument',
305
+ 'GRANT' => 'Grant',
306
+ 'HEAR' => 'Hearing',
307
+ 'ICOMM' => 'Text',
308
+ 'INPR' => 'Text',
309
+ 'JFULL' => 'JournalArticle',
310
+ 'JOUR' => 'JournalArticle',
311
+ 'LEGAL' => 'LegalRuleOrRegulation',
312
+ 'MANSCPT' => 'Text',
313
+ 'MAP' => 'Map',
314
+ 'MGZN' => 'MagazineArticle',
315
+ 'MPCT' => 'Audiovisual',
316
+ 'MULTI' => 'Audiovisual',
317
+ 'MUSIC' => 'MusicScore',
318
+ 'NEWS' => 'NewspaperArticle',
319
+ 'PAMP' => 'Pamphlet',
320
+ 'PAT' => 'Patent',
321
+ 'PCOMM' => 'PersonalCommunication',
322
+ 'RPRT' => 'Report',
323
+ 'SER' => 'SerialPublication',
324
+ 'SLIDE' => 'Slide',
325
+ 'SOUND' => 'SoundRecording',
326
+ 'STAND' => 'Standard',
327
+ 'THES' => 'Dissertation',
328
+ 'UNBILL' => 'UnenactedBill',
329
+ 'UNPB' => 'UnpublishedWork',
330
+ 'VIDEO' => 'Audiovisual',
331
+ 'WEB' => 'WebPage'
332
+ }
333
+
334
+ CM_TO_RIS_TRANSLATIONS = {
335
+ 'Article' => 'JOUR',
336
+ 'Audiovisual' => 'VIDEO',
337
+ 'Book' => 'BOOK',
338
+ 'BookChapter' => 'CHAP',
339
+ 'Collection' => 'CTLG',
340
+ 'Dataset' => 'DATA',
341
+ 'Dissertation' => 'THES',
342
+ 'Document' => 'GEN',
343
+ 'Entry' => 'DICT',
344
+ 'Event' => 'GEN',
345
+ 'Figure' => 'FIGURE',
346
+ 'Image' => 'FIGURE',
347
+ 'JournalArticle' => 'JOUR',
348
+ 'LegalDocument' => 'GEN',
349
+ 'Manuscript' => 'GEN',
350
+ 'Map' => 'MAP',
351
+ 'Patent' => 'PAT',
352
+ 'Performance' => 'GEN',
353
+ 'PersonalCommunication' => 'PCOMM',
354
+ 'Post' => 'GEN',
355
+ 'ProceedingsArticle' => 'CPAPER',
356
+ 'Proceedings' => 'CONF',
357
+ 'Report' => 'RPRT',
358
+ 'Review' => 'GEN',
359
+ 'Software' => 'COMP',
360
+ 'Sound' => 'SOUND',
361
+ 'Standard' => 'STAND',
362
+ 'WebPage' => 'WEB'
363
+ }
364
+
365
+ SO_TO_CM_TRANSLATIONS = {
366
+ 'Article' => 'Article',
367
+ 'BlogPosting' => 'Article',
368
+ 'Book' => 'Book',
369
+ 'BookChapter' => 'BookChapter',
370
+ 'CreativeWork' => 'Other',
371
+ 'Dataset' => 'Dataset',
372
+ 'Dissertation' => 'Dissertation',
373
+ 'NewsArticle' => 'Article',
374
+ 'Legislation' => 'LegalDocument',
375
+ 'ScholarlyArticle' => 'JournalArticle',
376
+ 'SoftwareSourceCode' => 'Software'
377
+ }
378
+
379
+ CM_TO_SO_TRANSLATIONS = {
380
+ 'Article' => 'Article',
381
+ 'Audiovisual' => 'CreativeWork',
382
+ 'Book' => 'Book',
383
+ 'BookChapter' => 'BookChapter',
384
+ 'Collection' => 'CreativeWork',
385
+ 'Dataset' => 'Dataset',
386
+ 'Dissertation' => 'Dissertation',
387
+ 'Document' => 'CreativeWork',
388
+ 'Entry' => 'CreativeWork',
389
+ 'Event' => 'CreativeWork',
390
+ 'Figure' => 'CreativeWork',
391
+ 'Image' => 'CreativeWork',
392
+ 'JournalArticle' => 'ScholarlyArticle',
393
+ 'LegalDocument' => 'Legislation',
394
+ 'Software' => 'SoftwareSourceCode'
395
+ }
396
+
397
+ CM_TO_JATS_TRANSLATIONS = {
398
+ 'Proceedings' => 'working-paper',
399
+ 'ReferenceBook' => 'book',
400
+ 'JournalIssue' => 'journal',
401
+ 'ProceedingsArticle' => 'working-paper',
402
+ 'Other' => nil,
403
+ 'Dissertation' => nil,
404
+ 'Dataset' => 'data',
405
+ 'Document' => 'journal',
406
+ 'EditedBook' => 'book',
407
+ 'JournalArticle' => 'journal',
408
+ 'Journal' => 'journal',
409
+ 'Report' => 'report',
410
+ 'BookSeries' => 'book',
411
+ 'ReportSeries' => 'report',
412
+ 'BookTrack' => 'book',
413
+ 'Standard' => 'standard',
414
+ 'BookSection' => 'chapter',
415
+ 'BookPart' => 'chapter',
416
+ 'Book' => 'book',
417
+ 'BookChapter' => 'chapter',
418
+ 'StandardSeries' => 'standard',
419
+ 'Monograph' => 'book',
420
+ 'Component' => nil,
421
+ 'ReferenceEntry' => nil,
422
+ 'JournalVolume' => 'journal',
423
+ 'BookSet' => 'book',
424
+ 'Article' => 'journal',
425
+ 'Software' => 'software'
426
+ }
427
+
428
+ UNKNOWN_INFORMATION = {
429
+ ':unac' => 'temporarily inaccessible',
430
+ ':unal' => 'unallowed, suppressed intentionally',
431
+ ':unap' => 'not applicable, makes no sense',
432
+ ':unas' => 'value unassigned (e.g., Untitled)',
433
+ ':unav' => 'value unavailable, possibly unknown',
434
+ ':unkn' => 'known to be unknown (e.g., Anonymous, Inconnue)',
435
+ ':none' => 'never had a value, never will',
436
+ ':null' => 'explicitly and meaningfully empty',
437
+ ':tba' => 'to be assigned or announced later',
438
+ ':etal' => 'too numerous to list (et alia)'
439
+ }
440
+
441
+ def find_from_format(id: nil, string: nil, ext: nil, filename: nil)
442
+ if id.present?
443
+ find_from_format_by_id(id)
444
+ elsif string.present? && ext.present?
445
+ find_from_format_by_ext(string, ext: ext)
446
+ elsif string.present?
447
+ find_from_format_by_string(string)
448
+ elsif filename.present?
449
+ find_from_format_by_filename(filename)
450
+ else
451
+ 'datacite'
452
+ end
453
+ end
454
+
455
+ def find_from_format_by_id(id)
456
+ id = normalize_id(id)
457
+
458
+ if %r{\A(?:(http|https):/(/)?(dx\.)?(doi\.org|handle\.stage\.datacite\.org)/)?(doi:)?(10\.\d{4,5}/.+)\z}.match?(id)
459
+ ra = get_doi_ra(id)
460
+ %w[DataCite Crossref mEDRA KISTI JaLC OP].include?(ra) ? ra.downcase : nil
461
+ elsif %r{\A(?:(http|https):/(/)?orcid\.org/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z}.match?(id)
462
+ 'orcid'
463
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)/package.json\z}.match?(id)
464
+ 'npm'
465
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)/codemeta.json\z}.match?(id)
466
+ 'codemeta'
467
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)/CITATION.cff\z}.match?(id)
468
+ 'cff'
469
+ elsif %r{\A(http|https):/(/)?github\.com/(.+)\z}.match?(id)
470
+ 'cff'
471
+ else
472
+ 'schema_org'
473
+ end
474
+ end
475
+
476
+ def find_from_format_by_filename(filename)
477
+ if filename == 'package.json'
478
+ 'npm'
479
+ elsif filename == 'CITATION.cff'
480
+ 'cff'
481
+ end
482
+ end
483
+
484
+ def find_from_format_by_ext(string, options = {})
485
+ case options[:ext]
486
+ when '.bib'
487
+ 'bibtex'
488
+ when '.ris'
489
+ 'ris'
490
+ when '.xml', '.json'
491
+ find_from_format_by_string(string)
492
+ end
493
+ end
494
+
495
+ def find_from_format_by_string(string)
496
+ begin # try to parse as JSON
497
+ hsh = MultiJson.load(string).to_h
498
+ if hsh.dig('@context') && URI.parse(hsh.dig('@context')).host == 'schema.org'
499
+ return 'schema_org'
500
+ elsif hsh.dig('schemaVersion').to_s.start_with?('http://datacite.org/schema/kernel')
501
+ return 'datacite'
502
+ elsif hsh.dig('source') == 'Crossref'
503
+ return 'crossref'
504
+ elsif hsh.dig('issued', 'date-parts').present?
505
+ return 'csl'
506
+ elsif URI.parse(hsh.dig('@context')).to_s == 'https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld'
507
+ return 'codemeta'
508
+ end
509
+ rescue MultiJson::ParseError
510
+ end
511
+
512
+ begin # try to parse as XML
513
+ hsh = Hash.from_xml(string)
514
+ return 'crossref_xml' if hsh.to_h.dig('crossref_result').present?
515
+ rescue Nokogiri::XML::SyntaxError
516
+ end
517
+
518
+ begin # try to parse as YAML
519
+ hsh = YAML.load(string, permitted_classes: [Date])
520
+ return 'cff' if hsh.is_a?(Hash) && hsh.fetch('cff-version', nil).present?
521
+ rescue Psych::SyntaxError
522
+ end
523
+
524
+ if string.start_with?('TY - ')
525
+ 'ris'
526
+ elsif BibTeX.parse(string).first
527
+ 'bibtex'
528
+ end
529
+ end
530
+
531
+ def orcid_from_url(url)
532
+ Array(%r{\A:(http|https)://orcid\.org/(.+)}.match(url)).last
533
+ end
534
+
535
+ def orcid_as_url(orcid)
536
+ "https://orcid.org/#{orcid}" if orcid.present?
537
+ end
538
+
539
+ def validate_orcid(orcid)
540
+ 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
541
+ orcid.gsub(/[[:space:]]/, '-') if orcid.present?
542
+ end
543
+
544
+ def validate_orcid_scheme(orcid_scheme)
545
+ Array(%r{\A(http|https)://(www\.)?(orcid\.org)}.match(orcid_scheme)).last
546
+ end
547
+
548
+ def validate_url(str)
549
+ if %r{\A(?:(http|https)://(dx\.)?doi.org/)?(doi:)?(10\.\d{4,5}/.+)\z}.match?(str)
550
+ 'DOI'
551
+ elsif %r{\A(http|https)://}.match?(str)
552
+ 'URL'
553
+ elsif /\A(ISSN|eISSN) (\d{4}-\d{3}[0-9X]+)\z/.match?(str)
554
+ 'ISSN'
555
+ end
556
+ end
557
+
558
+ def parse_attributes(element, options = {})
559
+ content = options[:content] || '__content__'
560
+
561
+ if element.is_a?(String) && options[:content].nil?
562
+ CGI.unescapeHTML(element)
563
+ elsif element.is_a?(Hash)
564
+ element.fetch(CGI.unescapeHTML(content), nil)
565
+ elsif element.is_a?(Array)
566
+ a = element.map { |e| e.is_a?(Hash) ? e.fetch(CGI.unescapeHTML(content), nil) : e }.uniq
567
+ a = options[:first] ? a.first : a.unwrap
568
+ end
569
+ end
570
+
571
+ def normalize_id(id, options = {})
572
+ return nil unless id.present?
573
+
574
+ # check for valid DOI
575
+ doi = normalize_doi(id, options)
576
+ return doi if doi.present?
577
+
578
+ # check for valid HTTP uri
579
+ uri = Addressable::URI.parse(id)
580
+ return nil unless uri && uri.host && %w[http https].include?(uri.scheme)
581
+
582
+ # clean up URL
583
+ PostRank::URI.clean(id)
584
+ rescue Addressable::URI::InvalidURIError
585
+ nil
586
+ end
587
+
588
+ def normalize_url(id, options = {})
589
+ return nil unless id.present?
590
+
591
+ # handle info URIs
592
+ return id if id.to_s.start_with?('info')
593
+
594
+ # check for valid HTTP uri
595
+ uri = Addressable::URI.parse(id)
596
+
597
+ return nil unless uri && uri.host && %w[http https ftp].include?(uri.scheme)
598
+
599
+ # optionally turn into https URL
600
+ uri.scheme = 'https' if options[:https]
601
+
602
+ # clean up URL
603
+ uri.path = PostRank::URI.clean(uri.path)
604
+
605
+ uri.to_s
606
+ rescue Addressable::URI::InvalidURIError
607
+ nil
608
+ end
609
+
610
+ def normalize_cc_url(id)
611
+ id = normalize_url(id, https: true)
612
+ NORMALIZED_LICENSES.fetch(id, id)
613
+ end
614
+
615
+ def normalize_orcid(orcid)
616
+ orcid = validate_orcid(orcid)
617
+ return nil unless orcid.present?
618
+
619
+ # turn ORCID ID into URL
620
+ 'https://orcid.org/' + Addressable::URI.encode(orcid)
621
+ end
622
+
623
+ # pick electronic issn if there are multiple
624
+ # format issn as xxxx-xxxx
625
+ def normalize_issn(input, options = {})
626
+ content = options[:content] || '__content__'
627
+
628
+ issn = if input.blank?
629
+ nil
630
+ elsif input.is_a?(String) && options[:content].nil?
631
+ input
632
+ elsif input.is_a?(Hash)
633
+ input.fetch(content, nil)
634
+ elsif input.is_a?(Array)
635
+ a = input.find { |a| a['media_type'] == 'electronic' } || input.first
636
+ a.fetch(content, nil)
637
+ end
638
+
639
+ case issn.to_s.length
640
+ when 9
641
+ issn
642
+ when 8
643
+ issn[0..3] + '-' + issn[4..7]
644
+ end
645
+ end
646
+
647
+ # find Creative Commons or OSI license in licenses array, normalize url and name
648
+ def normalize_licenses(licenses)
649
+ standard_licenses = Array.wrap(licenses).map do |l|
650
+ URI.parse(l['url'])
651
+ end.select { |li| li.host && li.host[/(creativecommons.org|opensource.org)$/] }
652
+ return licenses unless standard_licenses.present?
653
+
654
+ # use HTTPS
655
+ uri.scheme = 'https'
656
+
657
+ # use host name without subdomain
658
+ uri.host = Array(/(creativecommons.org|opensource.org)/.match uri.host).last
659
+
660
+ # normalize URLs
661
+ if uri.host == 'creativecommons.org'
662
+ uri.path = uri.path.split('/')[0..-2].join('/') if uri.path.split('/').last == 'legalcode'
663
+ uri.path << '/' unless uri.path.end_with?('/')
664
+ else
665
+ uri.path = uri.path.gsub(/(-license|\.php|\.html)/, '')
666
+ uri.path = uri.path.sub(/(mit|afl|apl|osl|gpl|ecl)/) { |match| match.upcase }
667
+ uri.path = uri.path.sub(/(artistic|apache)/) { |match| match.titleize }
668
+ uri.path = uri.path.sub(/([^0-9-]+)(-)?([1-9])?(\.)?([0-9])?$/) do
669
+ m = Regexp.last_match
670
+ text = m[1]
671
+
672
+ if m[3].present?
673
+ version = [m[3], m[5].presence || '0'].join('.')
674
+ [text, version].join('-')
675
+ else
676
+ text
677
+ end
678
+ end
679
+ end
680
+
681
+ uri.to_s
682
+ rescue URI::InvalidURIError
683
+ nil
684
+ end
685
+
686
+ def to_datacite(element, options = {})
687
+ a = Array.wrap(element).map do |e|
688
+ e.each_with_object({}) do |(k, v), h|
689
+ h[k.dasherize] = v
690
+ end
691
+ end
692
+ options[:first] ? a.unwrap : a.presence
693
+ end
694
+
695
+ def from_datacite(element)
696
+ mapping = { 'nameType' => 'type', 'creatorName' => 'name' }
697
+
698
+ map_hash_keys(element: element, mapping: mapping)
699
+ end
700
+
701
+ def to_schema_org(element)
702
+ mapping = { 'type' => '@type', 'id' => '@id', 'title' => 'name' }
703
+
704
+ map_hash_keys(element: element, mapping: mapping)
705
+ end
706
+
707
+ def to_schema_org_container(element, options = {})
708
+ return nil unless element.is_a?(Hash) || (element.nil? && options[:container_title].present?)
709
+
710
+ issn = element['identifier'] if element['identifierType'] == 'ISSN'
711
+ id = issn.blank? ? element['identifier'] : nil
712
+ name = options[:container_title] || element['title']
713
+ type = id || name ? options[:type] || element['type'] : nil
714
+
715
+ { '@id' => id, '@type' => type, 'name' => name, 'issn' => issn }.compact
716
+ end
717
+
718
+ def to_schema_org_identifiers(element, _options = {})
719
+ Array.wrap(element).map do |ai|
720
+ {
721
+ '@type' => 'PropertyValue',
722
+ 'propertyID' => ai['alternateIdentifierType'],
723
+ 'value' => ai['alternateIdentifier']
724
+ }
725
+ end.unwrap
726
+ end
727
+
728
+ def to_schema_org_relation(related_identifiers: nil, relation_type: nil)
729
+ return nil unless related_identifiers.present? && relation_type.present?
730
+
731
+ relation_type = if relation_type == 'References'
732
+ %w[References Cites
733
+ Documents]
734
+ else
735
+ [relation_type]
736
+ end
737
+
738
+ Array.wrap(related_identifiers).select do |ri|
739
+ relation_type.include?(ri['relationType'])
740
+ end.map do |r|
741
+ if r['relatedIdentifierType'] == 'ISSN' && r['relationType'] == 'IsPartOf'
742
+ { '@type' => 'Periodical', 'issn' => r['relatedIdentifier'] }.compact
743
+ else
744
+ {
745
+ '@id' => normalize_id(r['relatedIdentifier']),
746
+ '@type' => DC_TO_SO_TRANSLATIONS[r['resourceTypeGeneral']] || 'CreativeWork'
747
+ }.compact
748
+ end
749
+ end.unwrap
750
+ end
751
+
752
+ def to_schema_org_funder(funding_references)
753
+ return nil unless funding_references.present?
754
+
755
+ Array.wrap(funding_references).map do |fr|
756
+ {
757
+ '@id' => fr['funderIdentifier'],
758
+ '@type' => 'Organization',
759
+ 'name' => fr['funderName']
760
+ }.compact
761
+ end.unwrap
762
+ end
763
+
764
+ def to_schema_org_citation(reference)
765
+ return nil unless reference.present?
766
+
767
+ {
768
+ '@type' => 'CreativeWork',
769
+ '@id' => reference['doi'] ? normalize_id(reference['doi']) : nil,
770
+ 'name' => reference['title'],
771
+ 'datePublished' => reference['publicationYear']
772
+ }.compact
773
+ end
774
+
775
+ def to_schema_org_spatial_coverage(geo_location)
776
+ return nil unless geo_location.present?
777
+
778
+ Array.wrap(geo_location).each_with_object([]) do |gl, sum|
779
+ if gl.fetch('geoLocationPoint', nil)
780
+ sum << {
781
+ '@type' => 'Place',
782
+ 'geo' => {
783
+ '@type' => 'GeoCoordinates',
784
+ 'address' => gl['geoLocationPlace'],
785
+ 'latitude' => gl.dig('geoLocationPoint', 'pointLatitude'),
786
+ 'longitude' => gl.dig('geoLocationPoint', 'pointLongitude')
787
+ }
788
+ }.compact
789
+ end
790
+
791
+ if gl.fetch('geoLocationBox', nil)
792
+ sum << {
793
+ '@type' => 'Place',
794
+ 'geo' => {
795
+ '@type' => 'GeoShape',
796
+ 'address' => gl['geoLocationPlace'],
797
+ 'box' => [gl.dig('geoLocationBox', 'southBoundLatitude'),
798
+ gl.dig('geoLocationBox', 'westBoundLongitude'),
799
+ gl.dig('geoLocationBox', 'northBoundLatitude'),
800
+ gl.dig('geoLocationBox', 'eastBoundLongitude')].compact.join(' ').presence
801
+ }.compact
802
+ }.compact
803
+ end
804
+
805
+ if gl.fetch('geoLocationPolygon', nil)
806
+ sum << {
807
+ '@type' => 'Place',
808
+ 'geo' => {
809
+ '@type' => 'GeoShape',
810
+ 'address' => gl['geoLocationPlace'],
811
+ 'polygon' => Array.wrap(gl.dig('geoLocationPolygon')).map do |glp|
812
+ Array.wrap(glp).map do |glpp|
813
+ [glpp.dig('polygonPoint', 'pointLongitude'),
814
+ glpp.dig('polygonPoint', 'pointLatitude')].compact
815
+ end.compact
816
+ end.compact.presence
817
+ }
818
+ }
819
+ end
820
+
821
+ next unless gl.fetch('geoLocationPlace',
822
+ nil) && !gl.fetch('geoLocationPoint',
823
+ nil) && !gl.fetch('geoLocationBox',
824
+ nil) && !gl.fetch(
825
+ 'geoLocationPolygon', nil
826
+ )
827
+
828
+ sum << {
829
+ '@type' => 'Place',
830
+ 'geo' => {
831
+ '@type' => 'GeoCoordinates',
832
+ 'address' => gl['geoLocationPlace']
833
+ }
834
+ }.compact
835
+ end.unwrap
836
+ end
837
+
838
+ def from_schema_org(element)
839
+ mapping = { '@type' => 'type', '@id' => 'id' }
840
+
841
+ map_hash_keys(element: element, mapping: mapping)
842
+ end
843
+
844
+ def map_hash_keys(element: nil, mapping: nil)
845
+ Array.wrap(element).map do |a|
846
+ a.map { |k, v| [mapping.fetch(k, k), v] }.reduce({}) do |hsh, (k, v)|
847
+ if k == 'affiliation' && v.is_a?(Array)
848
+ hsh[k] = v.map do |affiliation|
849
+ if affiliation.is_a?(Hash)
850
+ affiliation.merge('@type' => 'Organization')
851
+ else
852
+ affiliation
853
+ end
854
+ end
855
+ hsh
856
+ elsif k == 'type' && v.is_a?(String)
857
+ hsh[k] = v.capitalize
858
+ hsh
859
+ elsif v.is_a?(Hash)
860
+ hsh[k] = to_schema_org(v)
861
+ hsh
862
+ else
863
+ hsh[k] = v
864
+ hsh
865
+ end
866
+ end
867
+ end.unwrap
868
+ end
869
+
870
+ def to_identifier(identifier)
871
+ {
872
+ '@type' => 'PropertyValue',
873
+ 'propertyID' => identifier['relatedIdentifierType'],
874
+ 'value' => identifier['relatedIdentifier']
875
+ }
876
+ end
877
+
878
+ def from_csl(element)
879
+ Array.wrap(element).map do |a|
880
+ if a['literal'].present?
881
+ a['type'] = 'Organization'
882
+ a['name'] = a['literal']
883
+ elsif a['name'].present?
884
+ a['type'] = 'Organization'
885
+ elsif a['given'].present? || a['family'].present?
886
+ a['type'] = 'Person'
887
+ end
888
+ a['givenName'] = a['given']
889
+ a['familyName'] = a['family']
890
+ a.except('given', 'family', 'literal').compact
891
+ end.unwrap
892
+ end
893
+
894
+ def to_csl(element)
895
+ Array.wrap(element).map do |a|
896
+ a['family'] = a['familyName']
897
+ a['given'] = a['givenName']
898
+ a['literal'] = a['name'] unless a['familyName'].present?
899
+ a.except('nameType', 'type', '@type', 'id', '@id', 'name', 'familyName', 'givenName',
900
+ 'affiliation', 'contributorType').compact
901
+ end.presence
902
+ end
903
+
904
+ def to_ris(element)
905
+ Array.wrap(element).map do |a|
906
+ if a['familyName'].present?
907
+ [a['familyName'], a['givenName']].join(', ')
908
+ else
909
+ a['name']
910
+ end
911
+ end.unwrap
912
+ end
913
+
914
+ def sanitize(text, options = {})
915
+ options[:tags] ||= Set.new(%w[strong em b i code pre sub sup br])
916
+ content = options[:content] || '__content__'
917
+ custom_scrubber = Commonmeta::WhitelistScrubber.new(options)
918
+
919
+ if text.is_a?(String)
920
+ # remove excessive internal whitespace with squish
921
+ Loofah.scrub_fragment(text, custom_scrubber).to_s.squish
922
+ elsif text.is_a?(Hash)
923
+ sanitize(text.fetch(content, nil))
924
+ elsif text.is_a?(Array)
925
+ a = text.map { |e| e.is_a?(Hash) ? sanitize(e.fetch(content, nil)) : sanitize(e) }.uniq
926
+ a = options[:first] ? a.first : a.unwrap
927
+ end
928
+ end
929
+
930
+ def github_from_url(url)
931
+ return {} unless %r{\Ahttps://github\.com/(.+)(?:/)?(.+)?(?:/tree/)?(.*)\z}.match?(url)
932
+
933
+ words = URI.parse(url).path[1..-1].split('/')
934
+ path = words.length > 3 ? words[4...words.length].join('/') : nil
935
+
936
+ { owner: words[0], repo: words[1], release: words[3], path: path }.compact
937
+ end
938
+
939
+ def github_repo_from_url(url)
940
+ github_from_url(url).fetch(:repo, nil)
941
+ end
942
+
943
+ def github_release_from_url(url)
944
+ github_from_url(url).fetch(:release, nil)
945
+ end
946
+
947
+ def github_owner_from_url(url)
948
+ github_from_url(url).fetch(:owner, nil)
949
+ end
950
+
951
+ def github_as_owner_url(url)
952
+ github_hash = github_from_url(url)
953
+ "https://github.com/#{github_hash[:owner]}" if github_hash[:owner].present?
954
+ end
955
+
956
+ def github_as_repo_url(url)
957
+ github_hash = github_from_url(url)
958
+ return unless github_hash[:repo].present?
959
+
960
+ "https://github.com/#{github_hash[:owner]}/#{github_hash[:repo]}"
961
+ end
962
+
963
+ def github_as_release_url(url)
964
+ github_hash = github_from_url(url)
965
+ return unless github_hash[:release].present?
966
+
967
+ "https://github.com/#{github_hash[:owner]}/#{github_hash[:repo]}/tree/#{github_hash[:release]}"
968
+ end
969
+
970
+ def github_as_codemeta_url(url)
971
+ github_hash = github_from_url(url)
972
+
973
+ if github_hash[:path].to_s.end_with?('codemeta.json')
974
+ "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/#{github_hash[:release]}/#{github_hash[:path]}"
975
+ elsif github_hash[:owner].present?
976
+ "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/master/codemeta.json"
977
+ end
978
+ end
979
+
980
+ def github_as_cff_url(url)
981
+ github_hash = github_from_url(url)
982
+
983
+ if github_hash[:path].to_s.end_with?('CITATION.cff')
984
+ "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/#{github_hash[:release]}/#{github_hash[:path]}"
985
+ elsif github_hash[:owner].present?
986
+ "https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/main/CITATION.cff"
987
+ end
988
+ end
989
+
990
+ def get_date_parts(iso8601_time)
991
+ return { 'date-parts' => [[]] } if iso8601_time.nil?
992
+
993
+ year = iso8601_time[0..3].to_i
994
+ month = iso8601_time[5..6].to_i
995
+ day = iso8601_time[8..9].to_i
996
+ { 'date-parts' => [[year, month, day].reject { |part| part == 0 }] }
997
+ rescue TypeError
998
+ nil
999
+ end
1000
+
1001
+ def get_date_from_date_parts(date_as_parts)
1002
+ date_parts = date_as_parts.fetch('date-parts', []).first
1003
+ return nil if date_parts == [nil]
1004
+
1005
+ year = date_parts[0]
1006
+ month = date_parts[1]
1007
+ day = date_parts[2]
1008
+ get_date_from_parts(year, month, day)
1009
+ rescue NoMethodError # if date_parts is nil
1010
+ nil
1011
+ end
1012
+
1013
+ def get_date_from_parts(year, month = nil, day = nil)
1014
+ [year.to_s.rjust(4, '0'), month.to_s.rjust(2, '0'), day.to_s.rjust(2, '0')].reject do |part|
1015
+ part == '00'
1016
+ end.join('-')
1017
+ end
1018
+
1019
+ def get_date_parts_from_parts(year, month = nil, day = nil)
1020
+ { 'date-parts' => [[year.to_i, month.to_i, day.to_i].reject { |part| part == 0 }] }
1021
+ end
1022
+
1023
+ def get_iso8601_date(iso8601_time)
1024
+ return nil if iso8601_time.nil? || iso8601_time.length < 4
1025
+
1026
+ case iso8601_time.length
1027
+ when 4
1028
+ iso8601_time[0..3]
1029
+ when 7
1030
+ iso8601_time[0..6]
1031
+ else
1032
+ iso8601_time[0..9]
1033
+ end
1034
+ end
1035
+
1036
+ def get_year_month(iso8601_time)
1037
+ return [] if iso8601_time.nil?
1038
+
1039
+ year = iso8601_time[0..3]
1040
+ month = iso8601_time[5..6]
1041
+
1042
+ [year.to_i, month.to_i].reject { |part| part == 0 }
1043
+ end
1044
+
1045
+ def get_year_month_day(iso8601_time)
1046
+ return [] if iso8601_time.nil?
1047
+
1048
+ year = iso8601_time[0..3]
1049
+ month = iso8601_time[5..6]
1050
+ day = iso8601_time[8..9]
1051
+
1052
+ [year.to_i, month.to_i, day.to_i].reject { |part| part == 0 }
1053
+ end
1054
+
1055
+ # parsing of incomplete iso8601 timestamps such as 2015-04 is broken
1056
+ # in standard library
1057
+ # return nil if invalid iso8601 timestamp
1058
+ def get_datetime_from_iso8601(iso8601_time)
1059
+ ISO8601::DateTime.new(iso8601_time).to_time.utc
1060
+ rescue StandardError
1061
+ nil
1062
+ end
1063
+
1064
+ # strip milliseconds if there is a time, as it interferes with edtc parsing
1065
+ # keep dates unchanged
1066
+ def strip_milliseconds(iso8601_time)
1067
+ return iso8601_time.split(' ').first if iso8601_time.to_s.include? ' '
1068
+
1069
+ return iso8601_time.split('.').first + 'Z' if iso8601_time.to_s.include? '.'
1070
+
1071
+ iso8601_time
1072
+ end
1073
+
1074
+ # iso8601 datetime without hyphens and colons, used by Crossref
1075
+ # return nil if invalid
1076
+ def get_datetime_from_time(time)
1077
+ DateTime.strptime(time.to_s, '%Y%m%d%H%M%S').strftime('%Y-%m-%dT%H:%M:%SZ')
1078
+ rescue ArgumentError
1079
+ nil
1080
+ end
1081
+
1082
+ def get_date(dates, date_type)
1083
+ dd = Array.wrap(dates).find { |d| d['dateType'] == date_type } || {}
1084
+ dd.fetch('date', nil)
1085
+ end
1086
+
1087
+ # convert commonmeta dates to DataCite format
1088
+ def get_dates_from_date(date)
1089
+ return nil if date.nil?
1090
+
1091
+ mapping = { 'published' => 'issued' }
1092
+
1093
+ date = map_hash_keys(element: date, mapping: mapping)
1094
+
1095
+ date.map do |k, v|
1096
+ { 'date' => v,
1097
+ 'dateType' => k.capitalize }
1098
+ end
1099
+ end
1100
+
1101
+ def get_contributor(contributor, contributor_type)
1102
+ contributor.select { |c| c['contributorType'] == contributor_type }
1103
+ end
1104
+
1105
+ def get_identifier(identifiers, identifier_type)
1106
+ id = Array.wrap(identifiers).find { |i| i['identifierType'] == identifier_type } || {}
1107
+ id.fetch('identifier', nil)
1108
+ end
1109
+
1110
+ def get_identifier_type(identifier_type)
1111
+ return nil unless identifier_type.present?
1112
+
1113
+ identifierTypes = {
1114
+ 'ark' => 'ARK',
1115
+ 'arxiv' => 'arXiv',
1116
+ 'bibcode' => 'bibcode',
1117
+ 'doi' => 'DOI',
1118
+ 'ean13' => 'EAN13',
1119
+ 'eissn' => 'EISSN',
1120
+ 'handle' => 'Handle',
1121
+ 'igsn' => 'IGSN',
1122
+ 'isbn' => 'ISBN',
1123
+ 'issn' => 'ISSN',
1124
+ 'istc' => 'ISTC',
1125
+ 'lissn' => 'LISSN',
1126
+ 'lsid' => 'LSID',
1127
+ 'pmid' => 'PMID',
1128
+ 'purl' => 'PURL',
1129
+ 'upc' => 'UPC',
1130
+ 'url' => 'URL',
1131
+ 'urn' => 'URN',
1132
+ 'md5' => 'md5',
1133
+ 'minid' => 'minid',
1134
+ 'dataguid' => 'dataguid'
1135
+ }
1136
+
1137
+ identifierTypes[identifier_type.downcase] || identifier_type
1138
+ end
1139
+
1140
+ def get_series_information(str)
1141
+ return {} unless str.present?
1142
+
1143
+ str = str.split(',').map(&:strip)
1144
+
1145
+ title = str.first
1146
+ volume_issue = str.length > 2 ? str[1].rpartition(/\(([^)]+)\)/) : nil
1147
+ volume = volume_issue.present? ? volume_issue[0].presence || volume_issue[2].presence : nil
1148
+ issue = volume_issue.present? ? volume_issue[1][1...-1].presence : nil
1149
+ pages = str.length > 1 ? str.last : nil
1150
+ first_page = pages.present? ? pages.split('-').map(&:strip)[0] : nil
1151
+ last_page = pages.present? ? pages.split('-').map(&:strip)[1] : nil
1152
+
1153
+ {
1154
+ 'title' => title,
1155
+ 'volume' => volume,
1156
+ 'issue' => issue,
1157
+ 'firstPage' => first_page,
1158
+ 'lastPage' => last_page
1159
+ }.compact
1160
+ end
1161
+
1162
+ def jsonlint(json)
1163
+ return ['No JSON provided'] unless json.present?
1164
+
1165
+ error_array = []
1166
+ linter = JsonLint::Linter.new
1167
+ linter.send(:check_data, json, error_array)
1168
+ error_array
1169
+ end
1170
+
1171
+ def name_to_spdx(name)
1172
+ spdx = JSON.load(File.read(File.expand_path('../../resources/spdx/licenses.json',
1173
+ __dir__))).fetch('licenses')
1174
+ license = spdx.find do |l|
1175
+ l['name'] == name || l['licenseId'] == name || l['seeAlso'].first == normalize_cc_url(name)
1176
+ end
1177
+
1178
+ if license
1179
+ { 'id' => license['licenseId'], 'url' => license['seeAlso'].first }.compact
1180
+ else
1181
+ { 'rights' => name }
1182
+ end
1183
+ end
1184
+
1185
+ def hsh_to_spdx(hsh)
1186
+ spdx = JSON.load(File.read(File.expand_path('../../resources/spdx/licenses.json',
1187
+ __dir__))).fetch('licenses')
1188
+ hsh['rightsUri'] = hsh.delete('rightsURI') if hsh['rightsUri'].blank?
1189
+ license = spdx.find do |l|
1190
+ 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'])
1191
+ end
1192
+
1193
+ if license
1194
+ { 'id' => license['licenseId'], 'url' => license['seeAlso'].first }.compact
1195
+ else
1196
+ {
1197
+ 'id' => hsh['rightsIdentifier'].present? ? hsh['rightsIdentifier'].downcase : nil,
1198
+ 'url' => hsh['rightsURI'] || hsh['rightsUri']
1199
+ }.compact
1200
+ end
1201
+ end
1202
+
1203
+ def spdx_to_hsh(hsh)
1204
+ return nil unless hsh.present? && hsh.is_a?(Hash)
1205
+
1206
+ spdx = JSON.load(File.read(File.expand_path('../../resources/spdx/licenses.json',
1207
+ __dir__))).fetch('licenses')
1208
+
1209
+ license = spdx.find { |l| l['licenseId'].casecmp?(hsh['id']) }
1210
+
1211
+ if license
1212
+ [{
1213
+ 'rightsIdentifier' => license['licenseId'].downcase,
1214
+ 'rightsUri' => license['seeAlso'].first,
1215
+ 'rights' => license['name'],
1216
+ 'rightsIdentifierScheme' => 'SPDX',
1217
+ 'schemeUri' => 'https://spdx.org/licenses/'
1218
+ }.compact]
1219
+ else
1220
+ [{ 'rightsIdentifier' => hsh['id'], 'rightsURI' => hsh['url'] }.compact]
1221
+ end
1222
+ end
1223
+
1224
+ def name_to_fos(name)
1225
+ # first find subject in Fields of Science (OECD)
1226
+ fos = JSON.load(File.read(File.expand_path('../../resources/oecd/fos-mappings.json',
1227
+ __dir__))).fetch('fosFields')
1228
+
1229
+ subject = fos.find { |l| l['fosLabel'] == name || 'FOS: ' + l['fosLabel'] == name }
1230
+
1231
+ if subject
1232
+ return [{
1233
+ 'subject' => sanitize(name).downcase
1234
+ },
1235
+ {
1236
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1237
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1238
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1239
+ }]
1240
+ end
1241
+
1242
+ # if not found, look in Fields of Research (Australian and New Zealand Standard Research Classification)
1243
+ # and map to Fields of Science. Add an extra entry for the latter
1244
+ fores = JSON.load(File.read(File.expand_path('../../resources/oecd/for-mappings.json',
1245
+ __dir__)))
1246
+ for_fields = fores.fetch('forFields')
1247
+ for_disciplines = fores.fetch('forDisciplines')
1248
+
1249
+ subject = for_fields.find { |l| l['forLabel'] == name } ||
1250
+ for_disciplines.find { |l| l['forLabel'] == name }
1251
+
1252
+ if subject
1253
+ [{
1254
+ 'subject' => sanitize(name).downcase
1255
+ },
1256
+ {
1257
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1258
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1259
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1260
+ }]
1261
+ else
1262
+ [{ 'subject' => sanitize(name).downcase }]
1263
+ end
1264
+ end
1265
+
1266
+ def hsh_to_fos(hsh)
1267
+ # first find subject in Fields of Science (OECD)
1268
+ fos = JSON.load(File.read(File.expand_path('../../resources/oecd/fos-mappings.json',
1269
+ __dir__))).fetch('fosFields')
1270
+ subject = fos.find do |l|
1271
+ l['fosLabel'] == hsh['__content__'] || 'FOS: ' + l['fosLabel'] == hsh['__content__'] || l['fosLabel'] == hsh['subject']
1272
+ end
1273
+
1274
+ if subject
1275
+ return [{
1276
+ 'subject' => sanitize(hsh['__content__'] || hsh['subject']),
1277
+ 'subjectScheme' => hsh['subjectScheme'],
1278
+ 'schemeUri' => hsh['schemeURI'] || hsh['schemeUri'],
1279
+ 'valueUri' => hsh['valueURI'] || hsh['valueUri'],
1280
+ 'classificationCode' => hsh['classificationCode'],
1281
+ 'lang' => hsh['lang']
1282
+ }.compact,
1283
+ {
1284
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1285
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1286
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1287
+ }.compact]
1288
+ end
1289
+
1290
+ # if not found, look in Fields of Research (Australian and New Zealand Standard Research Classification)
1291
+ # and map to Fields of Science. Add an extra entry for the latter
1292
+ fores = JSON.load(File.read(File.expand_path('../../resources/oecd/for-mappings.json',
1293
+ __dir__)))
1294
+ for_fields = fores.fetch('forFields')
1295
+ for_disciplines = fores.fetch('forDisciplines')
1296
+
1297
+ # try to extract forId
1298
+ if hsh['subjectScheme'] == 'FOR'
1299
+ for_id = hsh['__content__'].to_s.split(' ').first || hsh['subject'].to_s.split(' ').first
1300
+ for_id = for_id.rjust(6, '0')
1301
+
1302
+ subject = for_fields.find { |l| l['forId'] == for_id } ||
1303
+ for_disciplines.find { |l| l['forId'] == for_id[0..3] }
1304
+ else
1305
+ subject = for_fields.find do |l|
1306
+ l['forLabel'] == hsh['__content__'] || l['forLabel'] == hsh['subject']
1307
+ end ||
1308
+ for_disciplines.find do |l|
1309
+ l['forLabel'] == hsh['__content__'] || l['forLabel'] == hsh['subject']
1310
+ end
1311
+ end
1312
+
1313
+ if subject
1314
+ [{
1315
+ 'subject' => sanitize(hsh['__content__'] || hsh['subject']),
1316
+ 'subjectScheme' => hsh['subjectScheme'],
1317
+ 'classificationCode' => hsh['classificationCode'],
1318
+ 'schemeUri' => hsh['schemeURI'] || hsh['schemeUri'],
1319
+ 'valueUri' => hsh['valueURI'] || hsh['valueUri'],
1320
+ 'lang' => hsh['lang']
1321
+ }.compact,
1322
+ {
1323
+ 'subject' => 'FOS: ' + subject['fosLabel'],
1324
+ 'subjectScheme' => 'Fields of Science and Technology (FOS)',
1325
+ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf'
1326
+ }]
1327
+ else
1328
+ [{
1329
+ 'subject' => sanitize(hsh['__content__'] || hsh['subject']),
1330
+ 'subjectScheme' => hsh['subjectScheme'],
1331
+ 'classificationCode' => hsh['classificationCode'],
1332
+ 'schemeUri' => hsh['schemeURI'] || hsh['schemeUri'],
1333
+ 'valueUri' => hsh['valueURI'] || hsh['valueUri'],
1334
+ 'lang' => hsh['lang']
1335
+ }.compact]
1336
+ end
1337
+ end
1338
+
1339
+ def encode_doi(prefix)
1340
+ random_int = SecureRandom.random_number(2**63..(2**64) - 1)
1341
+ suffix = Base32::URL.encode(random_int)
1342
+ str = "#{suffix[0, 7]}-#{suffix[6, 7]}"
1343
+ "https://doi.org/#{prefix}/#{str}"
1344
+ end
1345
+
1346
+ def decode_doi(doi)
1347
+ suffix = doi.split('/', 5).last
1348
+ Base32::URL.decode(suffix)
1349
+ end
1350
+ end
1351
+ end