DataONEorg / rdataone

R package for reading and writing data at DataONE data repositories
http://doi.org/10.5063/F1M61H5X
36 stars 19 forks source link

uploadDataPackage() fails for edited package #268

Closed gothub closed 3 years ago

gothub commented 3 years ago

Using a typical workflow to compose a data package, uploadDataPackage fails to upload the package. Here is a typical workflow that involves downloading a package from DataONE, removing a package member, then adding a member for an object previously uploaded to DataONE:

library(dataone)
d1c <- D1Client("STAGING", "urn:node:mnTestARCTIC")

packageId <- "resource_map_urn:uuid:14908960-856a-4511-b4a0-8b596a31a3b8"
dp <- getDataPackage(d1c, identifier=packageId, lazyLoad=TRUE, quiet=FALSE)

#remove the zip files
zipId <- selectMember(dp, name="sysmeta@formatId", value="application/vnd.shp+zip")
removeMember(dp, zipId, removeRelationships = T)
metadataId <- selectMember(dp, name="sysmeta@formatId", value="https://eml.ecoinformatics.org/eml-2.2.0")
#add an existing data object
dataObj <- getDataObject(d1c, id="urn:uuid:48d36037-5fbb-4191-951e-4035f8f07cd1", lazyLoad=T, limit="1TB")
dp <- addMember(dp, dataObj, mo=metadataId)
myAccessRules <- data.frame(subject="http://orcid.org/0000-0001-8888-547X", permission="changePermission") 
packageId <- uploadDataPackage(d1c, dp, public=TRUE, accessRules=myAccessRules, quiet=FALSE)
Uploading a new package to member node https://test.arcticdata.io/metacat/d1/mn/v2
No DataObjects uploaded from the DataPackage, so a resource map will not be created and uploaded.

What should have happened is that uploadDataPackage() should have detected that the package contents changed, no new DataObjects needed to be uploaded and an updated resource map needs to be uploaded. Instead, nothing was uploading.

gothub commented 3 years ago

uploadDataPackage() failed for the following workflow:

This problem has been resolved in commit 3af0819582f1455c46ef781664c0b21709ce2f40