from commonmeta import Metadata
# Fetch metadata from a DOI
= '10.7554/elife.01567'
string = Metadata(string)
metadata
# Check that metadata was fetched successfully
print(metadata.state)
findable
This notebook shows how to generate a formatted citation in one of the 1000s of styles supported by the Citation Style Language. The citation is returned as a string in HTML format, supporting a limited subset of HTML tags (such as <i>
and <sup>
).
As with all commonmeta-py notebooks, we start by fetching metadata, in this example a journal article via its Crossref DOI, an then convert them to the internal commonmeta format.
Using the citation
writer, commonmeta-py can generate a formatted citation for the resource, using one of the citation styles defined in the Citation Style Language. The default style is apa
, which is the American Psychological Association 7th Edition style. The style is not only very popular and well-documented, but is one of only a few styles that has specific support for special content types, such as dataset
and software
. And unlike many other styles, it includes the DOI expressed as URL in the citation.
Sinop, A. K., & Grady, L. (2007). A Seeded Image Segmentation Framework Unifying Graph Cuts And Random Walker Which Yields A New Algorithm. In <i>2007 IEEE 11th International Conference on Computer Vision</i>. Institute of Electrical and Electronics Engineers (IEEE). https://doi.org/10.1109/iccv.2007.4408927
Chen, L., Panin, G., & Knoll, A. (2012). Human Body Orientation Estimation in Multiview Scenarios. In <i>Advances in Visual Computing</i> (pp. 499–508). Springer Science and Business Media LLC. https://doi.org/10.1007/978-3-642-33191-6_49
Ollomo, B., Durand, P., Prugnolle, F., Douzery, E. J. P., Arnathau, C., Nkoghe, D., Leroy, E., & Renaud, F. (2011). <i>Data from: A new malaria agent in African hominids.</i> (Version 1) [Data set]. Dryad. https://doi.org/10.5061/dryad.8515
Let’s try out a few popular citation styles:
1. Sankar M, Nieminen K, Ragni L, Xenarios I, Hardtke CS. Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. <i>eLife</i>. 2014;3. doi:10.7554/elife.01567
[1]M. Sankar, K. Nieminen, L. Ragni, I. Xenariosand C. S. Hardtke, “Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth”, <i>eLife</i>, vol. 3, Feb. 2014, doi: 10.7554/elife.01567.
Sankar, Martial, Kaisa Nieminen, Laura Ragni, Ioannis Xenarios, and Christian S Hardtke. 2014. “Automated Quantitative Histology Reveals Vascular Morphodynamics During Arabidopsis Hypocotyl Secondary Growth”. <i>Elife</i> 3 (February). https://doi.org/10.7554/elife.01567.
The other option in the citation writer is the locale, which is the language in which the citation is written (words like dates, not the metadata that comes from Crossref). The default locale is en-US
, we use es-ES
here. The locales are defined in the Citation Style Language repository. I am using an example from Crossref where the metadata are also in Spanish.