bolognese 0.4.3 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/build.yml +9 -0
- data/.github/workflows/changelog.yml +36 -0
- data/.github/workflows/ci.yml +22 -0
- data/.github/workflows/pull-request.yml +9 -0
- data/.github/workflows/release.yml +32 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +658 -0
- data/CHANGELOG.md +1864 -0
- data/CITATION +17 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +250 -98
- data/README.md +963 -21
- data/Rakefile +1 -0
- data/bin/bolognese +5 -1
- data/bolognese.gemspec +33 -21
- data/lib/bolognese/array.rb +13 -0
- data/lib/bolognese/author_utils.rb +147 -33
- data/lib/bolognese/citeproc_extensions.rb +48 -0
- data/lib/bolognese/cli.rb +28 -21
- data/lib/bolognese/datacite_utils.rb +292 -104
- data/lib/bolognese/doi_utils.rb +44 -20
- data/lib/bolognese/metadata.rb +249 -23
- data/lib/bolognese/metadata_utils.rb +228 -0
- data/lib/bolognese/pubmed.rb +2 -0
- data/lib/bolognese/readers/bibtex_reader.rb +100 -0
- data/lib/bolognese/readers/citeproc_reader.rb +125 -0
- data/lib/bolognese/readers/codemeta_reader.rb +108 -0
- data/lib/bolognese/readers/crosscite_reader.rb +17 -0
- data/lib/bolognese/readers/crossref_reader.rb +413 -0
- data/lib/bolognese/readers/datacite_json_reader.rb +17 -0
- data/lib/bolognese/readers/datacite_reader.rb +341 -0
- data/lib/bolognese/readers/npm_reader.rb +115 -0
- data/lib/bolognese/readers/ris_reader.rb +114 -0
- data/lib/bolognese/readers/schema_org_reader.rb +264 -0
- data/lib/bolognese/string.rb +3 -1
- data/lib/bolognese/utils.rb +1463 -25
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/whitelist_scrubber.rb +47 -0
- data/lib/bolognese/writers/bibtex_writer.rb +32 -0
- data/lib/bolognese/writers/citation_writer.rb +14 -0
- data/lib/bolognese/writers/citeproc_writer.rb +11 -0
- data/lib/bolognese/writers/codemeta_writer.rb +29 -0
- data/lib/bolognese/writers/crosscite_writer.rb +11 -0
- data/lib/bolognese/writers/crossref_writer.rb +11 -0
- data/lib/bolognese/writers/csv_writer.rb +24 -0
- data/lib/bolognese/writers/datacite_json_writer.rb +13 -0
- data/lib/bolognese/writers/datacite_writer.rb +12 -0
- data/lib/bolognese/writers/jats_writer.rb +137 -0
- data/lib/bolognese/writers/rdf_xml_writer.rb +11 -0
- data/lib/bolognese/writers/ris_writer.rb +29 -0
- data/lib/bolognese/writers/schema_org_writer.rb +55 -0
- data/lib/bolognese/writers/turtle_writer.rb +11 -0
- data/lib/bolognese.rb +19 -5
- data/package.json +12 -0
- data/resources/2008/09/xsd.xsl +997 -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 +37 -0
- data/resources/kernel-4/include/datacite-dateType-v4.xsd +27 -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 +39 -0
- data/resources/kernel-4/include/datacite-relationType-v4.xsd +59 -0
- data/resources/kernel-4/include/datacite-resourceType-v4.xsd +52 -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 +715 -0
- data/resources/kernel-4.0/include/datacite-contributorType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-dateType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-descriptionType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-funderIdentifierType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-relatedIdentifierType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-relationType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-resourceType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/datacite-titleType-v4.xsd +1 -1
- data/resources/kernel-4.0/include/xml.xsd +286 -0
- data/resources/kernel-4.0/metadata.xsd +2 -2
- 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/kernel-4.5/include/datacite-contributorType-v4.xsd +35 -0
- data/resources/kernel-4.5/include/datacite-dateType-v4.xsd +25 -0
- data/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd +19 -0
- data/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd +16 -0
- data/resources/kernel-4.5/include/datacite-nameType-v4.xsd +10 -0
- data/resources/kernel-4.5/include/datacite-numberType-v4.xsd +12 -0
- data/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd +34 -0
- data/resources/kernel-4.5/include/datacite-relationType-v4.xsd +53 -0
- data/resources/kernel-4.5/include/datacite-resourceType-v4.xsd +45 -0
- data/resources/kernel-4.5/include/datacite-titleType-v4.xsd +14 -0
- data/resources/kernel-4.5/include/xml.xsd +286 -0
- data/resources/kernel-4.5/metadata.xsd +711 -0
- data/resources/kernel-4.6/include/datacite-contributorType-v4.xsd +37 -0
- data/resources/kernel-4.6/include/datacite-dateType-v4.xsd +27 -0
- data/resources/kernel-4.6/include/datacite-descriptionType-v4.xsd +19 -0
- data/resources/kernel-4.6/include/datacite-funderIdentifierType-v4.xsd +16 -0
- data/resources/kernel-4.6/include/datacite-nameType-v4.xsd +10 -0
- data/resources/kernel-4.6/include/datacite-numberType-v4.xsd +12 -0
- data/resources/kernel-4.6/include/datacite-relatedIdentifierType-v4.xsd +37 -0
- data/resources/kernel-4.6/include/datacite-relationType-v4.xsd +57 -0
- data/resources/kernel-4.6/include/datacite-resourceType-v4.xsd +49 -0
- data/resources/kernel-4.6/include/datacite-titleType-v4.xsd +14 -0
- data/resources/kernel-4.6/include/xml.xsd +286 -0
- data/resources/kernel-4.6/metadata.xsd +712 -0
- data/resources/kernel-4.7/include/datacite-contributorType-v4.xsd +37 -0
- data/resources/kernel-4.7/include/datacite-dateType-v4.xsd +27 -0
- data/resources/kernel-4.7/include/datacite-descriptionType-v4.xsd +19 -0
- data/resources/kernel-4.7/include/datacite-funderIdentifierType-v4.xsd +16 -0
- data/resources/kernel-4.7/include/datacite-nameType-v4.xsd +10 -0
- data/resources/kernel-4.7/include/datacite-numberType-v4.xsd +12 -0
- data/resources/kernel-4.7/include/datacite-relatedIdentifierType-v4.xsd +39 -0
- data/resources/kernel-4.7/include/datacite-relationType-v4.xsd +59 -0
- data/resources/kernel-4.7/include/datacite-resourceType-v4.xsd +52 -0
- data/resources/kernel-4.7/include/datacite-titleType-v4.xsd +14 -0
- data/resources/kernel-4.7/include/xml.xsd +286 -0
- data/resources/kernel-4.7/metadata.xsd +715 -0
- data/resources/oecd/dfg-mappings.json +1866 -0
- data/resources/oecd/for-mappings.json +1101 -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
- metadata +466 -179
- data/.travis.yml +0 -23
- data/lib/bolognese/crossref.rb +0 -233
- data/lib/bolognese/datacite.rb +0 -176
- data/lib/bolognese/date_utils.rb +0 -48
- data/lib/bolognese/github.rb +0 -106
- data/lib/bolognese/orcid.rb +0 -24
- data/lib/bolognese/schema_org.rb +0 -170
- data/spec/cli_spec.rb +0 -56
- data/spec/crossref_spec.rb +0 -190
- data/spec/datacite_spec.rb +0 -93
- data/spec/datacite_utils_spec.rb +0 -159
- data/spec/doi_utils_spec.rb +0 -89
- data/spec/fixtures/crossref.xml +0 -742
- data/spec/fixtures/datacite.xml +0 -40
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/as_crossref.yml +0 -760
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/as_datacite.yml +0 -1476
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/as_schema_org.yml +0 -1476
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/datacite/as_datacite.yml +0 -214
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/datacite/as_schema_org.yml +0 -384
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/schema_org/as_datacite.yml +0 -653
- data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/schema_org/as_schema_org.yml +0 -653
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/crossref.yml +0 -971
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/datacite.yml +0 -971
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/medra.yml +0 -971
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/not_found.yml +0 -971
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_with_ORCID_ID.yml +0 -506
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_with_SICI_DOI.yml +0 -214
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_with_data_citation.yml +0 -901
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/date_in_future.yml +0 -305
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/journal_article.yml +0 -1080
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/not_found_error.yml +0 -183
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/posted_content.yml +0 -389
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/DOI_with_ORCID_ID.yml +0 -506
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/DOI_with_data_citation.yml +0 -901
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/with_ORCID_ID.yml +0 -366
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/with_data_citation.yml +0 -719
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/with_editor.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_string/DOI_with_data_citation.yml +0 -719
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/SICI_doi.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_from_url_without_doi_proxy.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_prefix_too_long.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_prefix_with_string.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_with_protocol.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/dx_doi_org_url.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/https_url.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/not_valid_doi_prefix.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_ids/doi.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_ids/url.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_url/doi.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_url/url.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/array.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/hash.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/nil.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/string.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/array.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/hash.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/nil.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/string.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/validate_url/DOI.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/validate_url/URL.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/validate_url/string.yml +0 -930
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/BlogPosting.yml +0 -477
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Dataset.yml +0 -1925
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Date.yml +0 -458
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_string/Dataset.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_alternate_identifiers/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_contributors/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_contributors/none.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_creators/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_dates/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_descriptions/insert.yml +0 -155
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_identifier/doi.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_person/creator.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_person/creator_given_and_family_name.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_person/creator_only_name.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_publication_year/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_publisher/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/get_related_identifier_type.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/get_related_identifier_type_DOI.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/get_related_identifier_type_URL.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_related_identifiers/rel_identifiers.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_resource_type/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_rights_list/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_subjects/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_titles/doi.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_titles/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/insert_version/insert.yml +0 -173
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/crossref.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/crossref_doi_not_url.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/datacite.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/datacite_doi_http.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/orcid.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/BlogPosting.yml +0 -632
- data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/not_found_error.yml +0 -93
- data/spec/metadata_spec.rb +0 -41
- data/spec/orcid_spec.rb +0 -23
- data/spec/schema_org_spec.rb +0 -33
- data/spec/spec_helper.rb +0 -88
- data/spec/utils_spec.rb +0 -107
data/lib/bolognese/version.rb
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# modified from https://gist.github.com/ivan-kolmychek/ee2fdc53f3e2c637271d
|
|
4
|
+
|
|
5
|
+
module Bolognese
|
|
6
|
+
class WhitelistScrubber < Loofah::Scrubber
|
|
7
|
+
def initialize(options={})
|
|
8
|
+
@direction = :bottom_up
|
|
9
|
+
@tags = options[:tags]
|
|
10
|
+
@attributes = options[:attributes]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def scrub(node)
|
|
14
|
+
scrub_node_attributes(node) and return CONTINUE if node_allowed?(node)
|
|
15
|
+
node.before node.children
|
|
16
|
+
node.remove
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def scrub_node_attributes(node)
|
|
22
|
+
fallback_scrub_node_attributes(node) and return true unless @attributes.present? && @attributes.respond_to?(:include?)
|
|
23
|
+
node.attribute_nodes.each do |attr_node|
|
|
24
|
+
attr_node.remove unless @attributes.include?(attr_node.name)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def allowed_not_element_node_types
|
|
29
|
+
[ Nokogiri::XML::Node::TEXT_NODE, Nokogiri::XML::Node::CDATA_SECTION_NODE ]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def fallback_scrub_node_attributes(node)
|
|
33
|
+
Loofah::HTML5::Scrub.scrub_attributes(node)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def fallback_allowed_element_detection(node)
|
|
37
|
+
Loofah::HTML5::Scrub.allowed_element?(node.name)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def node_allowed?(node)
|
|
41
|
+
return fallback_allowed_element_detection(node) unless @tags.present? && @tags.respond_to?(:include?)
|
|
42
|
+
return true if allowed_not_element_node_types.include?(node.type)
|
|
43
|
+
return false unless node.type == Nokogiri::XML::Node::ELEMENT_NODE
|
|
44
|
+
@tags.include? node.name
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module BibtexWriter
|
|
6
|
+
def bibtex
|
|
7
|
+
return nil unless valid?
|
|
8
|
+
|
|
9
|
+
pages = container.to_h["firstPage"].present? ? [container["firstPage"], container["lastPage"]].compact.join("-") : nil
|
|
10
|
+
|
|
11
|
+
bib = {
|
|
12
|
+
bibtex_type: types["bibtex"].presence || "misc",
|
|
13
|
+
bibtex_key: normalize_doi(doi),
|
|
14
|
+
doi: doi,
|
|
15
|
+
url: url,
|
|
16
|
+
author: authors_as_string(creators),
|
|
17
|
+
keywords: subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.join(", ") : nil,
|
|
18
|
+
language: language,
|
|
19
|
+
title: parse_attributes(titles, content: "title", first: true),
|
|
20
|
+
journal: container && container["title"],
|
|
21
|
+
volume: container.to_h["volume"],
|
|
22
|
+
issue: container.to_h["issue"],
|
|
23
|
+
pages: pages,
|
|
24
|
+
publisher: publisher["name"],
|
|
25
|
+
year: publication_year,
|
|
26
|
+
copyright: Array.wrap(rights_list).map { |l| l["rights"] }.first,
|
|
27
|
+
}.compact
|
|
28
|
+
BibTeX::Entry.new(bib).to_s
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module CitationWriter
|
|
6
|
+
def citation
|
|
7
|
+
cp = CiteProc::Processor.new(style: style, locale: locale, format: 'html')
|
|
8
|
+
cp.import Array.wrap(citeproc_hsh)
|
|
9
|
+
bibliography = cp.render :bibliography, id: normalize_doi(doi)
|
|
10
|
+
bibliography.first
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module CodemetaWriter
|
|
6
|
+
def codemeta
|
|
7
|
+
return nil unless valid? || show_errors
|
|
8
|
+
|
|
9
|
+
hsh = {
|
|
10
|
+
"@context" => id.present? ? "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld" : nil,
|
|
11
|
+
"@type" => types.present? ? types["schemaOrg"] : nil,
|
|
12
|
+
"@id" => normalize_doi(doi),
|
|
13
|
+
"identifier" => to_schema_org_identifiers(identifiers),
|
|
14
|
+
"codeRepository" => url,
|
|
15
|
+
"name" => parse_attributes(titles, content: "title", first: true),
|
|
16
|
+
"authors" => creators,
|
|
17
|
+
"description" => parse_attributes(descriptions, content: "description", first: true),
|
|
18
|
+
"version" => version_info,
|
|
19
|
+
"tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
|
|
20
|
+
"datePublished" => get_date(dates, "Issued") || publication_year,
|
|
21
|
+
"dateModified" => get_date(dates, "Updated"),
|
|
22
|
+
"publisher" => publisher["name"],
|
|
23
|
+
"license" => Array.wrap(rights_list).map { |l| l["rightsUri"] }.compact.unwrap,
|
|
24
|
+
}.compact
|
|
25
|
+
JSON.pretty_generate hsh.presence
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Bolognese
|
|
2
|
+
module Writers
|
|
3
|
+
module CsvWriter
|
|
4
|
+
require "csv"
|
|
5
|
+
|
|
6
|
+
def csv
|
|
7
|
+
bib = {
|
|
8
|
+
doi: doi,
|
|
9
|
+
url: url,
|
|
10
|
+
registered: get_iso8601_date(date_registered),
|
|
11
|
+
state: state,
|
|
12
|
+
resource_type_general: types.respond_to?(:to_h) ? types.to_h["resourceTypeGeneral"] : nil,
|
|
13
|
+
resource_type: types.respond_to?(:to_h) ? types.to_h["resourceType"] : nil,
|
|
14
|
+
title: parse_attributes(titles, content: "title", first: true),
|
|
15
|
+
author: authors_as_string(creators),
|
|
16
|
+
publisher: publisher.respond_to?(:to_h) ? publisher.to_h["name"] : nil,
|
|
17
|
+
publication_year: publication_year
|
|
18
|
+
}.values
|
|
19
|
+
|
|
20
|
+
CSV.generate { |csv| csv << bib }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Bolognese
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Writers
|
|
5
|
+
module DataciteJsonWriter
|
|
6
|
+
def datacite_json
|
|
7
|
+
if crosscite_hsh.present?
|
|
8
|
+
JSON.pretty_generate crosscite_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) }
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module DataciteWriter
|
|
6
|
+
# generate new DataCite XML version 4.0 if regenerate (!should_passthru) option is provided
|
|
7
|
+
def datacite
|
|
8
|
+
should_passthru ? raw : datacite_xml
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module JatsWriter
|
|
6
|
+
def jats
|
|
7
|
+
@jats ||= Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
|
|
8
|
+
xml.send("element-citation", publication_type) do
|
|
9
|
+
insert_citation(xml)
|
|
10
|
+
end
|
|
11
|
+
end.to_xml
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def insert_citation(xml)
|
|
15
|
+
insert_authors(xml)
|
|
16
|
+
insert_editors(xml)
|
|
17
|
+
insert_citation_title(xml) if is_article? || is_data? || is_chapter?
|
|
18
|
+
insert_source(xml)
|
|
19
|
+
insert_publisher_name(xml) if publisher.present? && !is_data?
|
|
20
|
+
insert_publication_date(xml)
|
|
21
|
+
insert_volume(xml) if container.to_h["volume"].present?
|
|
22
|
+
insert_issue(xml) if container.to_h["issue"].present?
|
|
23
|
+
insert_fpage(xml) if container.to_h["firstPage"].present?
|
|
24
|
+
insert_lpage(xml) if container.to_h["lastPage"].present?
|
|
25
|
+
insert_version(xml) if version_info.present?
|
|
26
|
+
insert_pub_id(xml)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def is_article?
|
|
30
|
+
publication_type.fetch('publication-type', nil) == "journal"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def is_data?
|
|
34
|
+
publication_type.fetch('publication-type', nil) == "data"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def is_chapter?
|
|
38
|
+
publication_type.fetch('publication-type', nil) == "chapter"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def insert_authors(xml)
|
|
42
|
+
if creators.present?
|
|
43
|
+
xml.send("person-group", "person-group-type" => "author") do
|
|
44
|
+
Array.wrap(creators).each do |au|
|
|
45
|
+
xml.name do
|
|
46
|
+
insert_contributor(xml, au)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def insert_editors(xml)
|
|
54
|
+
if contributors.present?
|
|
55
|
+
xml.send("person-group", "person-group-type" => "editor") do
|
|
56
|
+
Array.wrap(contributors).each do |con|
|
|
57
|
+
xml.name do
|
|
58
|
+
insert_contributor(xml, con)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def insert_contributor(xml, person)
|
|
66
|
+
xml.surname(person["familyName"]) if person["familyName"].present?
|
|
67
|
+
xml.send("given-names", person["givenName"]) if person["givenName"].present?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def insert_citation_title(xml)
|
|
71
|
+
case publication_type.fetch('publication-type', nil)
|
|
72
|
+
when "data" then xml.send("data-title", parse_attributes(titles, content: "title", first: true))
|
|
73
|
+
when "journal" then xml.send("article-title", parse_attributes(titles, content: "title", first: true))
|
|
74
|
+
when "chapter" then xml.send("chapter-title", parse_attributes(titles, content: "title", first: true))
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def insert_source(xml)
|
|
79
|
+
if is_chapter?
|
|
80
|
+
xml.source(publisher["name"])
|
|
81
|
+
elsif is_article? || is_data?
|
|
82
|
+
xml.source(container && container["title"] || publisher["name"])
|
|
83
|
+
else
|
|
84
|
+
xml.source(parse_attributes(titles, content: "title", first: true))
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def insert_publisher_name(xml)
|
|
89
|
+
attributes = {
|
|
90
|
+
"xml:lang" => publisher["lang"]
|
|
91
|
+
}.compact
|
|
92
|
+
xml.send("publisher-name", attributes, publisher["name"])
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def insert_publication_date(xml)
|
|
96
|
+
year, month, day = get_date_parts(get_date(dates, "Issued")).to_h.fetch("date-parts", []).first
|
|
97
|
+
|
|
98
|
+
xml.year(year, "iso-8601-date" => get_date(dates, "Issued"))
|
|
99
|
+
xml.month(month.to_s.rjust(2, '0')) if month.present?
|
|
100
|
+
xml.day(day.to_s.rjust(2, '0')) if day.present?
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def insert_volume(xml)
|
|
104
|
+
xml.volume(container["volume"])
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def insert_issue(xml)
|
|
108
|
+
xml.issue(container["issue"])
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def insert_fpage(xml)
|
|
112
|
+
xml.fpage(container["firstPage"])
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def insert_lpage(xml)
|
|
116
|
+
xml.lpage(container["lastPage"])
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def insert_version(xml)
|
|
120
|
+
xml.version(version_info)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def insert_pub_id(xml)
|
|
124
|
+
return nil unless doi.present?
|
|
125
|
+
xml.send("pub-id", doi, "pub-id-type" => "doi")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def date
|
|
129
|
+
get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def publication_type
|
|
133
|
+
{ 'publication-type' => Bolognese::Utils::CR_TO_JATS_TRANSLATIONS[types["resourceType"]] || Bolognese::Utils::SO_TO_JATS_TRANSLATIONS[types["schemaOrg"]] }.compact
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module RisWriter
|
|
6
|
+
def ris
|
|
7
|
+
{
|
|
8
|
+
"TY" => types["ris"],
|
|
9
|
+
"T1" => parse_attributes(titles, content: "title", first: true),
|
|
10
|
+
"T2" => container && container["title"],
|
|
11
|
+
"AU" => to_ris(creators),
|
|
12
|
+
"DO" => doi,
|
|
13
|
+
"UR" => url,
|
|
14
|
+
"AB" => parse_attributes(abstract_description, content: "description", first: true),
|
|
15
|
+
"KW" => Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.presence,
|
|
16
|
+
"PY" => publication_year,
|
|
17
|
+
"PB" => publisher["name"],
|
|
18
|
+
"LA" => language,
|
|
19
|
+
"VL" => container.to_h["volume"],
|
|
20
|
+
"IS" => container.to_h["issue"],
|
|
21
|
+
"SP" => container.to_h["firstPage"],
|
|
22
|
+
"EP" => container.to_h["lastPage"],
|
|
23
|
+
"SN" => Array.wrap(related_identifiers).find { |ri| ri["relationType"] == "IsPartOf" }.to_h.fetch("relatedIdentifier", nil),
|
|
24
|
+
"ER" => ""
|
|
25
|
+
}.compact.map { |k, v| v.is_a?(Array) ? v.map { |vi| "#{k} - #{vi}" }.join("\r\n") : "#{k} - #{v}" }.join("\r\n")
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bolognese
|
|
4
|
+
module Writers
|
|
5
|
+
module SchemaOrgWriter
|
|
6
|
+
def schema_hsh
|
|
7
|
+
{ "@context" => "http://schema.org",
|
|
8
|
+
"@type" => types.present? ? types["schemaOrg"] : nil,
|
|
9
|
+
"@id" => normalize_doi(doi),
|
|
10
|
+
"identifier" => to_schema_org_identifiers(identifiers),
|
|
11
|
+
"url" => url,
|
|
12
|
+
"additionalType" => types.present? ? types["resourceType"] : nil,
|
|
13
|
+
"name" => parse_attributes(titles, content: "title", first: true),
|
|
14
|
+
"author" => to_schema_org_creators(creators),
|
|
15
|
+
"editor" => to_schema_org_contributors(contributors),
|
|
16
|
+
"translator" => contributors ? to_schema_org_contributors(contributors.select { |c| c["contributorType"] == "Translator" }) : nil,
|
|
17
|
+
"description" => parse_attributes(abstract_description, content: "description", first: true),
|
|
18
|
+
"license" => Array.wrap(rights_list).map { |l| l["rightsUri"] }.compact.unwrap,
|
|
19
|
+
"version" => version_info,
|
|
20
|
+
"keywords" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.join(", ") : nil,
|
|
21
|
+
"inLanguage" => language,
|
|
22
|
+
"contentSize" => Array.wrap(sizes).unwrap,
|
|
23
|
+
"encodingFormat" => Array.wrap(formats).unwrap,
|
|
24
|
+
"dateCreated" => get_date(dates, "Created"),
|
|
25
|
+
"datePublished" => get_date(dates, "Issued") || publication_year,
|
|
26
|
+
"dateModified" => get_date(dates, "Updated"),
|
|
27
|
+
"temporalCoverage" => get_date(dates, "Coverage"),
|
|
28
|
+
"pageStart" => container.to_h["firstPage"],
|
|
29
|
+
"pageEnd" => container.to_h["lastPage"],
|
|
30
|
+
"spatialCoverage" => to_schema_org_spatial_coverage(geo_locations),
|
|
31
|
+
"sameAs" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "IsIdenticalTo"),
|
|
32
|
+
"isPartOf" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "IsPartOf"),
|
|
33
|
+
"hasPart" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "HasPart"),
|
|
34
|
+
"predecessor_of" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "IsPreviousVersionOf"),
|
|
35
|
+
"successor_of" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "IsNewVersionOf"),
|
|
36
|
+
"citation" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "References"),
|
|
37
|
+
"workTranslation" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "HasTranslation"),
|
|
38
|
+
"translationOfWork" => to_schema_org_relation(related_identifiers: related_identifiers, relation_type: "IsTranslationOf"),
|
|
39
|
+
"@reverse" => reverse.presence,
|
|
40
|
+
"contentUrl" => Array.wrap(content_url).unwrap,
|
|
41
|
+
"schemaVersion" => schema_version,
|
|
42
|
+
"periodical" => types.present? ? ((types["schemaOrg"] != "Dataset") && container.present? ? to_schema_org(container) : nil) : nil,
|
|
43
|
+
"includedInDataCatalog" => types.present? ? ((types["schemaOrg"] == "Dataset") && container.present? ? to_schema_org_container(container, type: "Dataset") : nil) : nil,
|
|
44
|
+
"publisher" => publisher.present? ? { "@type" => "Organization", "@id" => publisher["publisherIdentifier"], "name" => publisher["name"] }.compact : nil,
|
|
45
|
+
"funder" => to_schema_org_funder(funding_references),
|
|
46
|
+
"provider" => agency.present? ? { "@type" => "Organization", "name" => agency } : nil
|
|
47
|
+
}.compact.presence
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def schema_org
|
|
51
|
+
JSON.pretty_generate schema_hsh
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
data/lib/bolognese.rb
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'active_support/all'
|
|
2
4
|
require 'nokogiri'
|
|
3
5
|
require 'maremma'
|
|
4
|
-
require '
|
|
6
|
+
require 'bibtex'
|
|
7
|
+
require 'loofah'
|
|
8
|
+
require 'json/ld'
|
|
9
|
+
require 'rdf/turtle'
|
|
10
|
+
require 'rdf/rdfxml'
|
|
11
|
+
require 'logger'
|
|
12
|
+
require 'iso8601'
|
|
13
|
+
require 'jsonlint'
|
|
14
|
+
require 'gender_detector'
|
|
15
|
+
require 'citeproc'
|
|
16
|
+
require 'csl/styles'
|
|
17
|
+
require 'edtf'
|
|
5
18
|
|
|
19
|
+
require "bolognese/citeproc_extensions"
|
|
6
20
|
require "bolognese/version"
|
|
7
21
|
require "bolognese/metadata"
|
|
8
|
-
require "bolognese/crossref"
|
|
9
|
-
require "bolognese/datacite"
|
|
10
|
-
require "bolognese/schema_org"
|
|
11
|
-
require "bolognese/orcid"
|
|
12
22
|
require "bolognese/cli"
|
|
13
23
|
require "bolognese/string"
|
|
24
|
+
require "bolognese/array"
|
|
25
|
+
require "bolognese/whitelist_scrubber"
|
|
26
|
+
|
|
27
|
+
ENV['USER_AGENT'] ||= "Mozilla/5.0 (compatible; Maremma/#{Maremma::VERSION}; mailto:info@datacite.org)"
|
data/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "edam-browser",
|
|
3
|
+
"description": "The EDAM Browser is a client-side web-based visualization javascript widget. Its goals are to help describing bio-related resources and service with EDAM, and to facilitate and foster community contributions to EDAM.",
|
|
4
|
+
"author": "Bryan Brancotte",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jshint js/*js"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"jshint": "^2.9.5"
|
|
11
|
+
}
|
|
12
|
+
}
|