Page MenuHomeSoftware Heritage

Implement citation button for directories with codemeta or CFF
Closed, MigratedEdits Locked

Description

We would like to propose a citation button in the permalinks box.

GitHub has announced the "cite this repository" functionality in July 2021 with a CITATION.cff file accesible in the repository.

An example from GitHub:
In this repository the preferred citation is a conference paper and here is the output:

@inproceedings{Goldman_Hierarchical_Task_Network,
author = {Goldman, Robert P. and Kuter, Ugur},
title = {{Hierarchical Task Network Planning in Common Lisp: the case of SHOP3}}
}

When the preferred citation is not specified, it is the software that is cited with a @misc.

How should we do it in SWH:

We wish to build a similar functionality, the MVP should address the software citation with a @software type, following the documentation from Inria's GT-SW-CITATION documentation:
https://gitlab.inria.fr/gt-sw-citation/bibtex-sw-entry

  1. a codemeta.json or citation.cff are available in the repository
  2. in the permalink tab:

Case A:

    • a release or tagged artifact is selected (let's us use the tag for the required field "version"
    • or a version is identified in the file (codemeta.json / CFF)
  • create a @softwareversion citation

When a revision/release is cited:
swhid = directory complete swhid (not revision / release)
repository = origin

@softwareversion {delebecque:hal-02090402-condensed,
  title = {Scilab},
  author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice 
    and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe},
  url = {https://www.scilab.org/},
  date = {1994-01},
  file = {https://hal.inria.fr/hal-02090402/file/scilab-1.1.tar.gz},
  institution = {Inria},
  license = {Scilab license},
  hal_id = {hal-02090402},
  hal_version = {v1},
  swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a;
	   origin=https://hal.archives-ouvertes.fr/hal-02090402},
  version = {1.1},
  note = {First Scilab version. It was distributed by anonymous ftp.},
  repository= {https://github.com/scilab/scilab},
  abstract = {Software for Numerical Computation freely distributed.}
}

Case B:

  • create a @software citation

When an origin is cited:
repository = origin

@software {delebecque:hal-02090402,
  title = {Scilab},
  author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice 
    and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe},
  date = {1994},
  institution = {Inria},
  license = {Scilab license},
  hal_id = {hal-02090402},
  hal_version = {v1},
  url = {https://www.scilab.org/},
  abstract = {Software for Numerical Computation freely distributed.},
  repository= {https://github.com/scilab/scilab},
}

Case C:

  • algorithm citation with @codefragment

When lines are selected in a file:
swhid = complete content swhid with lines
crossref = sw-title
repository = origin

@software {parmap,
  title = {The Parmap library},
  author = {Di Cosmo, Roberto and Marco Danelutto},
  date = {2020},
  version = {1.1.1},
  institution = {{Inria} and {University of Paris} and {University of Pisa}},
  license = {LGPL-2.0},
  url = {https://rdicosmo.github.io/parmap/},
  repository= {https://github.com/rdicosmo/parmap},
}

@codefragment {simplemapper,
  subtitle = {Core mapping routine},
  swhid = {swh:1:cnt:43a6b232768017b03da934ba22d9cc3f2726a6c5;
      lines=192-228;
      origin=https://github.com/rdicosmo/parmap},
  crossref = {parmap}
}