It was easier than I thought. Here is a Julia function to convert a DOI into BibTeX:
using HTTP
doi2bib(doi::AbstractString) =
String(HTTP.get("http://data.crossref.org/$doi",
["Accept" => "application/x-bibtex"]).body)
For example,
julia> print(doi2bib("10.5334/jors.151"))
@article{Rackauckas_2017,
doi = {10.5334/jors.151},
url = {https://doi.org/10.5334%2Fjors.151},
year = 2017,
month = {may},
publisher = {Ubiquity Press, Ltd.},
volume = {5},
author = {Christopher Rackauckas and Qing Nie},
title = {{DifferentialEquations}.jl {\textendash} A Performant and Feature-Rich Ecosystem for Solving Differential Equations in Julia},
journal = {Journal of Open Research Software}
}
Note that there are a variety of ways to get a DOI for software besides a traditional publication, e.g. via Zenodo, and it is becoming increasingly popular.
Note also that, since the citation
field of CodeMeta is just a URL, we could easily support various common citation URLs in addition to DOIs:
- for
doi.org
URLs (DOIs), usedoi2bib
- for
github.com
URLs, generate a@misc
bibitem citing the URL, perhaps using the github API to fetch top contributors as authors. - for
arxiv.org
URLs, use the arXiv API