Add Related Identifiers to a Zenodo Record
Source:R/addZenodoRelatedIdentifiers.R
addZenodoRelatedIdentifiers.RdaddZenodoRelatedIdentifiers() adds related identifiers to the
metadata of a Zenodo record, e.g. an IsPartOf link from a campaign data
package to the owner collection it belongs to, or a HasPart link from a
collection to a campaign. Related identifiers that the record already has are
not added twice; existing ones are kept.
Only the metadata are changed: the files, the DOI and the version of the record stay the same, so no new version is needed. The latest version of the record is updated, whichever version's DOI (or the concept DOI) is given.
For a published record, the function opens an edit of the record and updates its metadata. With
publish = FALSE(default), the edit stays open: check it on Zenodo and publish it there (or discard it). Withpublish = TRUE, the edit is published directly. If the record already has the related identifiers in an open edit (e.g. added earlier withpublish = FALSE),publish = TRUEpublishes that edit.For an unpublished draft, the metadata of the draft are updated. The draft is never published, also not with
publish = TRUE.
Usage
addZenodoRelatedIdentifiers(
doi,
relatedIdentifiers,
token = NULL,
sandbox = FALSE,
publish = FALSE
)Arguments
- doi
DOI (e.g.
"https://doi.org/10.5281/zenodo.1234567"or"10.5281/zenodo.1234567") or record ID of the Zenodo record.related identifiers to add: a list of lists, each with
relationType(DataCite relation type, e.g."IsPartOf","HasPart","IsCitedBy") andrelatedIdentifier(e.g. a DOI URL), as in the metadata file of a data package; or a data frame with these two columns.- token
Zenodo personal access token with the scopes
deposit:writeanddeposit:actions. Default is the environment variableZENODO_TOKEN(orZENODO_SANDBOX_TOKENifsandbox = TRUE). Never write the token in a script.- sandbox
logical. If
TRUE, use the Zenodo sandbox (https://sandbox.zenodo.org). Default isFALSE.- publish
logical. If
TRUE, the edit of a published record is published directly. Default isFALSE: the edit stays open on Zenodo.
Value
A list, invisibly, with id (Zenodo record ID), url (link to the
record on Zenodo), added (number of related identifiers added) and
published (logical, whether the edit was published).
See also
Other write file functions:
checkDataPackageMetadata(),
compileData(),
createCollectionMetadataTemplate(),
createDataPackage(),
createDataPackageMetadataTemplate(),
editDataPackageMetadata(),
linkCollectionMembers(),
saveMTR(),
savePlotToFile(),
uploadCollectionToZenodo(),
uploadDataPackageToZenodo(),
validateDataPackage()
Examples
if (FALSE) { # \dontrun{
# Link a campaign data package to its owner collection (Zenodo sandbox)
# ===========================================================================
addZenodoRelatedIdentifiers(
doi = "https://doi.org/10.5281/zenodo.1234567",
relatedIdentifiers = list(list(
relationType = "IsPartOf",
relatedIdentifier = "https://doi.org/10.5281/zenodo.7654321"
)),
sandbox = TRUE
)
} # }