[![Build Status](https://travis-ci.org/datacite/bolognese.svg?branch=master)](https://travis-ci.org/datacite/bolognese) [![Code Climate](https://codeclimate.com/github/datacite/bolognese/badges/gpa.svg)](https://codeclimate.com/github/datacite/bolognese) [![Test Coverage](https://codeclimate.com/github/datacite/bolognese/badges/coverage.svg)](https://codeclimate.com/github/datacite/bolognese/coverage) # Bolognese Ruby gem and command-line utility for conversion of DOI metadata from and to [schema.org](https://schema.org) in JSON-LD. ## Features * convert [Crossref XML](https://support.crossref.org/hc/en-us/articles/214936283-UNIXREF-query-output-format) to schema.org/JSON-LD * convert [DataCite XML](http://schema.datacite.org/) to schema.org/JSON-LD * fetch schema.org/JSON-LD from a URL * convert schema.org/JSON-LD to [DataCite XML](http://schema.datacite.org/) * convert Crossref XML to [DataCite XML](http://schema.datacite.org/) Conversion to Crossref XML is not yet supported. ## Installation The usual way with Bundler: add the following to your `Gemfile` to install the current version of the gem: ```ruby gem 'bolognese' ``` Then run `bundle install` to install into your environment. You can also install the gem system-wide in the usual way: ```bash gem install bolognese ``` ## Commands The `bolognese` commands understand URLs and DOIs as arguments. The `--as` command line flag sets the format, either `crossref`, `datacite`, or `schema_org` (default). ## Examples Read Crossref XML: ``` bolognese read https://doi.org/10.7554/elife.01567 --as crossref ``` Convert Crossref XML to schema.org/JSON-LD: ``` bolognese read https://doi.org/10.7554/elife.01567 { "@context": "http://schema.org", "@type": "ScholarlyArticle", "@id": "https://doi.org/10.7554/elife.01567", "additionalType": "JournalArticle", "name": "Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth", "author": [{ "@type": "Person", "givenName": "Martial", "familyName": "Sankar" }, { "@type": "Person", "givenName": "Kaisa", "familyName": "Nieminen" }, { "@type": "Person", "givenName": "Laura", "familyName": "Ragni" }, { "@type": "Person", "givenName": "Ioannis", "familyName": "Xenarios" }, { "@type": "Person", "givenName": "Christian S", "familyName": "Hardtke" }], "license": "http://creativecommons.org/licenses/by/3.0/", "datePublished": "2014-02-11", "dateModified": "2015-08-11T05:35:02Z", "isPartOf": { "@type": "Periodical", "name": "eLife", "issn": "2050-084X" }, "citation": [{ "@type": "CreativeWork", "@id": "https://doi.org/10.1038/nature02100", "position": "1", "datePublished": "2003" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1534/genetics.109.104976", "position": "2", "datePublished": "2009" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1034/j.1399-3054.2002.1140413.x", "position": "3", "datePublished": "2002" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1162/089976601750399335", "position": "4", "datePublished": "2001" }, { "@type": "CreativeWork", "position": "5", "datePublished": "1995" }, { "@type": "CreativeWork", "position": "6", "datePublished": "1993" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1016/j.semcdb.2009.09.009", "position": "7", "datePublished": "2009" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1242/dev.091314", "position": "8", "datePublished": "2013" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1371/journal.pgen.1002997", "position": "9", "datePublished": "2012" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1038/msb.2010.25", "position": "10", "datePublished": "2010" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1016/j.biosystems.2012.07.004", "position": "11", "datePublished": "2012" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1016/j.pbi.2005.11.013", "position": "12", "datePublished": "2006" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1105/tpc.110.076083", "position": "13", "datePublished": "2010" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1073/pnas.0808444105", "position": "14", "datePublished": "2008" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1016/0092-8674(89)90900-8", "position": "15", "datePublished": "1989" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1126/science.1066609", "position": "16", "datePublished": "2002" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1104/pp.104.040212", "position": "17", "datePublished": "2004" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1038/nbt1206-1565", "position": "18", "datePublished": "2006" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1073/pnas.77.3.1516", "position": "19", "datePublished": "1980" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1093/bioinformatics/btq046", "position": "20", "datePublished": "2010" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1105/tpc.111.084020", "position": "21", "datePublished": "2011" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.5061/dryad.b835k", "position": "22", "datePublished": "2014" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1016/j.cub.2008.02.070", "position": "23", "datePublished": "2008" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1111/j.1469-8137.2010.03236.x", "position": "24", "datePublished": "2010" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1007/s00138-011-0345-9", "position": "25", "datePublished": "2012" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1016/j.cell.2012.02.048", "position": "26", "datePublished": "2012" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.1038/ncb2764", "position": "27", "datePublished": "2013" }], "provider": { "@type": "Organization", "name": "Crossref" } } ``` Convert Crossref XML to DataCite XML: ``` bolognese read https://doi.org/10.7554/elife.01567 --as datacite ?xml version="1.0" encoding="UTF-8"?> 10.7554/eLife.01567 Sankar, Martial Martial Sankar Nieminen, Kaisa Kaisa Nieminen Ragni, Laura Laura Ragni Xenarios, Ioannis Ioannis Xenarios Hardtke, Christian S Christian S Hardtke Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth eLife 2014 JournalArticle 2014-02-11 2015-08-11T05:35:02Z https://doi.org/10.1038/nature02100 https://doi.org/10.1534/genetics.109.104976 https://doi.org/10.1034/j.1399-3054.2002.1140413.x https://doi.org/10.1162/089976601750399335 https://doi.org/10.1016/j.semcdb.2009.09.009 https://doi.org/10.1242/dev.091314 https://doi.org/10.1371/journal.pgen.1002997 https://doi.org/10.1038/msb.2010.25 https://doi.org/10.1016/j.biosystems.2012.07.004 https://doi.org/10.1016/j.pbi.2005.11.013 https://doi.org/10.1105/tpc.110.076083 https://doi.org/10.1073/pnas.0808444105 https://doi.org/10.1016/0092-8674(89)90900-8 https://doi.org/10.1126/science.1066609 https://doi.org/10.1104/pp.104.040212 https://doi.org/10.1038/nbt1206-1565 https://doi.org/10.1073/pnas.77.3.1516 https://doi.org/10.1093/bioinformatics/btq046 https://doi.org/10.1105/tpc.111.084020 https://doi.org/10.5061/dryad.b835k https://doi.org/10.1016/j.cub.2008.02.070 https://doi.org/10.1111/j.1469-8137.2010.03236.x https://doi.org/10.1007/s00138-011-0345-9 https://doi.org/10.1016/j.cell.2012.02.048 https://doi.org/10.1038/ncb2764 Creative Commons Attribution 3.0 (CC-BY 3.0) ``` Read DataCite XML: ``` bolognese read 10.5061/DRYAD.8515 --as datacite ``` Convert DataCite XML to schema.org/JSON-LD: ```sh bolognese read 10.5061/DRYAD.8515 { "@context": "http://schema.org", "@type": "Dataset", "@id": "https://doi.org/10.5061/dryad.8515", "additionalType": "DataPackage", "name": "Data from: A new malaria agent in African hominids.", "alternateName": "Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.", "author": [{ "@type": "Person", "givenName": "Benjamin", "familyName": "Ollomo" }, { "@type": "Person", "givenName": "Patrick", "familyName": "Durand" }, { "@type": "Person", "givenName": "Franck", "familyName": "Prugnolle" }, { "@type": "Person", "givenName": "Emmanuel J. P.", "familyName": "Douzery" }, { "@type": "Person", "givenName": "Céline", "familyName": "Arnathau" }, { "@type": "Person", "givenName": "Dieudonné", "familyName": "Nkoghe" }, { "@type": "Person", "givenName": "Eric", "familyName": "Leroy" }, { "@type": "Person", "givenName": "François", "familyName": "Renaud" }], "license": "http://creativecommons.org/publicdomain/zero/1.0/", "version": "1", "keywords": "Phylogeny, Malaria, Parasites, Taxonomy, Mitochondrial genome, Africa, Plasmodium", "datePublished": "2011", "hasPart": [{ "@type": "CreativeWork", "@id": "https://doi.org/10.5061/dryad.8515/1" }, { "@type": "CreativeWork", "@id": "https://doi.org/10.5061/dryad.8515/2" }], "citation": [{ "@type": "CreativeWork", "@id": "https://doi.org/10.1371/journal.ppat.1000446" }], "publisher": { "@type": "Organization", "name": "Dryad Digital Repository" }, "provider": { "@type": "Organization", "name": "DataCite" } } ``` ## Development We use rspec for unit testing: ``` bundle exec rspec ``` Follow along via [Github Issues](https://github.com/datacite/bolognese/issues). Please open an issue if conversion fails or metadata are not properly supported. ### Note on Patches/Pull Requests * Fork the project * Write tests for your new feature or a test that reproduces a bug * Implement your feature or make a bug fix * Do not mess with Rakefile, version or history * Commit, push and make a pull request. Bonus points for topical branches. ## License **bolognese** is released under the [MIT License](https://github.com/datacite/bolognese/blob/master/LICENSE.md).