Chapter 6 Editing system metadata

Every object on the ADC (or the KNB) has “system metadata”. An object’s system metadata have information about the file itself, such as the name of the file (fileName), the format (formatId), who the rightsHolder is, what the accessPolicy is, and more. Sometimes we will need to edit system metadata in order to make sure that things on the webpage display correctly, or to ensure a file downloads from the website with the correct file name and extension.

Although the majority of system metadata changes that need to be made are done automatically, sometimes we need to change aspects of the system metadata (or ‘sysmeta’ for short) manually.

6.1 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)

6.1.1 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).

6.1.2 Additional resources

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

6.2 Exercise 5

Sometimes the system doesn’t recognize the file types properly. For example you have a csv file but the File type on the website says Microsoft Excel

  • Read the system metadata in from the data file you uploaded previously.
  • Check to make sure the fileName and formatId are set correctly (the extension in fileName should match the formatId).
  • Update the system metadata if necessary. CSVs have the formatId “text/csv”.