Project

General

Profile

Actions

Feature #6628

open

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

Added by Lauren Walker over 9 years ago. Updated over 7 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.

Actions #1

Updated by Lauren Walker over 8 years ago

  • Target version set to 1.9.0
Actions #2

Updated by Lauren Walker over 8 years ago

  • Target version changed from 1.9.0 to 1.12.0
Actions #3

Updated by Lauren Walker over 8 years ago

  • Target version changed from 1.12.0 to 1.11.0
Actions #4

Updated by Lauren Walker about 8 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
Actions #5

Updated by Chris Jones about 8 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.

Actions #6

Updated by Peter Slaughter about 8 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.

Actions #7

Updated by Matt Jones about 8 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.

Actions #8

Updated by Lauren Walker about 8 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.

Actions #9

Updated by Lauren Walker about 8 years ago

  • Target version changed from 1.11.0 to 1.12.0
Actions #10

Updated by Chris Jones about 8 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.

Actions #11

Updated by Matt Jones about 8 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

Actions #12

Updated by Lauren Walker about 8 years ago

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

Actions #13

Updated by Lauren Walker over 7 years ago

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

Also available in: Atom PDF