Add copy/paste R and Matlab code snippet for downloading a DataONE package
In the Metadata View, add a small textbox where the user can copy/paste R code that will download the current package from DataONE.
#5 Updated by Chris Jones over 4 years ago
I think this a great idea, and we can provide a Matlab snippet. However, it requires that the person has installed the Matlab DataONE Toolbox first for the snippet to work. We don't have an automated way to install the toolbox in Matlab, and in fact Matlab needs to be restarted on the first installation. We should probably discuss how to go about this.
#6 Updated by Peter Slaughter over 4 years ago
The complete R program to download a package from KNB, for example:
cn <- CNode()
mn <- getMNode(cn, "urn:node:KNB")
packageFileName <- getPackage(mn, "urn:uuid:5f8ba126-bb68-4429-8edb-5a5dfa078ef4")
The variable "packageFileName" is the file path of a temporary Bagit file.
The id specified has to be the package id.
#7 Updated by Matt Jones over 4 years ago
In principle this is a great idea. In practice, I'm not so sure about the code snippet from Peter, as it only provides the file in the Bagit format. What would be more useful would be to provide an instance of the DataPackage class, and show how the user can list the objects in the package (getIdentifiers()), and access the objects and metadata (getMember()) In looking at the API, it looks like we still have some work to do to make this convenient for users.
#8 Updated by Lauren Walker over 4 years ago
Chris - I think we can assume that users who use that code will have the Matlab Toolbox installed. Maybe we can include in the code snippet a Matlab comment that indicates so.
Peter and Matt - I was thinking the code would create an instance of the DataPackage class as well. If this isn't feasible yet for the R client, I can implement this later. I don't think download the .zip file via R is very useful, so I won't put that in the UI.
#10 Updated by Chris Jones over 4 years ago
It looks like you added a snippet, but I don't think it's complete. You need to instantiate the mgr object, so I think something like this would work:
mgr = RunManager.getInstance();
It doesn't really matter if mgr is already instantiated because the RunManager is a singleton, so I don't think this will be a problem.