update_object: Update an object with a new file

View source: R/editing.R

update_objectR Documentation

Update an object with a new file

Description

This is a convenience wrapper around dataone::updateObject() which copies in fields from the old object's System Metadata such as the rightsHolder and accessPolicy and updates only what needs to be changed.

Usage

update_object(mn, pid, path, format_id = NULL, new_pid = NULL, sid = NULL)

Arguments

mn

(MNode) The Member Node to update the object on.

pid

(character) The PID of the object to update.

path

(character) The full path to the file to update with.

format_id

(character) Optional. The format ID to set for the object. When not set, guess_format_id() will be used to guess the format ID. Should be a DataONE format ID.

new_pid

(character) Optional. Specify the PID for the new object. Defaults to automatically generating a new, random UUID-style PID.

sid

(character) Optional. Specify a Series ID (SID) to use for the new object.

Value

(character) The PID of the updated object.

Examples

## Not run: 
cn <- CNode("STAGING2")
mn <- getMNode(cn,"urn:node:mnTestKNB")
pid <- "urn:uuid:23c7cae4-0fc8-4241-96bb-aa8ed94d71fe"
my_path <- "/home/Documents/myfile.csv"
new_pid <- update_object(mn, pid, my_path, format_id = "text/csv")

## End(Not run)

NCEAS/arcticdatautils documentation built on Aug. 28, 2023, 12:10 p.m.