Skip to content

myExperiment/workflow_parser-t2flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Taverna 2 parser Gem

Authors

Finn Bacall, Robert Haines, Mannie Tagarira, David Withers, Stian Soiland-Reyes, Don Cruickshank

Contact

support@mygrid.org.uk

URL

www.taverna.org.uk/

Licence

LGPL 3 (See LICENCE or www.gnu.org/licenses/lgpl.html)

Copyright

© 2008-2014, University of Manchester, UK

<img src=“https://travis-ci.org/myExperiment/taverna-t2flow-parser.svg” alt=“Build Status” /> <img src=“https://coveralls.io/repos/myExperiment/taverna-t2flow-parser/badge.png?branch=master” alt=“Coverage Status” />

Synopsis

This is a Ruby library to support parsing Taverna version 2 workflows (T2Flows). This relies on the functionality provided by the libxml-ruby library. To be able to utilise this gem to its full potential, you will need to have the following installed on your system.

The T2Flow Model Implementation

Much like the Taverna 1 Scufl model, T2Flows contain Processors, Sinks, and Sources. T2Flows however, encapsulate these elements within Dataflow objects. A Dataflow objects is the container for all the different elements present within the Taverna 2 workflows, hence a single T2Flow may have one or more dataflows. WorkflowDescriptions and Links, from the original Taverna 1 workflows (Scufl), have been renamed in T2Flows to DataflowAnnotations and Datalinks respectively. DataflowAnnotations, however, allow for multiple titles, authors, and descriptions, as opposed to the single value attributes held for Scufls.

Installation

To install the Taverna 2 gem taverna-t2flow, type into your command prompt:

[sudo] gem install taverna-t2flow

Usage

To be able to use this gem, you need to require the library:

require 'taverna-t2flow'

t2flow models

To generate the model you can then use the gem as follows:

foo = File.new("path/to/workflow/file", "r")
bar = T2Flow::Parser.new.parse(foo)

Alternatively:

foo = File.new("path/to/workflow/file", "r").read
bar = T2Flow::Parser.new.parse(foo)

You will then be able to use your T2Flow model to retrieve information about the workflow by invoking the different methods and attributes.

bar.INVOKED

… where INVOKED is the method or attribute required.

You can also parse remote workflows.

require "open-uri"

foo = Uri.parse("xxxx://uri_to_workflow").read
bar = T2Flow::Parser.new.parse(foo)

t2flow diagrams

To be able to use any diagram functionality included in thsi gem you need to have GraphViz installed on your system. Once this package has been installed, you may use the gem to draw an image showing the structure of the T2Flow as follows.

out_file = File.new("path/to/file/you/want/the/dot/script/to/be/written", "w+")
T2Flow::Dot.new.write_dot(out_file, bar)
`dot -Tpng -o"path/to/the/output/image" #{out_file.path}`

The last line draws a PNG image using out_file. To learn more about dot, try typing into your command prompt:

% man dot

or

% dot -h

wfdesc

To convert a t2flow to a wfdesc graph (in RDF Turtle format):

require 't2flow/workflowprocessor'

open("workflow.t2flow") do |file|
  wfdesc = T2Flow::WorkflowProcessor.extract_rdf_structure(file.read)
  puts wfdesc
end

References

1

taverna.sourceforge.net

2

www.graphviz.org

3

purl.org/wf4ever/model#wfdesc

About

A Ruby library to aid the interaction with Taverna 2 workflows.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages