- 1 Overview
- 2 Workflow
- 2.1 Handshaking from the Dryad Perspective
- 2.2 Handshaking from the TreeBASE Perspective
- 2.3 Process for completing a submission within TreeBASE
- 3 Debugging
- 4 Running Via Script
- 5 Implementation
This pages describes the Dryad BagIt Handshaking module. This module enables Dryad to share data packages with other repositories using BagIt as a transfer protocol. Currently, it is used to share NEXUS data between Dryad and TreeBASE.
Handshaking from the Dryad Perspective
There are three possible ways that Dryad may integrate with TreeBASE.
User Submits to Dryad First
- User submits Nexus to Dryad and selects to send the file to TreeBASE in the final stage of submission.
- Dryad pushes object to TreeBASE. (This is before the object is curated in Dryad)
- Metadata (converted to Dryad Application Profile) and all uploaded nexus files are packed into a BagIt package and pushed to TreeBASE
- TreeBASE has a PUT RESTful service for receiving data
- TreeBASE only accepts the PUT if the sender's IP is within the Dryad range
- TreeBASE responds by returning an URL
- Dryad emails the user to inform that file(s) have been uploaded to TreeBASE and includes a URL to start submission at TreeBASE
- User goes to TreeBASE and completes record.
- Upon the user logging in, TreeBASE is triggered to unpack the !BagIt package and create a submission based on the contents
- Dryad harvests TreeBASE content and picks up any additional relevant metadata or updated files.
User Submits to TreeBASE First, Links from Dryad Record
- User submits/edits package in Dryad and includes a TB ID
- Dryad adds TB ID to the record and creates a link to the HTML view of the TB record
- Dryad curator checks link to confirm that TB ID looks valid (we decided to leave ID in record if the link isn't active yet but looks like a valid TB ID).
- General link checking software will be run to catch dead links that have been dead for awhile.
User submits to TreeBASE, Dryad harvests only
- Treat as any other harvested content (second class)
Handshaking from the TreeBASE Perspective
- Dryad offers an option to upload files to TreeBASE for Dryad submissions that have phylogenetic data
- Choosing this causes Dryad to send a BagIt package to TreeBASE via rest service: http://www.treebase.org/treebase-web/handshaking/dryadImport (there is a different URL for testing -- http://treebasedb-dev.nescent.org/treebase-web)
- The REST service stores the BagIt package and returns a unique URL as a string, resembling: "~/treebase-web/login.jsp?importKey=123456789"
- Dryad emails this URL to the user and asks the user to follow it so as to finish the submission on the TreeBASE website
- Whoever follows the URL will have the ownership of the data. The user is confronted with a login page, including the option of creating a new account. If a new account is required, so long as the user remains within the same session (i.e. does not start a new browser), the !BagIt is unpacked and the contents become parked under a new submission that is created in the user's account.
- The user can open the new submission and continue filling in information. The new submission should have citation information already filled in and any NEXUS files in the !BagIt will have been parsed and stored.
- TreeBASE does not make content available until the associated article is published.
Process for completing a submission within TreeBASE
- nexus file
- at least one tree OR at least one matrix
- if there is a tree and a matrix, the taxon labels must match up.
- must be "understood" by Mesquite
- analysis info linking matrices and trees
- create account
- create new submission
- type title
- the submission gets a PURL at this point
- the PURL can have a code added for reviewer access
- fill in citation
- minimum: year, title, journal name (or book/section title)
- journal names auto-suggest as you type
- add authors
- minimum: at least one author (with first name and last name)
- must always search for an existing author first, even if you know they're not in the system
- allows reordering or deleting authors while you're in the process
- upload file(s)
- minimum: must be nexus, as described above
- (optional) add notes
- this is a textarea, with a reasonable character limit (not enough for a readme file)
- (optional) edit details for matrices
- (optional) edit row segment template
- minimum: row ID, start index, end index
- (optional) provide more details for trees
- (optional) taxa
- match all named taxa against ubio or ncbi
- although the cleanup is optional, the TB editor may reject it if it's not cleaned up
- minimum: create an analysis with at least one step. Typically, this will be a matrix that is processed to create one or more trees.
- minimum: otu labels must match in the analysis steps
- when initial submission complete, user clicks "change to ready state"
- this triggers the curator to look at it
- user can leave items as "in progress" as long as they want -- this is a "poor man's embargo" system
If changes in the metadata break the metadata crosswalk, the first place to look should be in the DRYAD-V3 metadata crosswalk (in the crosswalks folder in the config directory). Since it can be cumbersome to test this piece, try adding a root element to the XML that is generated as a result of the crosswalk. Do this by wrapping the contents of the root XSLT template in a root element. This should be in the XSLT already and just need to be uncommented.
The next step to debugging a metadata crosswalk failure is to use the XMLVERBATIM metadata crosswalk that is also in the crosswalks folder inside of the config directory. This XSLT will just spit out the XML that is coming out of the DSpace Item to XML transformation. Looking at this should enable you to determine where the Dryad stylesheet varies from the output XML.
Running Via Script
There is a script that exports Dryad data packages and requested data files into the BagIt format and sends the BagIt package to the TreeBASE web service. The script is implemented as DSpace package disseminator and can be run through the standard DSpace disseminator script. For example:
/opt/dryad/bin/dspace packager -d -i 10255/dryad.630 -e email@example.com -o xwalk=DRYAD-V3 -o repo=TREEBASE -o 'files=10255/dryad.631;10255/dryad.632;10255/dryad.633;10255/dryad.634' -t BAGIT -
/opt/dryad/bin/dspace = the standard DSpace interface to calling scripts from the command line; this must be run as the same user as the Tomcat serving DSpace is run as.
packager -d = the specific DSpace packager script; the -d tells it to run the packager to disseminate (there isn't a bagit ingester yet, but -i would be used if there were).
-i 10255/dryad.630 = the Dryad data package's pseudo-handle (that DSpace uses as an internal identifier); this must be the pseudo-handle of a data package, not a data file.
-e firstname.lastname@example.org = the email address of the person who is making the submission to Dryad; we have this because someone must be logged in in order to submit to Dryad.
-o xwalk=DRYAD-V3 = this is a hard-coded value at the moment (will always be the same); it says to export the metadata stored in DSpace in the Dryad Application Metadata Profile format (version 3 is the latest version).
-o repo=TREEBASE = this is also hard-coded for TreeBASE; repo just indicates the remote repository to which the bagit file should be uploaded to (in the future, Dryad may send !BagIt files to other repositories as well).
-o files=10255/dryad.631;10255/dryad.632;10255/dryad.633;10255/dryad.634 = the list of data files, associated with the data package, that the submitter wants exported to TreeBASE; it may not be all the data files, but all the files of a particular type (for instance, in the case of TreeBASE, Nexus files). For calling the script from the command line, this argument will probably have to be enclosed in single quotes (see the example above).
-t BAGIT = the package disseminator that should be used to export the files; in the case of TreeBASE, this is always hard-coded to BAGIT because that is the format that the TreeBASE importer supports.
- = This indicates that output should be sent to the command line; currently, the script follows the UNIX philosophy that 'no response' is an indicator of success (optionally, the code can be uncommented to allow the output of 'success' on a successful export). If there is a problem, an exception will be thrown and an email with details will be sent to the address configured as the DSpace admin.
The BagIt disseminator is implemented as a DSpace plugin.
- It is configured in dspace.cfg
- Java code is in modules/bagit/dspace-bagit-api/src/main/java/org/dspace/content/packager
- XSL for transforming the metadata is in config/crosswalks/dryad-v3.xsl