# Replacing CITATION.bib with a standard metadata format

**URL:** <https://discourse.julialang.org/t/replacing-citation-bib-with-a-standard-metadata-format/26871>\
**Category:** Tooling\
**Tags:** packages\
**Created:** [July 27, 2019, 3:14am UTC](https://discourse.julialang.org/t/replacing-citation-bib-with-a-standard-metadata-format/26871 "2019-07-27T03:14:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 27, 2019, 2:40pm UTC](https://discourse.julialang.org/t/replacing-citation-bib-with-a-standard-metadata-format/26871/4 "2019-07-27T14:40:01Z")

</div>

> [@stevengj](#):
>
> There are also plenty of tools to convert a DOI into BibTeX, so a CodeMeta file with a DOI URL for the `citation` field would be pretty easy to automatically convert to BibTeX, and I’m hopeful that we’d have a Julia package-to-BibTeX tool relatively quickly.

It was easier than I thought. Here is a Julia function to convert a DOI into BibTeX:

```jl
using HTTP

doi2bib(doi::AbstractString) =
    String(HTTP.get("http://data.crossref.org/$doi",
                    ["Accept" => "application/x-bibtex"]).body)

```

For example,

```julia
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](https://guides.github.com/activities/citable-code/), and it is becoming [increasingly popular](https://blog.datacite.org/doi-registrations-software/).

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:

1. for `doi.org` URLs (DOIs), use `doi2bib`
2. for `github.com` URLs, generate a `@misc` bibitem citing the URL, perhaps using the github API to fetch top contributors as authors.
3. for `arxiv.org` URLs, use the [arXiv API](https://arxiv.org/help/api/index)

---

_[View the full topic](https://discourse.julialang.org/t/replacing-citation-bib-with-a-standard-metadata-format/26871)._
