Publish an object

Objects (data files, xml metadata files) can be published to a DataONE node using the function publish_object() from the arcticdatautils R Package. To publish an object, you must first get the formatId of the object you want to publish. A few common formatIds are listed below.

# .csv file
formatId <- "text/csv"

# .txt file
formatId <- "text/plain"

# metadata file
formatId <- "https://eml.ecoinformatics.org/eml-2.2.0"
# OR
formatId <- format_eml("2.2.0")

Most objects have registered formatIds that can be found on the DataONE Object Format List here. Always use the “Id:” (2nd line) from the DataONE Object Format List and ensure it is copied EXACTLY. Metadata files (as shown above) use a special function to set the formatId. If the formatId is not listed at the DataONE website, you can set formatId <- "application/octet-stream".

If you want to change the formatId please use updateSystemMetadata instead.

Once you know the appropriate formatId you can publish an object using these commands:

path <- "path/to/your/file"
formatId <- "your/formatId"

pid <- publish_object(adc_test,
                      path = path,
                      format_id = formatId) # note that the output of this function is the PID of the newly published object

After publishing the object, the PID will need to be added to a resource map by updating or creating a resource map. Additionally, the rights and access for the object must be set. However, you only need to give other people rights and access to objects to objects that are not yours, for the training you don’t need to do this.