Guide

DOI Gem Version GitHub

commonmeta-ruby is a Ruby gem and command-line utility for the conversion of scholarly metadata, including schema.org. Based on the bolognese gem, but using commonmeta as the intermediate format, and supporting additional metadata formats. A Python version is available at commonmeta-py.

Installation

Requires Ruby 3.0 or later (Ruby 2.x has reached its end of life March 2023). Then add the following to your Gemfile to install the latest version:

gem 'commonmeta-ruby'

Then run bundle install to install into your environment.

You can also install the gem system-wide in the usual way:

gem install commonmeta-ruby

Commands

Run the commonmeta command with either an identifier (DOI or URL) or filename:

commonmeta https://doi.org/10.7554/elife.01567
commonmeta example.xml

commonmeta can read BibTeX files (file extension .bib), RIS files (file extension .ris), Crossref files (file extension .xml), DataCite files and CSL-JSON files.

The input format (e.g. Crossref or BibteX) is automatically detected, but you can also provide the format with the --from or -f flag. The supported input formats are listed in the table above.

The output format is determined by the --to or -t flag, and defaults to schema_org.

Show all commands with commonmeta help:

Commands:
  commonmeta                 # convert metadata
  commonmeta --version, -v   # print the version
  commonmeta help [COMMAND]  # Describe available commands or one specific command

Errors

Errors are returned to STDOUT.

All input is validated against the commonmeta JSON schema.

Supported Metadata Formats

commonmeta-ruby reads and/or writes these metadata formats:

Format Name Content Type Read Write
Commonmeta commonmeta application/vnd.commonmeta+json yes yes
CrossRef Unixref XML crossref application/vnd.crossref.unixref+xml yes yes
Crossref crossref application/vnd.crossref+json yes no
DataCite datacite application/vnd.datacite.datacite+json yes yes
Schema.org (in JSON-LD) schema_org application/vnd.schemaorg.ld+json yes yes
RDF XML rdf_xml application/rdf+xml no yes
RDF Turtle turtle text/turtle no yes
CSL-JSON csl application/vnd.citationstyles.csl+json yes yes
Formatted text citation citation text/x-bibliography no yes
Codemeta codemeta application/vnd.codemeta.ld+json yes yes
Citation File Format (CFF) cff application/vnd.cff+yaml yes yes
JATS jats application/vnd.jats+xml no yes
CSV csv text/csv no yes
BibTex bibtex application/x-bibtex yes yes
RIS ris application/x-research-info-systems yes yes