ropensci / datapack

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

insertRelationships() should return a DataPackage object #48

Closed gothub closed 8 years ago

gothub commented 8 years ago

insertRelationships updated a DataObject by updating a slot that contains a hash. This allows the method to work without returning a DataPackage object, so for example, the following works:

dp <- new("DataPackage")
# Create a relationship
insertRelationship(dp, "/Users/smith/scripts/genFields.R",
   "http://www.w3.org/ns/prov#used",
   "https://knb.ecoinformatics.org/knb/d1/mn/v1/object/doi:1234/_030MXTI009R00_20030812.40.1")

Return the updated DataPackage, to prevent confusion and allow for the standard R way of doing things:

dp <- new("DataPackage")
# Create a relationship
dp <- insertRelationship(dp, "/Users/smith/scripts/genFields.R",
   "http://www.w3.org/ns/prov#used",
   "https://knb.ecoinformatics.org/knb/d1/mn/v1/object/doi:1234/_030MXTI009R00_20030812.40.1")
gothub commented 8 years ago

BTW - addData has this same behaviour and will be updated as well.

gothub commented 8 years ago

insertRelationship now returns a DataPackage with commit 551b86d1ff08c15225b0b2a3e8e315e856c4adf3

addData now returns the updated DataPackage with commit 28368f2dcd0b63f4fc82af96f0046911e8b9f0d5