publish_update: Publish an updated data package

View source: R/editing.R

publish_updateR Documentation

Publish an updated data package

Description

Publish an update to a data package after updating data files or metadata.

Usage

publish_update(
  mn,
  metadata_pid,
  resource_map_pid,
  data_pids = NULL,
  child_pids = NULL,
  metadata_path = NULL,
  identifier = NULL,
  use_doi = FALSE,
  parent_resmap_pid = NULL,
  parent_metadata_pid = NULL,
  parent_data_pids = NULL,
  parent_child_pids = NULL,
  public = TRUE,
  check_first = TRUE,
  format_id = NULL
)

Arguments

mn

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

metadata_pid

(character) The PID of the EML metadata document to be updated.

resource_map_pid

(character) The PID of the resource map for the package.

data_pids

(character) PID(s) of data objects that will go in the updated package.

child_pids

(character) Optional. Child packages resource map PIDs.

metadata_path

(character or eml) Optional. An eml class object or a path to a metadata file to update with. If this is not set, the existing metadata document will be used.

identifier

(character) Manually specify the identifier for the new metadata object.

use_doi

(logical) Generate and use a DOI as the identifier for the updated metadata object.

parent_resmap_pid

(character) Optional. PID of a parent package to be updated. Not optional if a parent package exists.

parent_metadata_pid

(character) Optional. Identifier for the metadata document of the parent package. Not optional if a parent package exists.

parent_data_pids

(character) Optional. Identifier for the data objects of the parent package. Not optional if the parent package contains data objects.

parent_child_pids

(character) Optional. Resource map identifier(s) of child packages in the parent package. resource_map_pid should not be included. Not optional if the parent package contains other child packages.

public

(logical) Optional. Make the update public. If FALSE, will set the metadata and resource map to private (but not the data objects). This applies to the new metadata PID and its resource map and data object. access policies are not affected.

check_first

(logical) Optional. Whether to check the PIDs passed in as arguments exist on the MN before continuing. Checks that objects exist and are of the right format type. This speeds up the function, especially when data_pids has many elements.

format_id

(character) Optional. When omitted, the updated object will have the same formatId as metadata_pid. If set, will attempt to use the value instead.

Details

This function can be used for a variety of tasks:

  • Publish an existing package with a DOI

  • Update a package with new data objects

  • Update a package with new metadata

The metadata_pid and resource_map_pid provide the identifier of an EML metadata document and associated resource map, and the data_pids vector provides a list of PIDs of data objects in the package. Update the metadata file and resource map by generating a new identifier (a DOI if use_doi = TRUE) and updating the Member Node with a public version of the object. If metadata_file is not missing, it should be an edited version of the metadata to be used to update the original. If parent_resmap_pid is not missing, it indicates the PID of a parent package that should be updated as well, using the parent_metadata_pid, parent_data_pids, and parent_child_pids as members of the updated package. In all cases, the objects are made publicly readable.

Value

(character) Named character vector of PIDs in the data package, including PIDs for the metadata, resource map, and data objects.

Examples

## Not run: 
cn <- CNode("STAGING2")
mn <- getMNode(cn,"urn:node:mnTestKNB")

rm_pid <- "resource_map_urn:uuid:23c7cae4-0fc8-4241-96bb-aa8ed94d71fe"
meta_pid <- "urn:uuid:23c7cae4-0fc8-4241-96bb-aa8ed94d71fe"
data_pids <- c("urn:uuid:3e5307c4-0bf3-4fd3-939c-112d4d11e8a1",
"urn:uuid:23c7cae4-0fc8-4241-96bb-aa8ed94d71fe")

meta_path <- "/home/Documents/myMetadata.xml"

publish_update(mn, meta_pid, rm_pid, data_pids, meta_path, public = TRUE)

## End(Not run)

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