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