Update a package with a new data object
Once you have updated the data objects and saved the metadata to a file, we can update the metadata and use replaceMember
to update the package with the new metadata.
Make sure you have the package you want to update loaded into R using dataone::getDataPackage()
.
Publish update
Now we can update your data package to include the new data object. Assuming you have updated your data package earlier something like the below:
d1c_test <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")
packageId <- "resource_map_urn:uuid..."
dp <- getDataPackage(d1c_test, identifier=packageId, lazyLoad=TRUE, quiet=FALSE)
metadataId <- selectMember(dp, name="sysmeta@formatId", value="https://eml.ecoinformatics.org/eml-2.2.0")
#some modification to the EML here
eml_path <- arcticdatautils::title_to_file_name(doc$dataset$title)
write_eml(doc, eml_path)
dp <- replaceMember(dp, metadataId, replacement=eml_path)
You can then upload your data package:
myAccessRules <- data.frame(subject="CN=arctic-data-admins,DC=dataone,DC=org", permission="changePermission")
packageId <- uploadDataPackage(d1c_test, dp, public=FALSE, accessRules=myAccessRules, quiet=FALSE)
If a package is ready to be public, you can change the public
argument in the datapack::uploadDataPackage()
call to TRUE
.
If you want to publish with a DOI (Digital Object Identifier) instead of a UUID (Universally Unique Identifier), you need to do this when replacing the metadata using the optional newId
argument in replaceMember()
. This should only be done after the package is finalized and has been thoroughly reviewed!
doi <- dataone::generateIdentifier(d1c_test@mn, "DOI")
dp <- replaceMember(dp, metadataId, replacement=eml_path, newId=doi)
newPackageId <- uploadDataPackage(d1c_test, dp, public=TRUE, quiet=FALSE)
If there is a pre-issued DOI (researcher requested the DOI for the publication first), please do the following:
dp <- replaceMember(dp, metadataId, replacement=eml_path, newId="doi:10.../...")
newPackageId <- uploadDataPackage(d1c_test, dp, public=TRUE, quiet=FALSE)
If the package has children, see how to do this using arcticdatautils::publish_update
in the nesting section of the reference manual.
Refresh the landing page at test.arcticdata.io/#view/… for this package and then follow the “newer version” link to view the latest.