Class: T2Flow::Model
- Inherits:
-
Object
- Object
- T2Flow::Model
- Defined in:
- lib/t2flow/model.rb
Overview
The model for a given Taverna 2 workflow.
Instance Attribute Summary collapse
-
#dataflows ⇒ Object
The list of all the dataflows that make up the workflow.
-
#dependencies ⇒ Object
The list of any dependencies that have been found inside the workflow.
Instance Method Summary collapse
-
#all_datalinks ⇒ Object
Retrieve ALL the datalinks within a nested workflow.
-
#all_processors ⇒ Object
Retrieve ALL the processors found in a nested workflow.
-
#all_sinks ⇒ Object
Retrieve ALL the sinks(outputs) within the workflow.
-
#all_sources ⇒ Object
Retrieve ALL the sources(inputs) within the workflow.
-
#annotations ⇒ Object
Retrieve the annotations specific to the workflow.
-
#beanshells ⇒ Object
Retrieve ALL the processors containing beanshells within the workflow.
-
#dataflow(df_id) ⇒ Object
Retrieve the dataflow with the given ID.
-
#datalinks ⇒ Object
Retrieve the datalinks from the top level of a nested workflow.
-
#initialize ⇒ Model
constructor
Creates an empty model for a Taverna 2 workflow.
-
#main ⇒ Object
Retrieve the top level dataflow ie the MAIN (containing) dataflow.
-
#model_id ⇒ Object
Retrieve the unique dataflow ID for the top level dataflow.
-
#processors ⇒ Object
Retrieve processors from the top level of a nested workflow.
-
#sinks ⇒ Object
Retrieve the sinks(outputs) to the workflow.
-
#sources ⇒ Object
Retrieve the sources(inputs) to the workflow.
Constructor Details
#initialize ⇒ Model
Creates an empty model for a Taverna 2 workflow.
14 15 16 |
# File 'lib/t2flow/model.rb', line 14 def initialize @dataflows = [] end |
Instance Attribute Details
#dataflows ⇒ Object
The list of all the dataflows that make up the workflow.
8 9 10 |
# File 'lib/t2flow/model.rb', line 8 def dataflows @dataflows end |
#dependencies ⇒ Object
The list of any dependencies that have been found inside the workflow.
11 12 13 |
# File 'lib/t2flow/model.rb', line 11 def dependencies @dependencies end |
Instance Method Details
#all_datalinks ⇒ Object
Retrieve ALL the datalinks within a nested workflow
47 48 49 50 51 52 53 54 55 |
# File 'lib/t2flow/model.rb', line 47 def all_datalinks links = [] @dataflows.each { |dataflow| dataflow.datalinks.each { |link| links << link } } return links end |
#all_processors ⇒ Object
Retrieve ALL the processors found in a nested workflow
70 71 72 73 74 75 76 77 78 |
# File 'lib/t2flow/model.rb', line 70 def all_processors procs =[] @dataflows.each { |dataflow| dataflow.processors.each { |proc| procs << proc } } return procs end |
#all_sinks ⇒ Object
Retrieve ALL the sinks(outputs) within the workflow
102 103 104 105 106 107 108 109 110 |
# File 'lib/t2flow/model.rb', line 102 def all_sinks sinks =[] @dataflows.each { |dataflow| dataflow.sinks.each { |sink| sinks << sink } } return sinks end |
#all_sources ⇒ Object
Retrieve ALL the sources(inputs) within the workflow
86 87 88 89 90 91 92 93 94 |
# File 'lib/t2flow/model.rb', line 86 def all_sources sources =[] @dataflows.each { |dataflow| dataflow.sources.each { |source| sources << source } } return sources end |
#annotations ⇒ Object
Retrieve the annotations specific to the workflow. This does not return any annotations from workflows encapsulated within the main workflow.
59 60 61 |
# File 'lib/t2flow/model.rb', line 59 def annotations self.main.annotations end |
#beanshells ⇒ Object
Retrieve ALL the processors containing beanshells within the workflow.
30 31 32 33 34 35 36 37 38 |
# File 'lib/t2flow/model.rb', line 30 def beanshells beanshells = [] @dataflows.each { |dataflow| dataflow.beanshells.each { |bean| beanshells << bean } } return beanshells end |
#dataflow(df_id) ⇒ Object
Retrieve the dataflow with the given ID
24 25 26 27 |
# File 'lib/t2flow/model.rb', line 24 def dataflow(df_id) df = @dataflows.select { |x| x.dataflow_id == df_id } return df[0] end |
#datalinks ⇒ Object
Retrieve the datalinks from the top level of a nested workflow. If the workflow is not nested, retrieve all datalinks.
42 43 44 |
# File 'lib/t2flow/model.rb', line 42 def datalinks self.main.datalinks end |
#main ⇒ Object
Retrieve the top level dataflow ie the MAIN (containing) dataflow
19 20 21 |
# File 'lib/t2flow/model.rb', line 19 def main @dataflows[0] end |
#model_id ⇒ Object
Retrieve the unique dataflow ID for the top level dataflow.
113 114 115 |
# File 'lib/t2flow/model.rb', line 113 def model_id self.main.dataflow_id end |
#processors ⇒ Object
Retrieve processors from the top level of a nested workflow. If the workflow is not nested, retrieve all processors.
65 66 67 |
# File 'lib/t2flow/model.rb', line 65 def processors self.main.processors end |
#sinks ⇒ Object
Retrieve the sinks(outputs) to the workflow
97 98 99 |
# File 'lib/t2flow/model.rb', line 97 def sinks self.main.sinks end |
#sources ⇒ Object
Retrieve the sources(inputs) to the workflow
81 82 83 |
# File 'lib/t2flow/model.rb', line 81 def sources self.main.sources end |