ropensci / datapack

An R package to handle data packages
https://docs.ropensci.org/datapack
44 stars 9 forks source link

Properly handle DataPackages with only one member and no relationships #55

Closed gothub closed 8 years ago

gothub commented 8 years ago

A DataPackage might only contain a metadata object and no DataObjects, as in the use case that a user is uploading a package via dataone R package that refers to datasets residing at another location (other than the mn).

Processing this type of DataPackage causes errors, such as:

library(datapack)
library(datapack)
sampleEML <- system.file("extdata/sample-eml.xml", package="dataone")
metadataObj <- new("DataObject", format="eml://ecoinformatics.org/eml-2.1.1", file=sampleEML)
dp <- new("DataPackage")
dp <- addData(dp, metadataObj)
rels <- getRelationships(dp)
 Error in order(relationships$subject, relationships$predicate, relationships$object) : 
  argument 1 is not a vector 

Check all methods to ensure that checks for package relationships handle this case, and that resource maps are built correctly.

This error is also seen when calling dataone::uploadDataPackage()

gothub commented 8 years ago

Updated getRelationships(), serializePackage() to properly handle packages that contain no package relationships defined by the user (this doesn't affect basic OAI-ORE package relationships required in the resource map, i.e. 'accumulatedBy'). Updated in commit f5c72617414dfee1ffbf7160202444bc30cc809c