Edit sysmeta

To edit the sysmeta of an object (data file, EML, or resource map, etc.) with a PID, first load the sysmeta into R using the following command:

sysmeta <- getSystemMetadata(d1c_test@mn, pid)

Then edit the sysmeta slots by using @ functionality. For example, to change the fileName use the following command:

sysmeta@fileName <- 'NewFileName.csv'

Note that some slots cannot be changed by simple text replace (particularly the accessPolicy). There are various helper functions for changing the accessPolicy and rightsHolder such as datapack::addAccessRule() (which takes the sysmeta as an input) or arcticdatautils::set_rights_and_access(), which only requires a PID. In general, you most frequently need to use dataone::getSystemMetadata() to change either the formatId or fileName slots (see the DataONE list of format ids) for acceptable formats.

# Example of setting the formatId slot
sysmeta@formatId <- "eml://ecoinformatics.org/eml-2.1.1"

After you have changed the necessary slot, you can update the system metadata using the following command:

updateSystemMetadata(mn, pid, sysmeta)

Identifiers and sysmeta

Importantly, changing the system metadata does NOT necessitate a change in the PID of an object. This is because changes to the system metadata do not change the object itself, they are only changing the description of the object (although ideally the system metadata are accurate when an object is first published).

Additional resources

For a more in-depth (and technical) guide to sysmeta, check out the DataONE documentation: