Project

General

Profile

Feature #6628

Add copy/paste R and Matlab code snippet for downloading a DataONE package

Added by Lauren Walker almost 6 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Start date:
11/24/2014
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:

Description

In the Metadata View, add a small textbox where the user can copy/paste R code that will download the current package from DataONE.

History

#1 Updated by Lauren Walker almost 5 years ago

  • Target version set to 1.9.0

#2 Updated by Lauren Walker almost 5 years ago

  • Target version changed from 1.9.0 to 1.12.0

#3 Updated by Lauren Walker over 4 years ago

  • Target version changed from 1.12.0 to 1.11.0

#4 Updated by Lauren Walker over 4 years ago

  • Subject changed from Add copy/paste R code snippet for downloading a DataONE package to Add copy/paste R and Matlab code snippet for downloading a DataONE package

#5 Updated by Chris Jones over 4 years ago

Hi Lauren,

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:

library(dataone)
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.

#9 Updated by Lauren Walker over 4 years ago

  • Target version changed from 1.11.0 to 1.12.0

#10 Updated by Chris Jones over 4 years ago

Lauren,
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:

import org.dataone.client.run.RunManager;
mgr = RunManager.getInstance();
mgr.configuration.authentication_token='<token-goes-here>';

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.

#11 Updated by Matt Jones over 4 years ago

Note this thread about how to name the token. Turns out this is confusing for at least one of our experienced R users.

https://github.com/DataONEorg/rdataone/issues/139

#12 Updated by Lauren Walker over 4 years ago

Thanks Chris, I will change the token code snipper for Matlab.

#13 Updated by Lauren Walker about 4 years ago

  • Target version changed from 1.12.0 to 1.X.0

Also available in: Atom PDF