Skip to contents

uploadCollectionToZenodo() creates a collection record on Zenodo as a draft: a record with its own DOI that groups published Zenodo records, so that they can be cited together. There are two levels of collections:

  • an owner collection groups the MR1 data packages (campaigns) of one owner, e.g. all campaigns of the Swiss Ornithological Institute;

  • the community collection groups the owner collections of the BirdScan MR1 community.

The collection is described in a YAML file, see createCollectionMetadataTemplate(). The collection record:

  • links to each member with a HasPart related identifier. The links point to the concept DOI of the member, so they stay valid when a member gets a new version;

  • holds the file members.csv, with per member the concept DOI, the DOI, record ID, title, version and publication date of its latest version, its period and its Zenodo link, at the time of the upload;

  • gets the period (Collected) of its members.

With linkMembers = TRUE (default), an IsPartOf link to the concept DOI of the collection is added to each member, with addZenodoRelatedIdentifiers(). These edits of the members are not published, because the collection itself is a draft: first check and publish the collection on Zenodo, then publish the edits of the members with linkCollectionMembers() and publish = TRUE (or on Zenodo). Links can only be added to records of your own Zenodo account; members that cannot be linked are reported in a warning.

New versions. To add or remove members, add them to the members of the metadata file, increase version, and set id to the DOI of the published collection. The upload then creates a new version of the collection record. The HasPart links follow the new list of members; other related identifiers of the previous version are kept.

Usage

uploadCollectionToZenodo(
  metadata,
  token = NULL,
  sandbox = FALSE,
  community = "birdscanmr1community",
  newVersion = NULL,
  linkMembers = TRUE
)

Arguments

metadata

Path to the YAML file with the collection metadata (see createCollectionMetadataTemplate()), or a named list with the same structure.

token

Zenodo personal access token with the scopes deposit:write and deposit:actions. Default is the environment variable ZENODO_TOKEN (or ZENODO_SANDBOX_TOKEN if sandbox = TRUE). Never write the token in a script.

sandbox

logical. If TRUE, use the Zenodo sandbox (https://sandbox.zenodo.org). Default is FALSE.

community

Identifier of the Zenodo community the record is submitted to when it is published. Default is "birdscanmr1community", the BirdScan MR1 community. Use NULL for none, e.g. when testing in the sandbox.

newVersion

logical or NULL. If TRUE, create a new version of the Zenodo record given by id in the metadata; if FALSE, create a new record. Default is NULL: a new version if the metadata have a Zenodo DOI as id, otherwise a new record.

linkMembers

logical. If TRUE (default), add an IsPartOf link to the collection to each member (not published, see Description).

Value

A list, invisibly, with id (Zenodo record ID of the draft), doi (reserved DOI), conceptDoi (concept DOI of the collection), url (link to the draft on Zenodo), members (data frame, the content of members.csv), links (data frame with the result of linking each member, or NULL) and newVersion (logical).

Author

Birgen Haest

Examples

if (FALSE) { # \dontrun{
# Describe the collection: fill in the template, with the DOIs of the
# published campaign records as members
# ===========================================================================
metadataFile = file.path(".", "SOI_BirdScanMR1_collection.yaml")
createCollectionMetadataTemplate(filePath = metadataFile)

# Upload the collection as draft to the Zenodo sandbox
# ===========================================================================
draft = uploadCollectionToZenodo(
  metadata  = metadataFile,
  sandbox   = TRUE,
  community = NULL
)
draft$members

# After publishing the collection on Zenodo: publish the IsPartOf links of
# the members
# ===========================================================================
linkCollectionMembers(doi = draft$doi, sandbox = TRUE, publish = TRUE)
} # }