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