Class: Scufl::Model
- Inherits:
-
Object
- Object
- Scufl::Model
- Defined in:
- lib/scufl/model.rb
Overview
The model for a given Taverna 1 workflow.
Instance Attribute Summary collapse
-
#coordinations ⇒ Object
readonly
Retrieve the list of coordinations specific to the workflow.
-
#dependencies ⇒ Object
The list of any dependencies that have been found inside the workflow.
-
#description ⇒ Object
readonly
This returns a WorkflowDescription object.
-
#links ⇒ Object
readonly
Retrieve the list of datalinks specific to the workflow.
-
#processors ⇒ Object
readonly
Retrieve the list of processors specific to the workflow.
-
#sinks ⇒ Object
readonly
Retrieve the list of sinks specific to the workflow.
-
#sources ⇒ Object
readonly
Retrieve the list of sources specific to the workflow.
Instance Method Summary collapse
-
#all_links ⇒ Object
Retrieve ALL the links WITHIN the given workflow model.
-
#all_processors ⇒ Object
Retrieve ALL processor objects WITHIN the given workflow model.
-
#all_sinks ⇒ Object
Retrieve ALL the sinks(outputs) WITHIN the given workflow model.
-
#all_sources ⇒ Object
Retrieve ALL the sources(inputs) WITHIN the given workflow model.
-
#beanshells ⇒ Object
Retrieve ALL the beanshell processors WITHIN the given workflow model.
-
#get_processor_links(processor) ⇒ Object
For the given dataflow, return the beanshells and/or services which have direct links to or from the given processor.
-
#initialize ⇒ Model
constructor
Creates an empty model for a Taverna 1 workflow.
-
#local_workers ⇒ Object
Retrieve ALL local workers WITHIN the workflow.
-
#web_services ⇒ Object
Retrieve ALL processors of that are webservices WITHIN the model.
Constructor Details
#initialize ⇒ Model
Creates an empty model for a Taverna 1 workflow.
35 36 37 38 39 40 41 42 |
# File 'lib/scufl/model.rb', line 35 def initialize @description = WorkflowDescription.new @processors = Array.new @links = Array.new @sources = Array.new @sinks = Array.new @coordinations = Array.new end |
Instance Attribute Details
#coordinations ⇒ Object (readonly)
Retrieve the list of coordinations specific to the workflow. Does not include those from nested workflows.
28 29 30 |
# File 'lib/scufl/model.rb', line 28 def coordinations @coordinations end |
#dependencies ⇒ Object
The list of any dependencies that have been found inside the workflow. Does not include those from nested workflows.
32 33 34 |
# File 'lib/scufl/model.rb', line 32 def dependencies @dependencies end |
#description ⇒ Object (readonly)
This returns a WorkflowDescription object.
8 9 10 |
# File 'lib/scufl/model.rb', line 8 def description @description end |
#links ⇒ Object (readonly)
Retrieve the list of datalinks specific to the workflow. Does not include those from nested workflows.
16 17 18 |
# File 'lib/scufl/model.rb', line 16 def links @links end |
#processors ⇒ Object (readonly)
Retrieve the list of processors specific to the workflow. Does not include those from nested workflows.
12 13 14 |
# File 'lib/scufl/model.rb', line 12 def processors @processors end |
#sinks ⇒ Object (readonly)
Retrieve the list of sinks specific to the workflow. Does not include those from nested workflows.
24 25 26 |
# File 'lib/scufl/model.rb', line 24 def sinks @sinks end |
#sources ⇒ Object (readonly)
Retrieve the list of sources specific to the workflow. Does not include those from nested workflows.
20 21 22 |
# File 'lib/scufl/model.rb', line 20 def sources @sources end |
Instance Method Details
#all_links ⇒ Object
Retrieve ALL the links WITHIN the given workflow model.
66 67 68 |
# File 'lib/scufl/model.rb', line 66 def all_links return get_links(self, []) end |
#all_processors ⇒ Object
Retrieve ALL processor objects WITHIN the given workflow model.
60 61 62 |
# File 'lib/scufl/model.rb', line 60 def all_processors return get_processors(self, []) end |
#all_sinks ⇒ Object
Retrieve ALL the sinks(outputs) WITHIN the given workflow model.
71 72 73 |
# File 'lib/scufl/model.rb', line 71 def all_sinks return get_sinks(self, []) end |
#all_sources ⇒ Object
Retrieve ALL the sources(inputs) WITHIN the given workflow model.
76 77 78 |
# File 'lib/scufl/model.rb', line 76 def all_sources return get_sources(self, []) end |
#beanshells ⇒ Object
Retrieve ALL the beanshell processors WITHIN the given workflow model.
45 46 47 |
# File 'lib/scufl/model.rb', line 45 def beanshells self.all_processors.select { |x| x.type == "beanshell" } end |
#get_processor_links(processor) ⇒ Object
For the given dataflow, return the beanshells and/or services which have direct links to or from the given processor.
Usage
my_processor = model.processor[0]
linked_processors = model.get_processors_linked_to(my_processor)
processors_feeding_into_my_processor = linked_processors.sources
processors_feeding_from_my_processor = linked_processors.sinks
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/scufl/model.rb', line 87 def get_processor_links(processor) return nil unless processor proc_links = ProcessorLinks.new # SOURCES sources = self.all_links.select { |x| x.sink =~ /#{processor.name}:.+/ } proc_links.sources = [] # SINKS sinks = self.all_links.select { |x| x.source =~ /#{processor.name}:.+/ } proc_links.sinks = [] temp_sinks = [] sinks.each { |x| temp_sinks << x.sink } # Match links by port into format # my_port:name_of_link_im_linked_to:its_port sources.each do |connection| link = connection.sink connected_proc_name = link.split(":")[0] my_connection_port = link.split(":")[1] if my_connection_port source = my_connection_port << ":" << connection.source proc_links.sources << source if source.split(":").size == 3 end end sinks.each do |connection| link = connection.source connected_proc_name = link.split(":")[0] my_connection_port = link.split(":")[1] if my_connection_port sink = my_connection_port << ":" << connection.sink proc_links.sinks << sink if sink.split(":").size == 3 end end return proc_links end |
#local_workers ⇒ Object
Retrieve ALL local workers WITHIN the workflow
55 56 57 |
# File 'lib/scufl/model.rb', line 55 def local_workers self.all_processors.select { |x| x.type =~ /local/i } end |
#web_services ⇒ Object
Retrieve ALL processors of that are webservices WITHIN the model.
50 51 52 |
# File 'lib/scufl/model.rb', line 50 def web_services self.all_processors.select { |x| x.type =~ /wsdl|soaplab|biomoby/i } end |