bolognese 0.9.56 → 0.9.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +6 -4
- data/README.md +7 -0
- data/bolognese.gemspec +1 -0
- data/lib/bolognese.rb +1 -0
- data/lib/bolognese/metadata.rb +12 -4
- data/lib/bolognese/readers/bibtex_reader.rb +4 -1
- data/lib/bolognese/readers/crossref_reader.rb +60 -34
- data/lib/bolognese/readers/datacite_reader.rb +4 -11
- data/lib/bolognese/readers/ris_reader.rb +2 -1
- data/lib/bolognese/utils.rb +111 -51
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/bibtex_writer.rb +1 -1
- data/lib/bolognese/writers/citeproc_writer.rb +1 -1
- data/lib/bolognese/writers/crosscite_writer.rb +2 -1
- data/lib/bolognese/writers/jats_writer.rb +94 -0
- data/lib/bolognese/writers/ris_writer.rb +2 -1
- data/lib/bolognese/writers/schema_org_writer.rb +2 -1
- data/resources/kernel-4/include/datacite-dateType-v4.1.xsd +1 -1
- data/resources/kernel-4/include/datacite-relationType-v4.1.xsd +1 -1
- data/resources/kernel-4/include/datacite-resourceType-v4.1.xsd +1 -1
- data/resources/kernel-4/metadata.xsd +1 -1
- data/spec/author_utils_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/crossref/default.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/crossref/to_bibtex.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/crossref/to_crossref.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/crossref/to_datacite.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/crossref/to_schema_org.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/default.yml +27 -13
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_bibtex.yml +25 -13
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_citation.yml +17 -17
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_crossref.yml +27 -13
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_datacite.yml +26 -12
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_schema_org.yml +27 -13
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/default.yml +15 -52
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_bibtex.yml +16 -51
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_citation.yml +20 -51
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite.yml +16 -49
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite_json.yml +15 -50
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_schema_org.yml +16 -51
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/default.yml +15 -15
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_bibtex.yml +15 -15
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_datacite.yml +14 -14
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_schema_org.yml +16 -16
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/author.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/no_author.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/single_author.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/with_organization.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/change_datacite_metadata/change_doi.yml +26 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/change_datacite_metadata/change_title.yml +23 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/change_metadata_as_datacite_xml/validates_against_schema.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/change_metadata_as_datacite_xml/with_data_citation.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/not_a_doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/sandbox_url.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/url.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/crossref.yml +35 -31
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/datacite.yml +36 -30
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/medra.yml +35 -31
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/not_a_valid_prefix.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/not_found.yml +27 -27
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/doi_with_protocol.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/dx_doi_org_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/force_test_resolver.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/https_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/test_resolver.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_resolver/test_resolver_http.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/doi_with_protocol.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/dx_doi_org_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/force_test_resolver.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/https_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/test_resolver.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_search/test_resolver_http.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref.yml +39 -86
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +36 -89
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite.yml +40 -85
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite_doi_http.yml +36 -89
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/github.yml +19 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/orcid.yml +21 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/schema_org.yml +22 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/unknown_DOI_registration_agency.yml +31 -82
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/bibtex.yml +20 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/citeproc.yml +21 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/codemeta.yml +23 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crosscite.yml +22 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crossref.yml +22 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite.yml +22 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite_json.yml +21 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/ris.yml +24 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/schema_org.yml +23 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_string/crosscite.yml +20 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/from_schema_org/with_id.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_codemeta_metadata/maremma.yml +10 -10
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_codemeta_metadata/no_codemeta_json.yml +8 -8
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_codemeta_metadata/not_found_error.yml +8 -8
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/DOI_with_ORCID_ID.yml +34 -30
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/DOI_with_SICI_DOI.yml +33 -29
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/DOI_with_data_citation.yml +35 -31
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/book_chapter.yml +150 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/dataset.yml +34 -30
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/date_in_future.yml +33 -31
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/journal_article.yml +33 -31
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/not_found_error.yml +26 -26
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/posted_content.yml +34 -30
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_raw/journal_article.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/BlogPosting.yml +23 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/BlogPosting_in_test_system.yml +22 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/DOI_in_test_system.yml +24 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/DOI_not_found.yml +24 -29
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Dataset.yml +24 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding.yml +22 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding_schema_version_4.yml +20 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_only_full_name.yml +23 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_scheme.yml +26 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_wrong_orcid_scheme.yml +24 -66
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/date.yml +24 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/empty_subject.yml +24 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/funding_schema_version_3.yml +24 -66
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/is_identical_to.yml +24 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/keywords_with_attributes.yml +28 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/leading_and_trailing_whitespace.yml +26 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/multiple_author_names_in_one_creatorName.yml +23 -64
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/multiple_licenses.yml +25 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_from_date_parts/date.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_from_date_parts/year-month.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_from_date_parts/year.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_parts/date.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_parts/year-month.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_parts/year.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifiers/has_ORCID.yml +11 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifiers/has_jacow_org_scheme.yml +13 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifiers/has_multiple_name_identifier.yml +14 -80
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifiers/has_no_ORCID.yml +13 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_familyName.yml +11 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_multiple_names_in_display-order.yml +7 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_Thai.yml +12 -80
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_display-order.yml +12 -78
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml +13 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_sort-order.yml +12 -80
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/hyper-authorship.yml +9 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/is_organization.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/multiple_author_names_in_one_field.yml +9 -79
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/multiple_name_identifier.yml +13 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_affiliation.yml +14 -45
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_role.yml +14 -45
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/BlogPosting.yml +19 -19
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/BlogPosting_with_new_DOI.yml +20 -20
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/not_found_error.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml +17 -23
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/unknown_DOI_prefix.yml +8 -22
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_alternate_identifiers/insert.yml +6 -41
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors/none.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_creators/insert.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates/insert.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_descriptions/insert.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_identifier/doi.yml +6 -41
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_person/creator_only_name.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_publication_year/insert.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_publisher/insert.yml +6 -41
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers/insert.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers/related_identifier.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type/insert.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_rights_list/insert.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_subjects/insert.yml +5 -42
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_titles/insert.yml +6 -41
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_version/insert.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_comma.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_family_name.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_id.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_known_given_name.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_no_info.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_type_organization.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/missing_comma.yml +19 -62
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/nil.yml +22 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/overlapping_keys.yml +20 -65
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/valid.yml +22 -63
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/SICI_doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_force_datacite_sandbox.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_from_datacite_sandbox.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_from_url_without_doi_proxy.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_prefix_too_long.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_prefix_with_string.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_with_protocol.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/dx_doi_org_url.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/https_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/not_valid_doi_prefix.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/url_with_one_slash.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/doi_as_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/ftp.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/invalid_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/sandbox_via_options.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/sandbox_via_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/string.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/url.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/url_with_utf-8.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_ids/doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_ids/url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_url/uri.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_url/with_trailing_slash.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/array.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/array_of_strings.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/first.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/hash.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/nil.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/string.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/sanitize/should_only_keep_specific_tags.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/sanitize/should_remove_a_tags.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/to_schema_org/with_id.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_https.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_id.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_with_spaces.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_wrong_id.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid/validate_orcid_www.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid_scheme/validate_orcid_scheme.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid_scheme/validate_orcid_scheme_https.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid_scheme/validate_orcid_scheme_trailing_slash.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_orcid_scheme/validate_orcid_scheme_www.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_prefix/doi.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_prefix/doi_as_url.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_prefix/doi_with_protocol.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_prefix/only_prefix.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/DOI.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/ISSN.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/URL.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/string.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/BlogPosting.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/Dataset.yml +5 -42
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/from_schema_org.yml +20 -20
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/maremma.yml +11 -11
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/text.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/with_data_citation.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/with_pages.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/Dataset.yml +8 -43
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/Journal_article.yml +10 -10
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/Journal_article_vancouver_style.yml +12 -12
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/BlogPosting.yml +4 -39
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/BlogPosting_schema_org.yml +19 -19
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/Dataset.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/container_title.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/journal_article.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/maremma.yml +10 -10
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/multiple_abstracts.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/software.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/with_pages.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/datacite_database_attributes.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/maremma.yml +8 -8
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/with_ORCID_ID.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/with_data_citation.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/with_data_citation_schema_org.yml +19 -19
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crossref/from_DataCite.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crossref/journal_article.yml +9 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/maremma.yml +9 -9
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/with_ORCID_ID.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/with_data_citation.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/with_data_citation_schema_org.yml +19 -19
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/Dataset_in_schema_4_0.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/Text_pass-thru.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/maremma.yml +9 -9
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/with_ORCID_ID.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/with_data_citation.yml +19 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/with_data_citation_schema_org.yml +20 -20
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/with_editor.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/Dataset_in_schema_4_0.yml +38 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/Text_pass-thru.yml +40 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/book_chapter.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/maremma.yml +73 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/with_ORCID_ID.yml +79 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/with_data_citation.yml +79 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/with_data_citation_schema_org.yml +121 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/with_editor.yml +79 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/BlogPosting.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/BlogPosting_schema_org.yml +19 -19
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/Dataset.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/alternate_name.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/journal_article.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/maremma.yml +10 -10
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/with_pages.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Funding.yml +5 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Funding_OpenAIRE.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Schema_org_JSON.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Schema_org_JSON_IsSupplementTo.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Schema_org_JSON_isReferencedBy.yml +7 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/journal_article.yml +18 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/maremma_schema_org_JSON.yml +11 -11
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/BlogPosting.yml +101 -80
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/BlogPosting_Citeproc_JSON.yml +94 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/BlogPosting_DataCite_JSON.yml +94 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/Crossref_DOI.yml +94 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/DataONE.yml +94 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/Dataset.yml +99 -80
- data/spec/readers/crossref_reader_spec.rb +32 -20
- data/spec/readers/datacite_reader_spec.rb +0 -4
- data/spec/writers/bibtex_writer_spec.rb +1 -1
- data/spec/writers/citation_writer_spec.rb +1 -1
- data/spec/writers/crosscite_writer_spec.rb +4 -4
- data/spec/writers/datacite_json_writer_spec.rb +3 -3
- data/spec/writers/datacite_writer_spec.rb +4 -4
- data/spec/writers/jats_writer_spec.rb +173 -0
- data/spec/writers/ris_writer_spec.rb +19 -21
- data/spec/writers/schema_org_writer_spec.rb +2 -6
- metadata +27 -12
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/datacite/default.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/datacite/to_bibtex.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/datacite/to_datacite.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/datacite/to_datacite_invalid.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_file/datacite/to_schema_org.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/BlogPosting_from_string.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Schema_4_1_from_string.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Schema_4_1_from_string_with_doi_in_options.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/missing_creator.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_raw/BlogPosting.yml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 325e7c67f90b425a1498add3572540a3f5172e46
|
4
|
+
data.tar.gz: 43d1bc36ba1a0a9135349e5d4189ab2bb2387b79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd66c9e2b9b6f4966f7daa4c620664faf66310a770d7229714ebc294681f1d906dd776150ecf919cb805926deb9901f0ada550c2fe03ec7cf48707e1b049572e
|
7
|
+
data.tar.gz: a7ace8155d4e47908d867f7dca076f8de4de90f96a20b3479db8ee16d3a5b32d401a1f3359d3f8c7cd0afff9a3d0032c843d16b4bb5282bad034b1f86cf9b157
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (0.9.
|
4
|
+
bolognese (0.9.58)
|
5
5
|
activesupport (>= 4.2.5, < 6)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (~> 4.1)
|
8
8
|
builder (~> 3.2, >= 3.2.2)
|
9
9
|
colorize (~> 0.8.1)
|
10
10
|
gender_detector (~> 0.1.2)
|
11
|
+
iso8601 (~> 0.9.1)
|
11
12
|
json-ld (~> 2.1, >= 2.1.2)
|
12
13
|
jsonlint (~> 0.2.0)
|
13
14
|
loofah (~> 2.0, >= 2.0.3)
|
@@ -64,6 +65,7 @@ GEM
|
|
64
65
|
htmlentities (4.3.4)
|
65
66
|
i18n (0.9.0)
|
66
67
|
concurrent-ruby (~> 1.0)
|
68
|
+
iso8601 (0.9.1)
|
67
69
|
json (2.1.0)
|
68
70
|
json-ld (2.1.7)
|
69
71
|
multi_json (~> 1.12)
|
@@ -104,7 +106,7 @@ GEM
|
|
104
106
|
rack (2.0.3)
|
105
107
|
rack-test (0.7.0)
|
106
108
|
rack (>= 1.0, < 3)
|
107
|
-
rake (12.1
|
109
|
+
rake (12.2.1)
|
108
110
|
rdf (2.2.11)
|
109
111
|
hamster (~> 3.0)
|
110
112
|
link_header (~> 0.0, >= 0.0.8)
|
@@ -155,7 +157,7 @@ GEM
|
|
155
157
|
thread_safe (0.3.6)
|
156
158
|
tilt (2.0.8)
|
157
159
|
trollop (2.1.2)
|
158
|
-
tzinfo (1.2.
|
160
|
+
tzinfo (1.2.4)
|
159
161
|
thread_safe (~> 0.1)
|
160
162
|
unicode (0.4.4.4)
|
161
163
|
unicode_utils (1.4.0)
|
@@ -181,4 +183,4 @@ DEPENDENCIES
|
|
181
183
|
webmock (~> 3.0, >= 3.0.1)
|
182
184
|
|
183
185
|
BUNDLED WITH
|
184
|
-
1.15.
|
186
|
+
1.15.4
|
data/README.md
CHANGED
@@ -79,6 +79,13 @@ Bolognese reads and/or writes these metadata formats:
|
|
79
79
|
<td>Yes</td>
|
80
80
|
<td>Yes</td>
|
81
81
|
</tr>
|
82
|
+
<tr>
|
83
|
+
<td><a href='https://jats.nlm.nih.gov/'>JATS</a></td>
|
84
|
+
<td>jats</td>
|
85
|
+
<td>application/vnd.jats+xml</td>
|
86
|
+
<td>No</td>
|
87
|
+
<td>Yes</td>
|
88
|
+
</tr>
|
82
89
|
<tr>
|
83
90
|
<td><a href='http://en.wikipedia.org/wiki/BibTeX'>BibTeX</a></td>
|
84
91
|
<td>bibtex</td>
|
data/bolognese.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency 'thor', '~> 0.19'
|
25
25
|
s.add_dependency 'colorize', '~> 0.8.1'
|
26
26
|
s.add_dependency 'namae', '~> 0.11.3'
|
27
|
+
s.add_dependency 'iso8601', '~> 0.9.1'
|
27
28
|
s.add_dependency 'postrank-uri', '~> 1.0', '>= 1.0.18'
|
28
29
|
s.add_dependency 'json-ld', '~> 2.1', '>= 2.1.2'
|
29
30
|
s.add_dependency 'jsonlint', '~> 0.2.0'
|
data/lib/bolognese.rb
CHANGED
data/lib/bolognese/metadata.rb
CHANGED
@@ -22,6 +22,7 @@ require_relative 'writers/crosscite_writer'
|
|
22
22
|
require_relative 'writers/crossref_writer'
|
23
23
|
require_relative 'writers/datacite_writer'
|
24
24
|
require_relative 'writers/datacite_json_writer'
|
25
|
+
require_relative 'writers/jats_writer'
|
25
26
|
require_relative 'writers/rdf_xml_writer'
|
26
27
|
require_relative 'writers/ris_writer'
|
27
28
|
require_relative 'writers/schema_org_writer'
|
@@ -54,6 +55,7 @@ module Bolognese
|
|
54
55
|
include Bolognese::Writers::CrossrefWriter
|
55
56
|
include Bolognese::Writers::DataciteWriter
|
56
57
|
include Bolognese::Writers::DataciteJsonWriter
|
58
|
+
include Bolognese::Writers::JatsWriter
|
57
59
|
include Bolognese::Writers::RdfXmlWriter
|
58
60
|
include Bolognese::Writers::RisWriter
|
59
61
|
include Bolognese::Writers::SchemaOrgWriter
|
@@ -63,7 +65,7 @@ module Bolognese
|
|
63
65
|
:date_accepted, :date_available, :date_copyrighted, :date_collected,
|
64
66
|
:date_submitted, :date_valid, :date_created, :date_modified,
|
65
67
|
:date_registered, :date_updated, :provider_id, :client_id, :journal,
|
66
|
-
:volume, :issue, :
|
68
|
+
:volume, :issue, :first_page, :last_page, :url, :version, :keywords, :editor,
|
67
69
|
:description, :alternate_name, :language, :content_size, :spatial_coverage,
|
68
70
|
:schema_version, :additional_type, :has_part, :same_as,
|
69
71
|
:is_previous_version_of, :is_new_version_of, :is_cited_by, :cites,
|
@@ -97,7 +99,8 @@ module Bolognese
|
|
97
99
|
exit 1
|
98
100
|
end
|
99
101
|
else
|
100
|
-
hsh = { "
|
102
|
+
hsh = { "url" => options[:url],
|
103
|
+
"date_registered" => options[:date_registered],
|
101
104
|
"date_updated" => options[:date_updated],
|
102
105
|
"provider_id" => options[:provider_id],
|
103
106
|
"client_id" => options[:client_id] }
|
@@ -111,6 +114,7 @@ module Bolognese
|
|
111
114
|
|
112
115
|
@should_passthru = (@from == "datacite") && !regenerate
|
113
116
|
|
117
|
+
@url = hsh.to_h["url"].presence
|
114
118
|
@date_registered = hsh.to_h["date_registered"].presence
|
115
119
|
@date_updated = hsh.to_h["date_updated"].presence
|
116
120
|
@provider_id = hsh.to_h["provider_id"].presence
|
@@ -243,8 +247,12 @@ module Bolognese
|
|
243
247
|
@volume ||= metadata.fetch("volume", nil)
|
244
248
|
end
|
245
249
|
|
246
|
-
def
|
247
|
-
@
|
250
|
+
def first_page
|
251
|
+
@first_page ||= metadata.fetch("first_page", nil)
|
252
|
+
end
|
253
|
+
|
254
|
+
def last_page
|
255
|
+
@last_page ||= metadata.fetch("last_page", nil)
|
248
256
|
end
|
249
257
|
|
250
258
|
def description
|
@@ -43,6 +43,8 @@ module Bolognese
|
|
43
43
|
nil
|
44
44
|
end
|
45
45
|
|
46
|
+
page_first, page_last = meta.pages.to_s.split("-")
|
47
|
+
|
46
48
|
{ "id" => normalize_doi(doi),
|
47
49
|
"type" => type,
|
48
50
|
"citeproc_type" => BIB_TO_CP_TRANSLATIONS[meta.type.to_s] || "misc",
|
@@ -56,7 +58,8 @@ module Bolognese
|
|
56
58
|
"is_part_of" => is_part_of,
|
57
59
|
"date_published" => meta.date.to_s.presence,
|
58
60
|
"volume" => meta.volume.to_s.presence,
|
59
|
-
"
|
61
|
+
"page_first" => page_first,
|
62
|
+
"page_last" => page_last,
|
60
63
|
"description" => { "text" => meta.field?(:abstract) && sanitize(meta.abstract.to_s).presence },
|
61
64
|
"license" => { "id" => meta.field?(:copyright) && meta.copyright.to_s.presence }
|
62
65
|
}
|
@@ -84,20 +84,48 @@ module Bolognese
|
|
84
84
|
|
85
85
|
return meta unless meta["crossref"].present?
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
program_metadata =
|
93
|
-
|
94
|
-
journal_issue =
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
87
|
+
# model should be one of book, conference, database, dissertation, journal, peer_review, posted_content,
|
88
|
+
# report-paper, sa_component, standard
|
89
|
+
model = meta.dig("crossref").keys.first
|
90
|
+
|
91
|
+
additional_type = nil
|
92
|
+
program_metadata = {}
|
93
|
+
journal_metadata = nil
|
94
|
+
journal_issue = {}
|
95
|
+
publisher = nil
|
96
|
+
|
97
|
+
case model
|
98
|
+
when "book"
|
99
|
+
book_metadata = meta.dig("crossref", "book", "book_metadata")
|
100
|
+
book_series_metadata = meta.dig("crossref", "book", "book_series_metadata")
|
101
|
+
book_set_metadata = meta.dig("crossref", "book", "book_set_metadata")
|
102
|
+
bibliographic_metadata = meta.dig("crossref", "book", "content_item")
|
103
|
+
additional_type = bibliographic_metadata.fetch("component_type", nil) ? "book-" + bibliographic_metadata.fetch("component_type") : "book"
|
104
|
+
publisher = book_metadata.dig("publisher", "publisher_name")
|
105
|
+
when "conference"
|
106
|
+
event_metadata = meta.dig("crossref", "conference", "event_metadata")
|
107
|
+
bibliographic_metadata = meta.dig("crossref", "conference", "conference_paper")
|
108
|
+
when "journal"
|
109
|
+
journal_metadata = meta.dig("crossref", "journal", "journal_metadata")
|
110
|
+
bibliographic_metadata = meta.dig("crossref", "journal", "journal_article")
|
111
|
+
program_metadata = bibliographic_metadata.dig("crossmark", "custom_metadata", "program") || bibliographic_metadata.dig("program")
|
112
|
+
journal_issue = meta.dig("crossref", "journal", "journal_issue")
|
113
|
+
journal_article = meta.dig("crossref", "journal", "journal_article")
|
114
|
+
|
115
|
+
additional_type = if journal_article.present?
|
116
|
+
"journal_article"
|
117
|
+
elsif journal_issue.present?
|
118
|
+
"journal_issue"
|
119
|
+
else
|
120
|
+
"journal"
|
121
|
+
end
|
122
|
+
when "posted_content"
|
123
|
+
bibliographic_metadata = meta.dig("crossref", "posted_content")
|
124
|
+
when "sa_component"
|
125
|
+
bibliographic_metadata = meta.dig("crossref", "sa_component", "component_list", "component")
|
126
|
+
end
|
127
|
+
|
128
|
+
additional_type = (additional_type || model).underscore.camelize
|
101
129
|
type = CR_TO_SO_TRANSLATIONS[additional_type] || "ScholarlyArticle"
|
102
130
|
doi = bibliographic_metadata.dig("doi_data", "doi").to_s.downcase
|
103
131
|
|
@@ -105,16 +133,6 @@ module Bolognese
|
|
105
133
|
Time.zone = 'Eastern Time (US & Canada)'
|
106
134
|
date_modified = Time.zone.parse(meta.fetch("timestamp", "")).utc.iso8601
|
107
135
|
|
108
|
-
prefix = validate_prefix(doi)
|
109
|
-
if prefix.present?
|
110
|
-
prefix_url = "http://api.crossref.org/prefixes/#{prefix}"
|
111
|
-
response = Maremma.get(prefix_url, host: true)
|
112
|
-
publisher = response.body.dig("data", "message", "name")
|
113
|
-
else
|
114
|
-
publisher = nil
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
136
|
{ "id" => normalize_doi(doi),
|
119
137
|
"type" => type,
|
120
138
|
"additional_type" => additional_type,
|
@@ -137,7 +155,8 @@ module Bolognese
|
|
137
155
|
"date_modified" => date_modified,
|
138
156
|
"volume" => journal_issue.dig("journal_volume", "volume"),
|
139
157
|
"issue" => journal_issue.dig("issue"),
|
140
|
-
"
|
158
|
+
"first_page" => bibliographic_metadata.dig("pages", "first_page"),
|
159
|
+
"last_page" => bibliographic_metadata.dig("pages", "last_page"),
|
141
160
|
"description" => crossref_description(bibliographic_metadata),
|
142
161
|
"license" => crossref_license(program_metadata),
|
143
162
|
"version" => nil,
|
@@ -157,12 +176,19 @@ module Bolognese
|
|
157
176
|
end
|
158
177
|
|
159
178
|
def crossref_description(bibliographic_metadata)
|
160
|
-
|
161
|
-
|
162
|
-
sanitize(des.fetch("__content__", nil))
|
163
|
-
elsif des.is_a?(String)
|
164
|
-
sanitize(des)
|
179
|
+
abstract = Array.wrap(bibliographic_metadata.dig("abstract")).map do |r|
|
180
|
+
{ "type" => "Abstract", "text" => sanitize(parse_attributes(r, content: 'p')) }.compact
|
165
181
|
end
|
182
|
+
|
183
|
+
description = Array.wrap(bibliographic_metadata.dig("description")).map do |r|
|
184
|
+
if abstract.present?
|
185
|
+
{ "text" => sanitize(parse_attributes(r)) }.compact
|
186
|
+
else
|
187
|
+
sanitize(parse_attributes(r))
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
(abstract + description).unwrap
|
166
192
|
end
|
167
193
|
|
168
194
|
def crossref_license(program_metadata)
|
@@ -232,11 +258,11 @@ module Bolognese
|
|
232
258
|
end
|
233
259
|
end
|
234
260
|
|
235
|
-
def crossref_is_part_of(
|
236
|
-
if
|
261
|
+
def crossref_is_part_of(model_metadata)
|
262
|
+
if model_metadata.present?
|
237
263
|
{ "type" => "Periodical",
|
238
|
-
"title" =>
|
239
|
-
"issn" => parse_attributes(
|
264
|
+
"title" => model_metadata["full_title"],
|
265
|
+
"issn" => parse_attributes(model_metadata.fetch("issn", nil), first: true) }.compact
|
240
266
|
else
|
241
267
|
nil
|
242
268
|
end
|
@@ -6,9 +6,9 @@ module Bolognese
|
|
6
6
|
|
7
7
|
doi = doi_from_url(id)
|
8
8
|
search_url = doi_search(id, options)
|
9
|
-
|
9
|
+
search_url += "?q=doi:#{doi}&fl=doi,url,xml,allocator_symbol,datacentre_symbol,media,minted,updated&wt=json"
|
10
10
|
|
11
|
-
response = Maremma.get
|
11
|
+
response = Maremma.get search_url
|
12
12
|
attributes = response.body.dig("data", "response", "docs").first
|
13
13
|
return nil unless attributes.present?
|
14
14
|
|
@@ -30,6 +30,7 @@ module Bolognese
|
|
30
30
|
end
|
31
31
|
|
32
32
|
{ "string" => string,
|
33
|
+
"url" => attributes.fetch("url", nil),
|
33
34
|
"date_registered" => attributes.fetch("minted", nil),
|
34
35
|
"date_updated" => attributes.fetch("updated", nil),
|
35
36
|
"provider_id" => attributes.fetch("allocator_symbol", nil),
|
@@ -56,14 +57,6 @@ module Bolognese
|
|
56
57
|
end
|
57
58
|
|
58
59
|
doi = doi_from_url(id)
|
59
|
-
|
60
|
-
if options[:url]
|
61
|
-
url = options[:url]
|
62
|
-
else
|
63
|
-
response = Maremma.head(id, limit: 0)
|
64
|
-
url = response.headers.present? ? response.headers["location"] : nil
|
65
|
-
end
|
66
|
-
|
67
60
|
resource_type_general = meta.dig("resourceType", "resourceTypeGeneral")
|
68
61
|
type = Bolognese::Utils::DC_TO_SO_TRANSLATIONS[resource_type_general.to_s.dasherize] || "CreativeWork"
|
69
62
|
title = Array.wrap(meta.dig("titles", "title")).map do |r|
|
@@ -106,7 +99,7 @@ module Bolognese
|
|
106
99
|
"ris_type" => Bolognese::Utils::DC_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN",
|
107
100
|
"resource_type_general" => resource_type_general,
|
108
101
|
"doi" => doi,
|
109
|
-
"url" => url,
|
102
|
+
"url" => options.fetch(:url, nil),
|
110
103
|
"title" => title,
|
111
104
|
"alternate_name" => alternate_name,
|
112
105
|
"author" => get_authors(meta.dig("creators", "creator")),
|
@@ -65,7 +65,8 @@ module Bolognese
|
|
65
65
|
"description" => meta.fetch("AB", nil).present? ? { "text" => sanitize(meta.fetch("AB")) } : nil,
|
66
66
|
"volume" => meta.fetch("VL", nil),
|
67
67
|
"issue" => meta.fetch("IS", nil),
|
68
|
-
"
|
68
|
+
"first_page" => meta.fetch("SP", nil),
|
69
|
+
"last_page" => meta.fetch("EP", nil),
|
69
70
|
"keywords" => meta.fetch("KW", nil),
|
70
71
|
"language" => meta.fetch("LA", nil)
|
71
72
|
}
|
data/lib/bolognese/utils.rb
CHANGED
@@ -43,31 +43,59 @@ module Bolognese
|
|
43
43
|
}
|
44
44
|
|
45
45
|
CR_TO_CP_TRANSLATIONS = {
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"
|
46
|
+
"Proceedings" => nil,
|
47
|
+
"ReferenceBook" => nil,
|
48
|
+
"JournalIssue" => nil,
|
49
|
+
"ProceedingsArticle" => "paper-conference",
|
50
|
+
"Other" => nil,
|
51
|
+
"Dissertation" => "thesis",
|
52
|
+
"Dataset" => "dataset",
|
53
|
+
"EditedBook" => "book",
|
54
|
+
"JournalArticle" => "article-journal",
|
55
|
+
"Journal" => nil,
|
56
|
+
"Report" => "report",
|
57
|
+
"BookSeries" => nil,
|
58
|
+
"ReportSeries" => nil,
|
59
|
+
"BookTrack" => nil,
|
60
|
+
"Standard" => nil,
|
61
|
+
"BookSection" => "chapter",
|
62
|
+
"BookPart" => nil,
|
63
|
+
"Book" => "book",
|
64
|
+
"BookChapter" => "chapter",
|
65
|
+
"StandardSeries" => nil,
|
66
|
+
"Monograph" => "book",
|
67
|
+
"Component" => nil,
|
68
|
+
"ReferenceEntry" => "entry-dictionary",
|
69
|
+
"JournalVolume" => nil,
|
70
|
+
"BookSet" => nil
|
71
|
+
}
|
72
|
+
|
73
|
+
CR_TO_JATS_TRANSLATIONS = {
|
74
|
+
"Proceedings" => "working-paper",
|
75
|
+
"ReferenceBook" => "book",
|
76
|
+
"JournalIssue" => "journal",
|
77
|
+
"ProceedingsArticle" => "working-paper",
|
78
|
+
"Other" => nil,
|
79
|
+
"Dissertation" => nil,
|
80
|
+
"Dataset" => "data",
|
81
|
+
"EditedBook" => "book",
|
82
|
+
"JournalArticle" => "journal",
|
83
|
+
"Journal" => "journal",
|
84
|
+
"Report" => "report",
|
85
|
+
"BookSeries" => "book",
|
86
|
+
"ReportSeries" => "report",
|
87
|
+
"BookTrack" => "book",
|
88
|
+
"Standard" => "standard",
|
89
|
+
"BookSection" => "book",
|
90
|
+
"BookPart" => "book",
|
91
|
+
"Book" => "book",
|
92
|
+
"BookChapter" => "book",
|
93
|
+
"StandardSeries" => "standard",
|
94
|
+
"Monograph" => "book",
|
95
|
+
"Component" => nil,
|
96
|
+
"ReferenceEntry" => nil,
|
97
|
+
"JournalVolume" => "journal",
|
98
|
+
"BookSet" => "book"
|
71
99
|
}
|
72
100
|
|
73
101
|
SO_TO_DC_TRANSLATIONS = {
|
@@ -75,6 +103,7 @@ module Bolognese
|
|
75
103
|
"AudioObject" => "Sound",
|
76
104
|
"Blog" => "Text",
|
77
105
|
"BlogPosting" => "Text",
|
106
|
+
"Chapter" => "Text",
|
78
107
|
"Collection" => "Collection",
|
79
108
|
"CreativeWork" => "Other",
|
80
109
|
"DataCatalog" => "Dataset",
|
@@ -91,6 +120,27 @@ module Bolognese
|
|
91
120
|
"WebSite" => "Text"
|
92
121
|
}
|
93
122
|
|
123
|
+
SO_TO_JATS_TRANSLATIONS = {
|
124
|
+
"Article" => "journal",
|
125
|
+
"AudioObject" => nil,
|
126
|
+
"Blog" => nil,
|
127
|
+
"BlogPosting" => nil,
|
128
|
+
"Collection" => nil,
|
129
|
+
"CreativeWork" => nil,
|
130
|
+
"DataCatalog" => "data",
|
131
|
+
"Dataset" => "data",
|
132
|
+
"Event" => nil,
|
133
|
+
"ImageObject" => nil,
|
134
|
+
"Movie" => nil,
|
135
|
+
"PublicationIssue" => "journal",
|
136
|
+
"ScholarlyArticle" => "journal",
|
137
|
+
"Service" => nil,
|
138
|
+
"SoftwareSourceCode" => "software",
|
139
|
+
"VideoObject" => nil,
|
140
|
+
"WebPage" => nil,
|
141
|
+
"WebSite" => "website"
|
142
|
+
}
|
143
|
+
|
94
144
|
SO_TO_CP_TRANSLATIONS = {
|
95
145
|
"Article" => "",
|
96
146
|
"AudioObject" => "song",
|
@@ -133,31 +183,31 @@ module Bolognese
|
|
133
183
|
}
|
134
184
|
|
135
185
|
CR_TO_RIS_TRANSLATIONS = {
|
136
|
-
"
|
137
|
-
"
|
138
|
-
"
|
139
|
-
"
|
140
|
-
"
|
141
|
-
"
|
142
|
-
"
|
143
|
-
"
|
144
|
-
"
|
145
|
-
"
|
146
|
-
"
|
147
|
-
"
|
148
|
-
"
|
149
|
-
"
|
150
|
-
"
|
151
|
-
"
|
152
|
-
"
|
153
|
-
"
|
154
|
-
"
|
155
|
-
"
|
156
|
-
"
|
157
|
-
"
|
158
|
-
"
|
159
|
-
"
|
160
|
-
"
|
186
|
+
"Proceedings" => "CONF",
|
187
|
+
"ReferenceBook" => "BOOK",
|
188
|
+
"JournalIssue" => nil,
|
189
|
+
"ProceedingsArticle" => "CPAPER",
|
190
|
+
"Other" => "GEN",
|
191
|
+
"Dissertation" => "THES",
|
192
|
+
"Dataset" => "DATA",
|
193
|
+
"EditedBook" => "BOOK",
|
194
|
+
"JournalArticle" => "JOUR",
|
195
|
+
"Journal" => nil,
|
196
|
+
"Report" => nil,
|
197
|
+
"BookSeries" => nil,
|
198
|
+
"ReportSeries" => nil,
|
199
|
+
"BookTrack" => nil,
|
200
|
+
"Standard" => nil,
|
201
|
+
"BookSection" => "CHAP",
|
202
|
+
"BookPart" => "CHAP",
|
203
|
+
"Book" => "BOOK",
|
204
|
+
"BookChapter" => "CHAP",
|
205
|
+
"StandardSeries" => nil,
|
206
|
+
"Monograph" => "BOOK",
|
207
|
+
"Component" => nil,
|
208
|
+
"ReferenceEntry" => "DICT",
|
209
|
+
"JournalVolume" => nil,
|
210
|
+
"BookSet" => nil
|
161
211
|
}
|
162
212
|
|
163
213
|
DC_TO_RIS_TRANSLATIONS = {
|
@@ -450,9 +500,19 @@ module Bolognese
|
|
450
500
|
|
451
501
|
def sanitize(text, options={})
|
452
502
|
options[:tags] ||= Set.new(%w(strong em b i code pre sub sup br))
|
503
|
+
content = options[:content] || "__content__"
|
453
504
|
custom_scrubber = Bolognese::WhitelistScrubber.new(options)
|
454
505
|
|
455
|
-
|
506
|
+
if text.is_a?(String)
|
507
|
+
Loofah.scrub_fragment(text, custom_scrubber).to_s.gsub(/\u00a0/, ' ').strip
|
508
|
+
elsif text.is_a?(Hash)
|
509
|
+
sanitize(text.fetch(content, nil))
|
510
|
+
elsif text.is_a?(Array)
|
511
|
+
a = text.map { |e| e.is_a?(Hash) ? sanitize(e.fetch(content, nil)) : sanitize(e) }.uniq
|
512
|
+
a = options[:first] ? a.first : a.unwrap
|
513
|
+
else
|
514
|
+
nil
|
515
|
+
end
|
456
516
|
end
|
457
517
|
|
458
518
|
def github_from_url(url)
|