Class: T2Flow::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/t2flow/model.rb

Overview

The model for a given Taverna 2 workflow.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeModel

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

#dataflowsObject

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

#dependenciesObject

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_sinksObject

Retrieve ALL the sinks(outputs) within the workflow



91
92
93
94
95
96
97
98
99
# File 'lib/t2flow/model.rb', line 91

def all_sinks
  sinks =[]
  @dataflows.each { |dataflow|
    dataflow.sinks.each { |sink|
      sinks << sink
    }
  }
  return sinks
end

#all_sourcesObject

Retrieve ALL the sources(inputs) within the workflow



75
76
77
78
79
80
81
82
83
# File 'lib/t2flow/model.rb', line 75

def all_sources
  sources =[]
  @dataflows.each { |dataflow|
    dataflow.sources.each { |source|
      sources << source
    }
  }
  return sources
end

#annotationsObject

Retrieve the annotations within the workflow. In the event that the workflow is nested, retrieve the top-level annotations.



54
55
56
# File 'lib/t2flow/model.rb', line 54

def annotations
  @dataflows[0].annotations
end

#beanshellsObject

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

#dataflow_idObject

Retrieve the unique dataflow ID for the top level dataflow.



102
103
104
# File 'lib/t2flow/model.rb', line 102

def dataflow_id
  @dataflows[0].dataflow_id
end

Retrieve ALL the datalinks within the workflow



41
42
43
44
45
46
47
48
49
# File 'lib/t2flow/model.rb', line 41

def datalinks
  links = []
  @dataflows.each { |dataflow|
    dataflow.datalinks.each { |link|
      links << link
    }
  }
  return links
end

#processorsObject

Retrieve ALL the processors within the workflow



59
60
61
62
63
64
65
66
67
# File 'lib/t2flow/model.rb', line 59

def processors
  procs =[]
  @dataflows.each { |dataflow|
    dataflow.processors.each { |proc|
      procs << proc
    }
  }
  return procs
end

#sinksObject

Retrieve the sinks(outputs) to the workflow



86
87
88
# File 'lib/t2flow/model.rb', line 86

def sinks
  @dataflows[0].sinks
end

#sourcesObject

Retrieve the sources(inputs) to the workflow



70
71
72
# File 'lib/t2flow/model.rb', line 70

def sources
  @dataflows[0].sources
end

#top_levelObject

Retrieve the top-level dataflow ie the MAIN (containing) dataflow



19
20
21
# File 'lib/t2flow/model.rb', line 19

def top_level
  @dataflows[0]
end