bolognese 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- data/README.md +9 -0
- data/lib/bolognese.rb +0 -8
- data/lib/bolognese/array.rb +2 -2
- data/lib/bolognese/author_utils.rb +18 -6
- data/lib/bolognese/cli.rb +2 -17
- data/lib/bolognese/datacite_utils.rb +8 -7
- data/lib/bolognese/metadata.rb +291 -178
- data/lib/bolognese/readers/bibtex_reader.rb +66 -0
- data/lib/bolognese/readers/citeproc_reader.rb +74 -0
- data/lib/bolognese/readers/codemeta_reader.rb +71 -0
- data/lib/bolognese/readers/crosscite_reader.rb +12 -0
- data/lib/bolognese/readers/crossref_reader.rb +209 -0
- data/lib/bolognese/readers/datacite_json_reader.rb +75 -0
- data/lib/bolognese/readers/datacite_reader.rb +181 -0
- data/lib/bolognese/readers/ris_reader.rb +84 -0
- data/lib/bolognese/readers/schema_org_reader.rb +119 -0
- data/lib/bolognese/utils.rb +42 -67
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/bibtex_writer.rb +25 -0
- data/lib/bolognese/writers/citeproc_writer.rb +29 -0
- data/lib/bolognese/writers/codemeta_writer.rb +25 -0
- data/lib/bolognese/writers/crosscite_writer.rb +49 -0
- data/lib/bolognese/writers/crossref_writer.rb +9 -0
- data/lib/bolognese/writers/datacite_json_writer.rb +45 -0
- data/lib/bolognese/writers/datacite_writer.rb +10 -0
- data/lib/bolognese/writers/rdf_xml_writer.rb +9 -0
- data/lib/bolognese/writers/ris_writer.rb +26 -0
- data/lib/bolognese/writers/schema_org_writer.rb +45 -0
- data/lib/bolognese/writers/turtle_writer.rb +9 -0
- data/spec/author_utils_spec.rb +74 -34
- data/spec/cli_spec.rb +6 -6
- data/spec/datacite_utils_spec.rb +10 -11
- data/spec/doi_utils_spec.rb +2 -1
- data/spec/fixtures/crossref.ris +2 -1
- data/spec/fixtures/datacite.json +6 -9
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/default.yml +9 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_bibtex.yml +9 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_crossref.yml +6 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_datacite.yml +6 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_schema_org.yml +8 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/default.yml +10 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_bibtex.yml +8 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite.yml +11 -7
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite_json.yml +10 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_schema_org.yml +10 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/default.yml +201 -200
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_bibtex.yml +201 -200
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_datacite.yml +201 -200
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_schema_org.yml +201 -200
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/is_personal_name_/has_type_organization.yml → Bolognese_Metadata/authors_as_string/author.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/authors_as_string/single_author.yml → Bolognese_Metadata/authors_as_string/no_author.yml} +60 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/single_author.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/authors_as_string/with_organization.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/doi.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/not_a_doi.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_from_url/url.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/crossref.yml +204 -6
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/datacite.yml +204 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/medra.yml +204 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/not_a_valid_prefix.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/doi_registration_agency/not_found.yml +204 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref.yml +102 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +100 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite.yml +102 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite_doi_http.yml +100 -4
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/github.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/orcid.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_name_identifier/has_ORCID.yml → Bolognese_Metadata/find_from_format_by_ID/schema_org.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/bibtex.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/citeproc.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_one_author/has_familyName.yml → Bolognese_Metadata/find_from_format_from_file/codemeta.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/crossref.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/datacite_json.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/ris.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_from_file/schema_org.yml +97 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/is_personal_name_/has_no_info.yml → Bolognese_Metadata/from_schema_org/with_id.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata → Bolognese_Metadata/get_codemeta_metadata}/maremma.yml +9 -9
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata → Bolognese_Metadata/get_codemeta_metadata}/no_codemeta_json.yml +8 -8
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata → Bolognese_Metadata/get_codemeta_metadata}/not_found_error.yml +8 -8
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata → Bolognese_Metadata/get_crossref_metadata}/DOI_with_ORCID_ID.yml +61 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata → Bolognese_Metadata/get_crossref_metadata}/DOI_with_SICI_DOI.yml +62 -3
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata → Bolognese_Metadata/get_crossref_metadata}/DOI_with_data_citation.yml +61 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata → Bolognese_Metadata/get_crossref_metadata}/date_in_future.yml +61 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata → Bolognese_Metadata/get_crossref_metadata}/journal_article.yml +62 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/not_found_error.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/posted_content.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/BlogPosting.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Dataset.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/Funding_schema_version_4.yml +97 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Datacite/get_metadata → Bolognese_Metadata/get_datacite_metadata}/author_only_full_name.yml +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/author_with_scheme.yml +97 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_name_identifier/has_no_ORCID.yml → Bolognese_Metadata/get_datacite_metadata/date.yml} +63 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/funding_schema_version_3.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_datacite_metadata/is_identical_to.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Datacite/get_metadata → Bolognese_Metadata/get_datacite_metadata}/keywords_with_attributes.yml +64 -3
- data/spec/fixtures/vcr_cassettes/{Bolognese_Datacite/get_metadata → Bolognese_Metadata/get_datacite_metadata}/multiple_author_names_in_one_creatorName.yml +63 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_one_author/has_name_in_display-order.yml → Bolognese_Metadata/get_datacite_metadata/multiple_licenses.yml} +63 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata/posted_content.yml → Bolognese_Metadata/get_date_from_date_parts/date.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_from_date_parts/year-month.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_from_date_parts/year.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_parts/date.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_parts/year-month.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_date_parts/year.yml +201 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifier/has_ORCID.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifier/has_jacow_org_scheme.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_name_identifier/has_no_ORCID.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_familyName.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_multiple_names_in_display-order.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_Thai.yml +134 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_display-order.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_display-order_with_ORCID.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/has_name_in_sort-order.yml +136 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/hyper-authorship.yml +132 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/is_organization.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/multiple_author_names_in_one_field.yml +136 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_SchemaOrg/get_metadata → Bolognese_Metadata/get_schema_org_metadata}/BlogPosting.yml +201 -200
- data/spec/fixtures/vcr_cassettes/{Bolognese_SchemaOrg/get_metadata → Bolognese_Metadata/get_schema_org_metadata}/not_found_error.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_alternate_identifiers/insert.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors/none.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_creators/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_descriptions/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_identifier/doi.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_person/creator_only_name.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_publication_year/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_publisher/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers/related_identifier.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_rights_list/insert.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_subjects/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_titles/insert.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_version/insert.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_comma.yml +203 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref → Bolognese_Metadata}/is_personal_name_/has_family_name.yml +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_id.yml +201 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref → Bolognese_Metadata}/is_personal_name_/has_known_given_name.yml +61 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/is_personal_name_/has_type_person.yml → Bolognese_Metadata/is_personal_name_/has_no_info.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/is_personal_name_/has_type_organization.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/missing_comma.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/nil.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/overlapping_keys.yml +97 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/jsonlint/valid.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/authors_as_string/author.yml → Bolognese_Metadata/normalize_doi/SICI_doi.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_from_url_without_doi_proxy.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_prefix_too_long.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/doi_prefix_with_string.yml +203 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/authors_as_string/no_author.yml → Bolognese_Metadata/normalize_doi/doi_with_protocol.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/dx_doi_org_url.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/https_url.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/not_valid_doi_prefix.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_doi/url_with_one_slash.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/doi.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/doi_as_url.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/ftp.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/invalid_url.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/string.yml +203 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_one_author/is_organization.yml → Bolognese_Metadata/normalize_id/url.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_id/url_with_utf-8.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_ids/doi.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/normalize_ids/url.yml +203 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/is_personal_name_/has_comma.yml → Bolognese_Metadata/normalize_url/uri.yml} +2 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/authors_as_string/with_organization.yml → Bolognese_Metadata/normalize_url/with_trailing_slash.yml} +2 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/array.yml +203 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/is_personal_name_/has_id.yml → Bolognese_Metadata/parse_attributes/hash.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/nil.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/parse_attributes/string.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/sanitize/should_only_keep_specific_tags.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/sanitize/should_remove_a_tags.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/to_schema_org/with_id.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/DOI.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/ISSN.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/URL.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/validate_url/string.yml +203 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/BlogPosting.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/Dataset.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_SchemaOrg/get_metadata/BlogPosting_schema_org_JSON.yml → Bolognese_Metadata/write_metadata_as_bibtex/from_schema_org.yml} +201 -200
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata_as_datacite_xml → Bolognese_Metadata/write_metadata_as_bibtex}/maremma.yml +9 -9
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_bibtex/with_data_citation.yml +731 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_citeproc → Bolognese_Metadata/write_metadata_as_bibtex}/with_pages.yml +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/BlogPosting.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_SchemaOrg/get_metadata_as_bibtex/with_data_citation.yml → Bolognese_Metadata/write_metadata_as_citeproc/BlogPosting_schema_org.yml} +201 -200
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/Dataset.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_citeproc → Bolognese_Metadata/write_metadata_as_citeproc}/journal_article.yml +62 -3
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata_as_ris → Bolognese_Metadata/write_metadata_as_citeproc}/maremma.yml +8 -8
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_ris → Bolognese_Metadata/write_metadata_as_citeproc}/with_pages.yml +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata_as_bibtex → Bolognese_Metadata/write_metadata_as_crosscite}/maremma.yml +9 -9
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_datacite_xml → Bolognese_Metadata/write_metadata_as_crosscite}/with_ORCID_ID.yml +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/with_data_citation.yml +731 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_SchemaOrg/get_metadata_as_citeproc/BlogPosting.yml → Bolognese_Metadata/write_metadata_as_crosscite/with_data_citation_schema_org.yml} +201 -200
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_datacite_xml → Bolognese_Metadata/write_metadata_as_crosscite}/with_editor.yml +62 -3
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_one_author/has_name_in_sort-order.yml → Bolognese_Metadata/write_metadata_as_crossref/from_DataCite.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/maremma.yml +100 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/with_ORCID_ID.yml +377 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_datacite_xml → Bolognese_Metadata/write_metadata_as_datacite_json}/with_data_citation.yml +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_json/with_data_citation_schema_org.yml +654 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/Dataset_in_schema_4_0.yml +97 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata_as_citeproc → 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 +377 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_ris/journal_article.yml → Bolognese_Metadata/write_metadata_as_datacite_xml/with_data_citation.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/with_data_citation_schema_org.yml +654 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_datacite_xml/with_editor.yml +944 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_DataciteJson/get_metadata_as_rdf_xml → Bolognese_Metadata/write_metadata_as_rdf_xml}/BlogPosting.yml +88 -23
- data/spec/fixtures/vcr_cassettes/{Bolognese_Citeproc/get_metadata_as_rdf_xml/BlogPosting.yml → Bolognese_Metadata/write_metadata_as_rdf_xml/BlogPosting_Citeproc_JSON.yml} +26 -20
- data/spec/fixtures/vcr_cassettes/{Bolognese_Bibtex/get_metadata_as_rdf_xml → Bolognese_Metadata/write_metadata_as_rdf_xml}/Crossref_DOI.yml +26 -20
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_rdf_xml → Bolognese_Metadata/write_metadata_as_rdf_xml}/journal_article.yml +87 -22
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata_as_rdf_xml → Bolognese_Metadata/write_metadata_as_rdf_xml}/maremma.yml +35 -29
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_turtle → Bolognese_Metadata/write_metadata_as_rdf_xml}/with_pages.yml +88 -23
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/BlogPosting.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/BlogPosting_schema_org.yml +654 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/Dataset.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_bibtex/with_data_citation.yml → Bolognese_Metadata/write_metadata_as_ris/journal_article.yml} +59 -2
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_ris/maremma.yml +100 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_bibtex → Bolognese_Metadata/write_metadata_as_ris}/with_pages.yml +62 -3
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Schema_org_JSON_IsSupplementTo.yml +99 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/Schema_org_JSON_isReferencedBy.yml +99 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata/Schema_org_JSON.yml → Bolognese_Metadata/write_metadata_as_schema_org/journal_article.yml} +61 -2
- data/spec/fixtures/vcr_cassettes/{Bolognese_Codemeta/get_metadata → Bolognese_Metadata/write_metadata_as_schema_org}/maremma_schema_org_JSON.yml +9 -9
- data/spec/fixtures/vcr_cassettes/{Bolognese_Datacite/get_metadata_as_rdf_xml → Bolognese_Metadata/write_metadata_as_turtle}/BlogPosting.yml +88 -23
- data/spec/fixtures/vcr_cassettes/{Bolognese_Citeproc/get_metadata_as_turtle/BlogPosting.yml → Bolognese_Metadata/write_metadata_as_turtle/BlogPosting_Citeproc_JSON.yml} +26 -20
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/BlogPosting_DataCite_JSON.yml +4589 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Bibtex/get_metadata_as_turtle → Bolognese_Metadata/write_metadata_as_turtle}/Crossref_DOI.yml +26 -20
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_turtle/DataONE.yml +4589 -0
- data/spec/fixtures/vcr_cassettes/{Bolognese_Datacite/get_metadata_as_turtle → Bolognese_Metadata/write_metadata_as_turtle}/Dataset.yml +88 -23
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_turtle → Bolognese_Metadata/write_metadata_as_turtle}/journal_article.yml +87 -22
- data/spec/fixtures/vcr_cassettes/{Bolognese_Crossref/get_metadata_as_rdf_xml → Bolognese_Metadata/write_metadata_as_turtle}/with_pages.yml +87 -22
- data/spec/metadata_spec.rb +8 -2
- data/spec/readers/bibtex_reader_spec.rb +30 -0
- data/spec/readers/citeproc_reader_spec.rb +28 -0
- data/spec/readers/codemeta_reader_spec.rb +90 -0
- data/spec/readers/crossref_reader_spec.rb +142 -0
- data/spec/readers/datacite_json_reader_spec.rb +48 -0
- data/spec/readers/datacite_reader_spec.rb +215 -0
- data/spec/readers/ris_reader_spec.rb +32 -0
- data/spec/readers/schema_org_reader_spec.rb +63 -0
- data/spec/utils_spec.rb +24 -25
- data/spec/writers/bibtex_writer_spec.rb +102 -0
- data/spec/writers/citeproc_writer_spec.rb +138 -0
- data/spec/writers/codemeta_writer_spec.rb +36 -0
- data/spec/writers/crosscite_writer_spec.rb +81 -0
- data/spec/writers/crossref_writer_spec.rb +19 -0
- data/spec/writers/datacite_json_writer_spec.rb +74 -0
- data/spec/writers/datacite_writer_spec.rb +124 -0
- data/spec/writers/rdf_xml_writer_spec.rb +97 -0
- data/spec/writers/ris_writer_spec.rb +153 -0
- data/spec/writers/schema_org_writer_spec.rb +59 -0
- data/spec/writers/turtle_writer_spec.rb +82 -0
- metadata +213 -132
- data/codemeta.json +0 -39
- data/lib/bolognese/bibtex.rb +0 -163
- data/lib/bolognese/citeproc.rb +0 -120
- data/lib/bolognese/codemeta.rb +0 -153
- data/lib/bolognese/crossref.rb +0 -281
- data/lib/bolognese/datacite.rb +0 -288
- data/lib/bolognese/datacite_json.rb +0 -220
- data/lib/bolognese/ris.rb +0 -117
- data/lib/bolognese/schema_org.rb +0 -196
- data/spec/bibtex_spec.rb +0 -90
- data/spec/citeproc_spec.rb +0 -66
- data/spec/codemeta_spec.rb +0 -221
- data/spec/crossref_spec.rb +0 -348
- data/spec/datacite_json_spec.rb +0 -125
- data/spec/datacite_spec.rb +0 -406
- data/spec/fixtures/vcr_cassettes/Bolognese_Codemeta/get_metadata_as_schema_org_JSON/maremma.yml +0 -100
- data/spec/fixtures/vcr_cassettes/Bolognese_Codemeta/get_metadata_as_turtle/maremma.yml +0 -4680
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/not_found_error.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_string/DOI_with_data_citation.yml +0 -672
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/author.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_multiple_names_in_display-order.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_name_in_Thai.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/has_name_in_display-order_with_ORCID.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/hyper-authorship.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/multiple_author_names.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_one_author/multiple_author_names_in_one_field.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/BlogPosting.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Dataset.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Date.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Funding_schema_version_3.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Funding_schema_version_4.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Schema_org_JSON_IsSupplementTo.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Schema_org_JSON_isReferencedBy.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/author.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/author_with_scheme.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/is_identical_to.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/jsonlint.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/multiple_licenses.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_bibtex/BlogPosting.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_bibtex/Dataset.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_citeproc/BlogPosting.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_citeproc/Dataset.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_codemeta/SoftwareSourceCode.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_datacite_xml_4_0/Dataset.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_ris/BlogPosting.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_ris/Dataset.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_turtle/BlogPosting.yml +0 -4620
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_alternate_identifiers/insert.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_contributors/none.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_creators/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_dates/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_descriptions/insert.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_identifier/doi.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_person/creator_only_name.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_publication_year/insert.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_publisher/insert.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/insert.yml +0 -38
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/related_identifier.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_resource_type/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_rights_list/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_subjects/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_titles/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_version/insert.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_DataciteJson/get_metadata_as_turtle/BlogPosting.yml +0 -4583
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/generate/datacite.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/read/datacite.yml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata_as_datacite_xml/with_data_citation.yml +0 -653
- data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata_as_ris/BlogPosting.yml +0 -653
- data/spec/schema_org_spec.rb +0 -151
data/spec/bibtex_spec.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bolognese::Bibtex, vcr: true do
|
4
|
-
let(:string) { IO.read(fixture_path + "crossref.bib") }
|
5
|
-
|
6
|
-
subject { Bolognese::Bibtex.new(string: string) }
|
7
|
-
|
8
|
-
context "get metadata" do
|
9
|
-
it "Crossref DOI" do
|
10
|
-
expect(subject.valid?).to be true
|
11
|
-
expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
|
12
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
13
|
-
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
14
|
-
expect(subject.resource_type_general).to eq("Text")
|
15
|
-
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Martial", "familyName"=>"Sankar"},
|
16
|
-
{"@type"=>"Person", "givenName"=>"Kaisa", "familyName"=>"Nieminen"},
|
17
|
-
{"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
|
18
|
-
{"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
|
19
|
-
{"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
|
20
|
-
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
21
|
-
expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
22
|
-
expect(subject.license["id"]).to eq("http://creativecommons.org/licenses/by/3.0/")
|
23
|
-
expect(subject.date_published).to eq("2014")
|
24
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "get metadata as datacite xml" do
|
29
|
-
it "Crossref DOI" do
|
30
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
31
|
-
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
32
|
-
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
33
|
-
expect(datacite.dig("descriptions", "description", "__content__")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
34
|
-
expect(datacite.dig("creators", "creator").count).to eq(5)
|
35
|
-
expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "get metadata as citeproc" do
|
40
|
-
it "Crossref DOI" do
|
41
|
-
json = JSON.parse(subject.citeproc)
|
42
|
-
expect(json["type"]).to eq("article-journal")
|
43
|
-
expect(json["id"]).to eq("https://doi.org/10.7554/elife.01567")
|
44
|
-
expect(json["DOI"]).to eq("10.7554/elife.01567")
|
45
|
-
expect(json["URL"]).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
46
|
-
expect(json["title"]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
47
|
-
expect(json["author"]).to eq([{"family"=>"Sankar", "given"=>"Martial"},
|
48
|
-
{"family"=>"Nieminen", "given"=>"Kaisa"},
|
49
|
-
{"family"=>"Ragni", "given"=>"Laura"},
|
50
|
-
{"family"=>"Xenarios", "given"=>"Ioannis"},
|
51
|
-
{"family"=>"Hardtke", "given"=>"Christian S"}])
|
52
|
-
expect(json["container-title"]).to eq("eLife")
|
53
|
-
expect(json["issued"]).to eq("date-parts" => [[2014]])
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "get metadata as ris" do
|
58
|
-
it "Crossref DOI" do
|
59
|
-
ris = subject.ris.split("\r\n")
|
60
|
-
expect(ris[0]).to eq("TY - JOUR")
|
61
|
-
expect(ris[1]).to eq("T1 - Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
62
|
-
expect(ris[2]).to eq("T2 - eLife")
|
63
|
-
expect(ris[3]).to eq("AU - Sankar, Martial")
|
64
|
-
expect(ris[8]).to eq("DO - 10.7554/elife.01567")
|
65
|
-
expect(ris[9]).to eq("UR - http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
66
|
-
expect(ris[10]).to eq("AB - Among various advantages, their small size makes model organisms preferred subjects of investigation. Yet, even in model systems detailed analysis of numerous developmental processes at cellular level is severely hampered by their scale.")
|
67
|
-
expect(ris[11]).to eq("PY - 2014")
|
68
|
-
expect(ris[12]).to eq("VL - 3")
|
69
|
-
expect(ris[13]).to eq("ER - ")
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "get metadata as turtle" do
|
74
|
-
it "Crossref DOI" do
|
75
|
-
ttl = subject.turtle.split("\n")
|
76
|
-
expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
|
77
|
-
expect(ttl[2]).to eq("<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;")
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context "get metadata as rdf_xml" do
|
82
|
-
it "Crossref DOI" do
|
83
|
-
rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
|
84
|
-
expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.7554/elife.01567")
|
85
|
-
expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
86
|
-
expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014")
|
87
|
-
expect(rdf_xml.dig("ScholarlyArticle", "isPartOf", "Periodical", "name")).to eq("eLife")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
data/spec/citeproc_spec.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bolognese::Citeproc, vcr: true do
|
4
|
-
let(:string) { IO.read(fixture_path + "citeproc.json") }
|
5
|
-
|
6
|
-
subject { Bolognese::Citeproc.new(string: string) }
|
7
|
-
|
8
|
-
context "get metadata" do
|
9
|
-
it "BlogPosting" do
|
10
|
-
expect(subject.valid?).to be true
|
11
|
-
expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg")
|
12
|
-
expect(subject.type).to eq("BlogPosting")
|
13
|
-
expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
14
|
-
expect(subject.resource_type_general).to eq("Text")
|
15
|
-
expect(subject.author).to eq("type"=>"Person", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
|
16
|
-
expect(subject.title).to eq("Eating your own Dog Food")
|
17
|
-
expect(subject.description["text"]).to start_with("Eating your own dog food")
|
18
|
-
expect(subject.date_published).to eq("2016-12-20")
|
19
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"DataCite Blog")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "get metadata as datacite xml" do
|
24
|
-
it "BlogPosting" do
|
25
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
26
|
-
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
27
|
-
expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food")
|
28
|
-
expect(datacite.dig("descriptions", "description", "__content__")).to start_with("Eating your own dog food")
|
29
|
-
expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "get metadata as ris" do
|
34
|
-
it "BlogPosting" do
|
35
|
-
ris = subject.ris.split("\r\n")
|
36
|
-
expect(ris[0]).to eq("TY - GEN")
|
37
|
-
expect(ris[1]).to eq("T1 - Eating your own Dog Food")
|
38
|
-
expect(ris[2]).to eq("T2 - DataCite Blog")
|
39
|
-
expect(ris[3]).to eq("AU - Fenner, Martin")
|
40
|
-
expect(ris[4]).to eq("DO - 10.5438/4k3m-nyvg")
|
41
|
-
expect(ris[5]).to eq("UR - https://blog.datacite.org/eating-your-own-dog-food")
|
42
|
-
expect(ris[6]).to eq("AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...")
|
43
|
-
expect(ris[7]).to eq("PY - 2016")
|
44
|
-
expect(ris[8]).to eq("PB - DataCite")
|
45
|
-
expect(ris[9]).to eq("ER - ")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "get metadata as turtle" do
|
50
|
-
it "BlogPosting" do
|
51
|
-
ttl = subject.turtle.split("\n")
|
52
|
-
expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
|
53
|
-
expect(ttl[2]).to eq("<https://doi.org/10.5438/4k3m-nyvg> a schema:BlogPosting;")
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "get metadata as rdf_xml" do
|
58
|
-
it "BlogPosting" do
|
59
|
-
rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
|
60
|
-
expect(rdf_xml.dig("BlogPosting", "rdf:about")).to eq("https://doi.org/10.5438/4k3m-nyvg")
|
61
|
-
expect(rdf_xml.dig("BlogPosting", "author", "Person", "name")).to eq("Martin Fenner")
|
62
|
-
expect(rdf_xml.dig("BlogPosting", "name")).to eq("Eating your own Dog Food")
|
63
|
-
expect(rdf_xml.dig("BlogPosting", "datePublished", "__content__")).to eq("2016-12-20")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
data/spec/codemeta_spec.rb
DELETED
@@ -1,221 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bolognese::Codemeta, vcr: true do
|
4
|
-
let(:fixture_path) { "spec/fixtures/" }
|
5
|
-
let(:id) { "https://github.com/datacite/maremma" }
|
6
|
-
|
7
|
-
subject { Bolognese::Codemeta.new(id: id) }
|
8
|
-
|
9
|
-
context "get metadata" do
|
10
|
-
it "maremma" do
|
11
|
-
expect(subject.valid?).to be true
|
12
|
-
expect(subject.id).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
13
|
-
expect(subject.url).to eq("https://github.com/datacite/maremma")
|
14
|
-
expect(subject.type).to eq("SoftwareSourceCode")
|
15
|
-
expect(subject.author).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
|
16
|
-
expect(subject.title).to eq("Maremma: a Ruby library for simplified network calls")
|
17
|
-
expect(subject.description["text"]).to start_with("Ruby utility library for network requests")
|
18
|
-
expect(subject.keywords).to eq("faraday, excon, net/http")
|
19
|
-
expect(subject.date_created).to eq("2015-11-28")
|
20
|
-
expect(subject.date_published).to eq("2017-02-24")
|
21
|
-
expect(subject.date_modified).to eq("2017-02-24")
|
22
|
-
expect(subject.publisher).to eq("DataCite")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "maremma schema.org JSON" do
|
26
|
-
json = JSON.parse(subject.schema_org)
|
27
|
-
expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
28
|
-
expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls")
|
29
|
-
expect(json["author"]).to eq("name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "@type"=>"Person", "@id"=>"http://orcid.org/0000-0003-0077-4738")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "no codemeta.json" do
|
33
|
-
id = "https://github.com/datacite/homepage"
|
34
|
-
subject = Bolognese::Codemeta.new(id: id)
|
35
|
-
expect(subject.id).to be_nil
|
36
|
-
expect(subject.exists?).to be false
|
37
|
-
end
|
38
|
-
|
39
|
-
it "not found error" do
|
40
|
-
id = "https://github.com/datacite/x"
|
41
|
-
subject = Bolognese::Codemeta.new(id: id)
|
42
|
-
expect(subject.id).to be_nil
|
43
|
-
expect(subject.exists?).to be false
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "get metadata as string" do
|
48
|
-
let(:string) { IO.read(fixture_path + 'codemeta.json') }
|
49
|
-
|
50
|
-
subject { Bolognese::Codemeta.new(string: string) }
|
51
|
-
|
52
|
-
it "rdataone" do
|
53
|
-
expect(subject.id).to eq("https://doi.org/10.5063/f1m61h5x")
|
54
|
-
expect(subject.url).to eq("https://github.com/DataONEorg/rdataone")
|
55
|
-
expect(subject.type).to eq("SoftwareSourceCode")
|
56
|
-
expect(subject.author).to eq( [{"type"=>"Person",
|
57
|
-
"id"=>"http://orcid.org/0000-0003-0077-4738",
|
58
|
-
"name"=>"Matt Jones",
|
59
|
-
"givenName"=>"Matt",
|
60
|
-
"familyName"=>"Jones"},
|
61
|
-
{"type"=>"Person",
|
62
|
-
"id"=>"http://orcid.org/0000-0002-2192-403X",
|
63
|
-
"name"=>"Peter Slaughter",
|
64
|
-
"givenName"=>"Peter",
|
65
|
-
"familyName"=>"Slaughter"},
|
66
|
-
{"type"=>"Organization", "name"=>"University Of California, Santa Barbara"}])
|
67
|
-
expect(subject.title).to eq("R Interface to the DataONE REST API")
|
68
|
-
expect(subject.description["text"]).to start_with("Provides read and write access to data and metadata")
|
69
|
-
expect(subject.keywords).to eq("data sharing, data repository, DataONE")
|
70
|
-
expect(subject.version).to eq("2.0.0")
|
71
|
-
expect(subject.date_created).to eq("2016-05-27")
|
72
|
-
expect(subject.date_published).to eq("2016-05-27")
|
73
|
-
expect(subject.date_modified).to eq("2016-05-27")
|
74
|
-
expect(subject.publisher).to eq("https://cran.r-project.org")
|
75
|
-
end
|
76
|
-
|
77
|
-
it "maremma" do
|
78
|
-
string = IO.read(fixture_path + 'maremma/codemeta.json')
|
79
|
-
subject = Bolognese::Codemeta.new(string: string)
|
80
|
-
expect(subject.valid?).to be true
|
81
|
-
expect(subject.id).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
82
|
-
expect(subject.url).to eq("https://github.com/datacite/maremma")
|
83
|
-
expect(subject.type).to eq("SoftwareSourceCode")
|
84
|
-
expect(subject.author).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
|
85
|
-
expect(subject.title).to eq("Maremma: a Ruby library for simplified network calls")
|
86
|
-
expect(subject.description["text"]).to start_with("Simplifies network calls")
|
87
|
-
expect(subject.keywords).to eq("faraday, excon, net/http")
|
88
|
-
expect(subject.date_created).to eq("2015-11-28")
|
89
|
-
expect(subject.date_published).to eq("2017-02-24")
|
90
|
-
expect(subject.date_modified).to eq("2017-02-24")
|
91
|
-
expect(subject.publisher).to eq("DataCite")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context "get metadata as datacite xml" do
|
96
|
-
it "rdataone" do
|
97
|
-
string = IO.read(fixture_path + 'codemeta.json')
|
98
|
-
subject = Bolognese::Codemeta.new(string: string)
|
99
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
100
|
-
expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API")
|
101
|
-
expect(datacite.dig("creators", "creator")).to eq([{"creatorName"=>"Jones, Matt",
|
102
|
-
"givenName"=>"Matt",
|
103
|
-
"familyName"=>"Jones",
|
104
|
-
"nameIdentifier"=>
|
105
|
-
{"schemeURI"=>"http://orcid.org/",
|
106
|
-
"nameIdentifierScheme"=>"ORCID",
|
107
|
-
"__content__"=>"http://orcid.org/0000-0003-0077-4738"}},
|
108
|
-
{"creatorName"=>"Slaughter, Peter",
|
109
|
-
"givenName"=>"Peter",
|
110
|
-
"familyName"=>"Slaughter",
|
111
|
-
"nameIdentifier"=>
|
112
|
-
{"schemeURI"=>"http://orcid.org/",
|
113
|
-
"nameIdentifierScheme"=>"ORCID",
|
114
|
-
"__content__"=>"http://orcid.org/0000-0002-2192-403X"}},
|
115
|
-
{"creatorName"=>"University Of California, Santa Barbara"}])
|
116
|
-
expect(datacite.fetch("version")).to eq("2.0.0")
|
117
|
-
end
|
118
|
-
|
119
|
-
it "maremma" do
|
120
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
121
|
-
expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls")
|
122
|
-
expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", "__content__"=>"http://orcid.org/0000-0003-0077-4738"})
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context "get metadata as schema.org JSON" do
|
127
|
-
it "rdataone" do
|
128
|
-
string = IO.read(fixture_path + 'codemeta.json')
|
129
|
-
subject = Bolognese::Codemeta.new(string: string)
|
130
|
-
json = JSON.parse(subject.schema_org)
|
131
|
-
expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x")
|
132
|
-
expect(json["@type"]).to eq("SoftwareSourceCode")
|
133
|
-
expect(json["name"]).to eq("R Interface to the DataONE REST API")
|
134
|
-
expect(json["author"]).to eq([{"name"=>"Matt Jones",
|
135
|
-
"givenName"=>"Matt",
|
136
|
-
"familyName"=>"Jones",
|
137
|
-
"@type"=>"Person",
|
138
|
-
"@id"=>"http://orcid.org/0000-0003-0077-4738"},
|
139
|
-
{"name"=>"Peter Slaughter",
|
140
|
-
"givenName"=>"Peter",
|
141
|
-
"familyName"=>"Slaughter",
|
142
|
-
"@type"=>"Person",
|
143
|
-
"@id"=>"http://orcid.org/0000-0002-2192-403X"},
|
144
|
-
{"name"=>"University Of California, Santa Barbara", "@type"=>"Organization"}])
|
145
|
-
expect(json["version"]).to eq("2.0.0")
|
146
|
-
end
|
147
|
-
|
148
|
-
it "maremma" do
|
149
|
-
json = JSON.parse(subject.schema_org)
|
150
|
-
expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
151
|
-
expect(json["@type"]).to eq("SoftwareSourceCode")
|
152
|
-
expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls")
|
153
|
-
expect(json["author"]).to eq("name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner", "@type"=>"Person", "@id"=>"http://orcid.org/0000-0003-0077-4738")
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
context "get metadata as bibtex" do
|
158
|
-
it "maremma" do
|
159
|
-
bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
|
160
|
-
expect(bibtex[:bibtex_type].to_s).to eq("misc")
|
161
|
-
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
162
|
-
expect(bibtex[:doi]).to eq("10.5438/qeg0-3gm3")
|
163
|
-
expect(bibtex[:url]).to eq("https://github.com/datacite/maremma")
|
164
|
-
expect(bibtex[:title]).to eq("Maremma: a Ruby library for simplified network calls")
|
165
|
-
expect(bibtex[:author]).to eq("Fenner, Martin")
|
166
|
-
expect(bibtex[:publisher]).to eq("DataCite")
|
167
|
-
expect(bibtex[:keywords]).to eq("faraday, excon, net/http")
|
168
|
-
expect(bibtex[:year]).to eq("2017")
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
context "get metadata as citeproc" do
|
173
|
-
it "maremma" do
|
174
|
-
json = JSON.parse(subject.citeproc)
|
175
|
-
expect(json["type"]).to eq("computer_program")
|
176
|
-
expect(json["id"]).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
177
|
-
expect(json["DOI"]).to eq("10.5438/qeg0-3gm3")
|
178
|
-
expect(json["title"]).to eq("Maremma: a Ruby library for simplified network calls")
|
179
|
-
expect(json["author"]).to eq("family" => "Fenner", "given" => "Martin")
|
180
|
-
expect(json["publisher"]).to eq("DataCite")
|
181
|
-
expect(json["issued"]).to eq("date-parts" => [[2017, 2, 24]])
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
context "get metadata as ris" do
|
186
|
-
it "maremma" do
|
187
|
-
ris = subject.ris.split("\r\n")
|
188
|
-
expect(ris[0]).to eq("TY - COMP")
|
189
|
-
expect(ris[1]).to eq("T1 - Maremma: a Ruby library for simplified network calls")
|
190
|
-
expect(ris[2]).to eq("T2 - DataCite")
|
191
|
-
expect(ris[3]).to eq("AU - Fenner, Martin")
|
192
|
-
expect(ris[4]).to eq("DO - 10.5438/qeg0-3gm3")
|
193
|
-
expect(ris[5]).to eq("UR - https://github.com/datacite/maremma")
|
194
|
-
expect(ris[6]).to eq("AB - Ruby utility library for network requests. Based on Faraday and Excon, provides a wrapper for XML/JSON parsing and error handling. All successful responses are returned as hash with key data, all errors in a JSONAPI-friendly hash with key errors.")
|
195
|
-
expect(ris[7]).to eq("KW - faraday")
|
196
|
-
expect(ris[10]).to eq("PY - 2017")
|
197
|
-
expect(ris[11]).to eq("PB - DataCite")
|
198
|
-
expect(ris[12]).to eq("ER - ")
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
context "get metadata as turtle" do
|
203
|
-
it "maremma" do
|
204
|
-
ttl = subject.turtle.split("\n")
|
205
|
-
expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
|
206
|
-
expect(ttl[2]).to eq("<https://doi.org/10.5438/qeg0-3gm3> a schema:SoftwareSourceCode;")
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
context "get metadata as rdf_xml" do
|
211
|
-
it "maremma" do
|
212
|
-
rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
|
213
|
-
expect(rdf_xml.dig("SoftwareSourceCode", "rdf:about")).to eq("https://doi.org/10.5438/qeg0-3gm3")
|
214
|
-
expect(rdf_xml.dig("SoftwareSourceCode", "author", "Person", "rdf:about")).to eq("http://orcid.org/0000-0003-0077-4738")
|
215
|
-
expect(rdf_xml.dig("SoftwareSourceCode", "author", "Person", "name")).to eq("Martin Fenner")
|
216
|
-
expect(rdf_xml.dig("SoftwareSourceCode", "name")).to eq("Maremma: a Ruby library for simplified network calls")
|
217
|
-
expect(rdf_xml.dig("SoftwareSourceCode", "keywords")).to eq("faraday, excon, net/http")
|
218
|
-
expect(rdf_xml.dig("SoftwareSourceCode", "datePublished", "__content__")).to eq("2017-02-24")
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
data/spec/crossref_spec.rb
DELETED
@@ -1,348 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bolognese::Crossref, vcr: true do
|
4
|
-
let(:id) { "10.7554/eLife.01567" }
|
5
|
-
|
6
|
-
subject { Bolognese::Crossref.new(id: id) }
|
7
|
-
|
8
|
-
context "get metadata" do
|
9
|
-
it "DOI with data citation" do
|
10
|
-
expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
|
11
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
12
|
-
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
13
|
-
expect(subject.additional_type).to eq("JournalArticle")
|
14
|
-
expect(subject.resource_type_general).to eq("Text")
|
15
|
-
expect(subject.author.length).to eq(5)
|
16
|
-
expect(subject.author.first).to eq("type"=>"Person", "name"=>"Martial Sankar", "givenName"=>"Martial", "familyName"=>"Sankar")
|
17
|
-
expect(subject.license).to eq("url"=>"http://creativecommons.org/licenses/by/3.0/")
|
18
|
-
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
19
|
-
expect(subject.date_published).to eq("2014-02-11")
|
20
|
-
expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
|
21
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
22
|
-
expect(subject.references.count).to eq(27)
|
23
|
-
expect(subject.references[21]).to eq("id"=>"https://doi.org/10.5061/dryad.b835k", "relationType"=>"Cites", "position"=>"22", "datePublished"=>"2014")
|
24
|
-
expect(subject.funder).to eq([{"name"=>"SystemsX"},
|
25
|
-
{"id"=>"https://doi.org/10.13039/501100003043",
|
26
|
-
"name"=>"EMBO"},
|
27
|
-
{"id"=>"https://doi.org/10.13039/501100001711",
|
28
|
-
"name"=>"Swiss National Science Foundation"},
|
29
|
-
{"id"=>"https://doi.org/10.13039/501100006390",
|
30
|
-
"name"=>"University of Lausanne"}])
|
31
|
-
expect(subject.provider).to eq("Crossref")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "journal article" do
|
35
|
-
id = "https://doi.org/10.1371/journal.pone.0000030"
|
36
|
-
subject = Bolognese::Crossref.new(id: id)
|
37
|
-
expect(subject.id).to eq(id)
|
38
|
-
expect(subject.url).to eq("http://dx.plos.org/10.1371/journal.pone.0000030")
|
39
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
40
|
-
expect(subject.additional_type).to eq("JournalArticle")
|
41
|
-
expect(subject.resource_type_general).to eq("Text")
|
42
|
-
expect(subject.author.length).to eq(5)
|
43
|
-
expect(subject.author.first).to eq("type"=>"Person", "name"=>"Markus Ralser", "givenName"=>"Markus", "familyName"=>"Ralser")
|
44
|
-
expect(subject.editor).to eq("type"=>"Person", "name"=>"Guilhem Janbon", "givenName"=>"Guilhem", "familyName"=>"Janbon")
|
45
|
-
expect(subject.title).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes")
|
46
|
-
expect(subject.license).to eq("url"=>"http://creativecommons.org/licenses/by/4.0/")
|
47
|
-
expect(subject.date_published).to eq("2006-12-20")
|
48
|
-
expect(subject.date_modified).to eq("2016-12-31T21:37:08Z")
|
49
|
-
expect(subject.page_start).to eq("e30")
|
50
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"PLoS ONE", "issn"=>"1932-6203")
|
51
|
-
expect(subject.provider).to eq("Crossref")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "posted_content" do
|
55
|
-
id = "https://doi.org/10.1101/097196"
|
56
|
-
subject = Bolognese::Crossref.new(id: id)
|
57
|
-
expect(subject.id).to eq(id)
|
58
|
-
expect(subject.url).to eq("http://biorxiv.org/lookup/doi/10.1101/097196")
|
59
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
60
|
-
expect(subject.additional_type).to eq("PostedContent")
|
61
|
-
expect(subject.resource_type_general).to eq("Text")
|
62
|
-
expect(subject.author.count).to eq(10)
|
63
|
-
expect(subject.author.last).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-4060-7360", "name"=>"Timothy Clark", "givenName"=>"Timothy", "familyName"=>"Clark")
|
64
|
-
expect(subject.title).to eq("A Data Citation Roadmap for Scholarly Data Repositories")
|
65
|
-
expect(subject.alternate_name).to eq("biorxiv;097196v1")
|
66
|
-
expect(subject.description).to start_with("This article presents a practical roadmap")
|
67
|
-
expect(subject.date_published).to eq("2016-12-28")
|
68
|
-
expect(subject.date_modified).to eq("2016-12-29T00:10:20Z")
|
69
|
-
expect(subject.is_part_of).to be_nil
|
70
|
-
expect(subject.provider).to eq("Crossref")
|
71
|
-
end
|
72
|
-
|
73
|
-
it "DOI with SICI DOI" do
|
74
|
-
id = "https://doi.org/10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2"
|
75
|
-
subject = Bolognese::Crossref.new(id: id)
|
76
|
-
expect(subject.id).to eq("https://doi.org/10.1890/0012-9658(2006)87%5B2832:tiopma%5D2.0.co;2")
|
77
|
-
expect(subject.url).to eq("http://doi.wiley.com/10.1890/0012-9658(2006)87[2832:TIOPMA]2.0.CO;2")
|
78
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
79
|
-
expect(subject.additional_type).to eq("JournalArticle")
|
80
|
-
expect(subject.resource_type_general).to eq("Text")
|
81
|
-
expect(subject.author).to eq([{"type"=>"Person", "name"=>"A. Fenton", "givenName"=>"A.", "familyName"=>"Fenton"}, {"type"=>"Person", "name"=>"S. A. Rands", "givenName"=>"S. A.", "familyName"=>"Rands"}])
|
82
|
-
expect(subject.license).to eq("url"=>"http://doi.wiley.com/10.1002/tdm_license_1.1")
|
83
|
-
expect(subject.title).to eq("THE IMPACT OF PARASITE MANIPULATION AND PREDATOR FORAGING BEHAVIOR ON PREDATOR–PREY COMMUNITIES")
|
84
|
-
expect(subject.date_published).to eq("2006-11")
|
85
|
-
expect(subject.date_modified).to eq("2017-04-01T00:47:57Z")
|
86
|
-
expect(subject.page_start).to eq("2832")
|
87
|
-
expect(subject.page_end).to eq("2841")
|
88
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"Ecology", "issn"=>"0012-9658")
|
89
|
-
expect(subject.provider).to eq("Crossref")
|
90
|
-
end
|
91
|
-
|
92
|
-
it "DOI with ORCID ID" do
|
93
|
-
id = "https://doi.org/10.1155/2012/291294"
|
94
|
-
subject = Bolognese::Crossref.new(id: id)
|
95
|
-
expect(subject.id).to eq("https://doi.org/10.1155/2012/291294")
|
96
|
-
expect(subject.url).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
|
97
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
98
|
-
expect(subject.additional_type).to eq("JournalArticle")
|
99
|
-
expect(subject.resource_type_general).to eq("Text")
|
100
|
-
expect(subject.author.length).to eq(7)
|
101
|
-
expect(subject.author[2]).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-2043-4925", "name"=>"Beatriz Hernandez", "givenName"=>"Beatriz", "familyName"=>"Hernandez")
|
102
|
-
expect(subject.license).to eq("url"=>"http://creativecommons.org/licenses/by/3.0/")
|
103
|
-
expect(subject.title).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
104
|
-
expect(subject.date_published).to eq("2012")
|
105
|
-
expect(subject.date_modified).to eq("2016-08-02T12:42:41Z")
|
106
|
-
expect(subject.page_start).to eq("1")
|
107
|
-
expect(subject.page_end).to eq("7")
|
108
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"Pulmonary Medicine", "issn"=>["2090-1836", "2090-1844"])
|
109
|
-
expect(subject.provider).to eq("Crossref")
|
110
|
-
end
|
111
|
-
|
112
|
-
it "date in future" do
|
113
|
-
id = "https://doi.org/10.1016/j.ejphar.2015.03.018"
|
114
|
-
subject = Bolognese::Crossref.new(id: id)
|
115
|
-
expect(subject.id).to eq(id)
|
116
|
-
expect(subject.url).to eq("http://linkinghub.elsevier.com/retrieve/pii/S0014299915002332")
|
117
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
118
|
-
expect(subject.additional_type).to eq("JournalArticle")
|
119
|
-
expect(subject.resource_type_general).to eq("Text")
|
120
|
-
expect(subject.author.length).to eq(10)
|
121
|
-
expect(subject.author.first).to eq("type"=>"Person", "name"=>"Sarah E. Beck", "givenName"=>"Sarah E.", "familyName"=>"Beck")
|
122
|
-
expect(subject.title).to eq("Paving the path to HIV neurotherapy: Predicting SIV CNS disease")
|
123
|
-
expect(subject.date_published).to eq("2015-07")
|
124
|
-
expect(subject.date_modified).to eq("2016-08-20T02:19:38Z")
|
125
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"European Journal of Pharmacology", "issn"=>"00142999")
|
126
|
-
expect(subject.provider).to eq("Crossref")
|
127
|
-
end
|
128
|
-
|
129
|
-
it "not found error" do
|
130
|
-
id = "https://doi.org/10.7554/elife.01567x"
|
131
|
-
subject = Bolognese::Crossref.new(id: id)
|
132
|
-
expect(subject.id).to be_nil
|
133
|
-
expect(subject.exists?).to be false
|
134
|
-
end
|
135
|
-
|
136
|
-
it "Schema.org JSON" do
|
137
|
-
json = JSON.parse(subject.schema_org)
|
138
|
-
expect(json["@id"]).to eq("https://doi.org/10.7554/elife.01567")
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
context "get metadata as string" do
|
143
|
-
it "DOI with data citation" do
|
144
|
-
id = "10.7554/eLife.01567"
|
145
|
-
string = Bolognese::Crossref.new(id: id).crossref
|
146
|
-
|
147
|
-
subject = Bolognese::Crossref.new(string: string)
|
148
|
-
expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
|
149
|
-
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
150
|
-
expect(subject.type).to eq("ScholarlyArticle")
|
151
|
-
expect(subject.additional_type).to eq("JournalArticle")
|
152
|
-
expect(subject.resource_type_general).to eq("Text")
|
153
|
-
expect(subject.author.length).to eq(5)
|
154
|
-
expect(subject.author.last).to eq("type"=>"Person", "name"=>"Christian S Hardtke", "givenName"=>"Christian S", "familyName"=>"Hardtke")
|
155
|
-
expect(subject.license).to eq("url"=>"http://creativecommons.org/licenses/by/3.0/")
|
156
|
-
expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
157
|
-
expect(subject.date_published).to eq("2014-02-11")
|
158
|
-
expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
|
159
|
-
expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
|
160
|
-
expect(subject.references.count).to eq(27)
|
161
|
-
expect(subject.references[21]).to eq("id"=>"https://doi.org/10.5061/dryad.b835k", "relationType"=>"Cites", "position"=>"22", "datePublished"=>"2014")
|
162
|
-
expect(subject.provider).to eq("Crossref")
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
context "get metadata as datacite xml" do
|
167
|
-
it "with data citation" do
|
168
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
169
|
-
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
170
|
-
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
171
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(27)
|
172
|
-
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"Cites", "__content__"=>"https://doi.org/10.1038/nature02100")
|
173
|
-
expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0/"})
|
174
|
-
expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
|
175
|
-
expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier"=>{"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
|
176
|
-
end
|
177
|
-
|
178
|
-
it "with ORCID ID" do
|
179
|
-
id = "https://doi.org/10.1155/2012/291294"
|
180
|
-
subject = Bolognese::Crossref.new(id: id)
|
181
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
182
|
-
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
|
183
|
-
expect(datacite.dig("creators", "creator").count).to eq(7)
|
184
|
-
expect(datacite.dig("creators", "creator")[2]).to eq("creatorName" => "Hernandez, Beatriz",
|
185
|
-
+"familyName" => "Hernandez",
|
186
|
-
+"givenName" => "Beatriz",
|
187
|
-
"nameIdentifier" => {"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", "__content__"=>"http://orcid.org/0000-0003-2043-4925"})
|
188
|
-
end
|
189
|
-
|
190
|
-
it "with editor" do
|
191
|
-
id = "https://doi.org/10.1371/journal.pone.0000030"
|
192
|
-
subject = Bolognese::Crossref.new(id: id)
|
193
|
-
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
194
|
-
expect(datacite.dig("contributors", "contributor")).to eq("contributorType"=>"Editor", "contributorName"=>"Janbon, Guilhem", "givenName"=>"Guilhem", "familyName"=>"Janbon")
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
context "get metadata as bibtex" do
|
199
|
-
it "with data citation" do
|
200
|
-
bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
|
201
|
-
expect(bibtex[:bibtex_type].to_s).to eq("article")
|
202
|
-
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.7554/elife.01567")
|
203
|
-
expect(bibtex[:doi]).to eq("10.7554/eLife.01567")
|
204
|
-
expect(bibtex[:url]).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
205
|
-
expect(bibtex[:title]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
206
|
-
expect(bibtex[:author]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
|
207
|
-
expect(bibtex[:journal]).to eq("eLife")
|
208
|
-
expect(bibtex[:year]).to eq("2014")
|
209
|
-
end
|
210
|
-
|
211
|
-
it "with pages" do
|
212
|
-
id = "https://doi.org/10.1155/2012/291294"
|
213
|
-
subject = Bolognese::Crossref.new(id: id)
|
214
|
-
bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
|
215
|
-
expect(bibtex[:bibtex_type].to_s).to eq("article")
|
216
|
-
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.1155/2012/291294")
|
217
|
-
expect(bibtex[:doi]).to eq("10.1155/2012/291294")
|
218
|
-
expect(bibtex[:url]).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
|
219
|
-
expect(bibtex[:title]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
220
|
-
expect(bibtex[:author]).to eq("Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.")
|
221
|
-
expect(bibtex[:journal]).to eq("Pulmonary Medicine")
|
222
|
-
expect(bibtex[:pages]).to eq("1-7")
|
223
|
-
expect(bibtex[:year]).to eq("2012")
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
context "get metadata as citeproc" do
|
228
|
-
it "journal article" do
|
229
|
-
id = "10.7554/eLife.01567"
|
230
|
-
subject = Bolognese::Crossref.new(id: id)
|
231
|
-
expect(subject.valid?).to be true
|
232
|
-
json = JSON.parse(subject.citeproc)
|
233
|
-
expect(json["type"]).to eq("article-journal")
|
234
|
-
expect(json["id"]).to eq("https://doi.org/10.7554/elife.01567")
|
235
|
-
expect(json["DOI"]).to eq("10.7554/eLife.01567")
|
236
|
-
expect(json["title"]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
237
|
-
expect(json["author"]).to eq([{"family"=>"Sankar", "given"=>"Martial"},
|
238
|
-
{"family"=>"Nieminen", "given"=>"Kaisa"},
|
239
|
-
{"family"=>"Ragni", "given"=>"Laura"},
|
240
|
-
{"family"=>"Xenarios", "given"=>"Ioannis"},
|
241
|
-
{"family"=>"Hardtke", "given"=>"Christian S"}])
|
242
|
-
expect(json["container-title"]).to eq("eLife")
|
243
|
-
expect(json["volume"]).to eq("3")
|
244
|
-
expect(json["issued"]).to eq("date-parts" => [[2014, 2, 11]])
|
245
|
-
end
|
246
|
-
|
247
|
-
it "with pages" do
|
248
|
-
id = "https://doi.org/10.1155/2012/291294"
|
249
|
-
subject = Bolognese::Crossref.new(id: id)
|
250
|
-
expect(subject.valid?).to be true
|
251
|
-
json = JSON.parse(subject.citeproc)
|
252
|
-
expect(json["type"]).to eq("article-journal")
|
253
|
-
expect(json["id"]).to eq("https://doi.org/10.1155/2012/291294")
|
254
|
-
expect(json["DOI"]).to eq("10.1155/2012/291294")
|
255
|
-
expect(json["title"]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
256
|
-
expect(json["author"]).to eq([{"family"=>"Thanassi", "given"=>"Wendy"},
|
257
|
-
{"family"=>"Noda", "given"=>"Art"},
|
258
|
-
{"family"=>"Hernandez", "given"=>"Beatriz"},
|
259
|
-
{"family"=>"Newell", "given"=>"Jeffery"},
|
260
|
-
{"family"=>"Terpeluk", "given"=>"Paul"},
|
261
|
-
{"family"=>"Marder", "given"=>"David"},
|
262
|
-
{"family"=>"Yesavage", "given"=>"Jerome A."}])
|
263
|
-
expect(json["container-title"]).to eq("Pulmonary Medicine")
|
264
|
-
expect(json["volume"]).to eq("2012")
|
265
|
-
expect(json["page"]).to eq("1-7")
|
266
|
-
expect(json["issued"]).to eq("date-parts"=>[[2012]])
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
context "get metadata as ris" do
|
271
|
-
it "journal article" do
|
272
|
-
id = "10.7554/eLife.01567"
|
273
|
-
subject = Bolognese::Crossref.new(id: id)
|
274
|
-
expect(subject.valid?).to be true
|
275
|
-
ris = subject.ris.split("\r\n")
|
276
|
-
expect(ris[0]).to eq("TY - JOUR")
|
277
|
-
expect(ris[1]).to eq("T1 - Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
278
|
-
expect(ris[2]).to eq("T2 - eLife")
|
279
|
-
expect(ris[3]).to eq("AU - Sankar, Martial")
|
280
|
-
expect(ris[8]).to eq("DO - 10.7554/eLife.01567")
|
281
|
-
expect(ris[9]).to eq("UR - http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
282
|
-
expect(ris[10]).to eq("PY - 2014")
|
283
|
-
expect(ris[11]).to eq("VL - 3")
|
284
|
-
expect(ris[12]).to eq("ER - ")
|
285
|
-
end
|
286
|
-
|
287
|
-
it "with pages" do
|
288
|
-
id = "https://doi.org/10.1155/2012/291294"
|
289
|
-
subject = Bolognese::Crossref.new(id: id)
|
290
|
-
expect(subject.valid?).to be true
|
291
|
-
ris = subject.ris.split("\r\n")
|
292
|
-
expect(ris[0]).to eq("TY - JOUR")
|
293
|
-
expect(ris[1]).to eq("T1 - Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
294
|
-
expect(ris[2]).to eq("T2 - Pulmonary Medicine")
|
295
|
-
expect(ris[3]).to eq("AU - Thanassi, Wendy")
|
296
|
-
expect(ris[10]).to eq("DO - 10.1155/2012/291294")
|
297
|
-
expect(ris[11]).to eq("UR - http://www.hindawi.com/journals/pm/2012/291294/")
|
298
|
-
expect(ris[12]).to eq("PY - 2012")
|
299
|
-
expect(ris[13]).to eq("VL - 2012")
|
300
|
-
expect(ris[14]).to eq("SP - 1-7")
|
301
|
-
expect(ris[15]).to eq("ER - ")
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
context "get metadata as turtle" do
|
306
|
-
it "journal article" do
|
307
|
-
id = "10.7554/eLife.01567"
|
308
|
-
subject = Bolognese::Crossref.new(id: id)
|
309
|
-
expect(subject.valid?).to be true
|
310
|
-
ttl = subject.turtle.split("\n")
|
311
|
-
expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
|
312
|
-
expect(ttl[2]).to eq("<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;")
|
313
|
-
end
|
314
|
-
|
315
|
-
it "with pages" do
|
316
|
-
id = "https://doi.org/10.1155/2012/291294"
|
317
|
-
subject = Bolognese::Crossref.new(id: id)
|
318
|
-
expect(subject.valid?).to be true
|
319
|
-
ttl = subject.turtle.split("\n")
|
320
|
-
expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
|
321
|
-
expect(ttl[2]).to eq("<https://doi.org/10.1155/2012/291294> a schema:ScholarlyArticle;")
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
context "get metadata as rdf_xml" do
|
326
|
-
it "journal article" do
|
327
|
-
id = "10.7554/eLife.01567"
|
328
|
-
subject = Bolognese::Crossref.new(id: id)
|
329
|
-
expect(subject.valid?).to be true
|
330
|
-
rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
|
331
|
-
expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.7554/elife.01567")
|
332
|
-
expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
|
333
|
-
expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014-02-11")
|
334
|
-
end
|
335
|
-
|
336
|
-
it "with pages" do
|
337
|
-
id = "https://doi.org/10.1155/2012/291294"
|
338
|
-
subject = Bolognese::Crossref.new(id: id)
|
339
|
-
expect(subject.valid?).to be true
|
340
|
-
rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
|
341
|
-
expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.1155/2012/291294")
|
342
|
-
expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
|
343
|
-
expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2012")
|
344
|
-
expect(rdf_xml.dig("ScholarlyArticle", "pageStart")).to eq("1")
|
345
|
-
expect(rdf_xml.dig("ScholarlyArticle", "pageEnd")).to eq("7")
|
346
|
-
end
|
347
|
-
end
|
348
|
-
end
|