taverna-t2flow 0.4.5 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.rdoc +5 -0
- data/Rakefile +1 -1
- data/lib/t2flow/model.rb +34 -249
- data/lib/t2flow/model/coordination.rb +11 -0
- data/lib/t2flow/model/dataflow.rb +72 -0
- data/lib/t2flow/model/datalink.rb +12 -0
- data/lib/t2flow/model/port.rb +22 -0
- data/lib/t2flow/model/processor.rb +97 -0
- data/lib/t2flow/model/semantic_annotation.rb +20 -0
- data/lib/t2flow/parser.rb +25 -8
- data/taverna-t2flow.gemspec +10 -4
- data/test/fixtures/component_using_workflow.t2flow +24 -0
- data/test/test_component_workflows.rb +13 -0
- metadata +10 -4
- data/.rvmrc +0 -1
data/CHANGES.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Changes log for the T2Flow Ruby Gem
|
2
2
|
|
3
|
+
== Version 0.5.0
|
4
|
+
|
5
|
+
* Split out model classes into different files.
|
6
|
+
* Added +configuration+ hash to Processor model, where various type-specific attributes are stored.
|
7
|
+
|
3
8
|
== Version 0.4.5
|
4
9
|
|
5
10
|
* Add a top-level include file that matches the gem name.
|
data/Rakefile
CHANGED
data/lib/t2flow/model.rb
CHANGED
@@ -10,78 +10,85 @@
|
|
10
10
|
# This is the module containing the T2Flow model implementation i.e. the
|
11
11
|
# model structure/definition and all its internals.
|
12
12
|
|
13
|
+
require 't2flow/model/coordination'
|
14
|
+
require 't2flow/model/dataflow'
|
15
|
+
require 't2flow/model/datalink'
|
16
|
+
require 't2flow/model/port'
|
17
|
+
require 't2flow/model/processor'
|
18
|
+
require 't2flow/model/semantic_annotation'
|
19
|
+
|
13
20
|
module T2Flow # :nodoc:
|
14
|
-
|
21
|
+
|
15
22
|
# The model for a given Taverna 2 workflow.
|
16
23
|
class Model
|
17
24
|
# The list of all the dataflows that make up the workflow.
|
18
25
|
attr_accessor :dataflows
|
19
|
-
|
26
|
+
|
20
27
|
# The list of any dependencies that have been found inside the workflow.
|
21
28
|
attr_accessor :dependencies
|
22
|
-
|
29
|
+
|
23
30
|
# Creates an empty model for a Taverna 2 workflow.
|
24
31
|
def initialize
|
25
32
|
@dataflows = []
|
26
33
|
@dependencies = []
|
27
34
|
end
|
28
|
-
|
35
|
+
|
29
36
|
# Retrieve the top level dataflow's name
|
30
37
|
def name
|
31
38
|
main.name
|
32
39
|
end
|
33
|
-
|
40
|
+
|
34
41
|
# Retrieve the top level dataflow ie the MAIN (containing) dataflow
|
35
42
|
def main
|
36
43
|
@dataflows[0]
|
37
44
|
end
|
38
|
-
|
45
|
+
|
39
46
|
# Retrieve the dataflow with the given ID
|
40
47
|
def dataflow(df_id)
|
41
48
|
df = @dataflows.select { |x| x.dataflow_id == df_id }
|
42
49
|
return df[0]
|
43
50
|
end
|
44
|
-
|
51
|
+
|
45
52
|
# Retrieve ALL the processors containing beanshells within the workflow.
|
46
53
|
def beanshells
|
47
54
|
self.all_processors.select { |x| x.type == "beanshell" }
|
48
55
|
end
|
49
|
-
|
56
|
+
|
50
57
|
# Retrieve ALL processors of that are webservices WITHIN the model.
|
51
58
|
def web_services
|
52
59
|
self.all_processors.select { |x| x.type =~ /wsdl|soaplab|biomoby/i }
|
53
60
|
end
|
54
|
-
|
61
|
+
|
55
62
|
# Retrieve ALL local workers WITHIN the workflow
|
56
63
|
def local_workers
|
57
64
|
self.all_processors.select { |x| x.type =~ /local/i }
|
58
65
|
end
|
59
|
-
|
66
|
+
|
60
67
|
# Retrieve the datalinks from the top level of a nested workflow.
|
61
68
|
# If the workflow is not nested, retrieve all datalinks.
|
62
69
|
def datalinks
|
63
70
|
self.main.datalinks
|
64
71
|
end
|
65
|
-
|
72
|
+
|
66
73
|
# Retrieve ALL the datalinks within a nested workflow
|
67
74
|
def all_datalinks
|
68
75
|
links = []
|
69
76
|
@dataflows.each { |dataflow| links << dataflow.datalinks }
|
70
77
|
return links.flatten
|
71
78
|
end
|
72
|
-
|
79
|
+
|
73
80
|
# Retrieve the annotations specific to the workflow. This does not return
|
74
81
|
# any annotations from workflows encapsulated within the main workflow.
|
75
82
|
def annotations
|
76
83
|
self.main.annotations
|
77
84
|
end
|
78
|
-
|
85
|
+
|
79
86
|
# Retrieve processors from the top level of a nested workflow.
|
80
87
|
# If the workflow is not nested, retrieve all processors.
|
81
88
|
def processors
|
82
89
|
self.main.processors
|
83
90
|
end
|
84
|
-
|
91
|
+
|
85
92
|
# Retrieve ALL the processors found in a nested workflow
|
86
93
|
def all_processors
|
87
94
|
procs =[]
|
@@ -94,43 +101,43 @@ module T2Flow # :nodoc:
|
|
94
101
|
def coordinations
|
95
102
|
self.main.coordinations
|
96
103
|
end
|
97
|
-
|
104
|
+
|
98
105
|
# Retrieve ALL the coordinations found in a nested workflow
|
99
106
|
def all_coordinations
|
100
107
|
coordinations =[]
|
101
108
|
@dataflows.each { |dataflow| coordinations << dataflow.coordinations }
|
102
109
|
return coordinations.flatten
|
103
110
|
end
|
104
|
-
|
111
|
+
|
105
112
|
# Retrieve the sources(inputs) to the workflow
|
106
113
|
def sources
|
107
114
|
self.main.sources
|
108
115
|
end
|
109
|
-
|
116
|
+
|
110
117
|
# Retrieve ALL the sources(inputs) within the workflow
|
111
118
|
def all_sources
|
112
119
|
sources =[]
|
113
120
|
@dataflows.each { |dataflow| sources << dataflow.sources }
|
114
121
|
return sources.flatten
|
115
122
|
end
|
116
|
-
|
123
|
+
|
117
124
|
# Retrieve the sinks(outputs) to the workflow
|
118
125
|
def sinks
|
119
126
|
self.main.sinks
|
120
127
|
end
|
121
|
-
|
128
|
+
|
122
129
|
# Retrieve ALL the sinks(outputs) within the workflow
|
123
130
|
def all_sinks
|
124
131
|
sinks =[]
|
125
132
|
@dataflows.each { |dataflow| sinks << dataflow.sinks }
|
126
133
|
return sinks.flatten
|
127
134
|
end
|
128
|
-
|
135
|
+
|
129
136
|
# Retrieve the unique dataflow ID for the top level dataflow.
|
130
137
|
def model_id
|
131
138
|
self.main.dataflow_id
|
132
139
|
end
|
133
|
-
|
140
|
+
|
134
141
|
# For the given dataflow, return the beanshells and/or services which
|
135
142
|
# have direct links to or from the given processor.
|
136
143
|
# If no dataflow is specified, the top-level dataflow is used.
|
@@ -143,7 +150,7 @@ module T2Flow # :nodoc:
|
|
143
150
|
def get_processor_links(processor)
|
144
151
|
return nil unless processor
|
145
152
|
proc_links = ProcessorLinks.new
|
146
|
-
|
153
|
+
|
147
154
|
# SOURCES
|
148
155
|
sources = self.all_datalinks.select { |x| x.sink =~ /#{processor.name}:.+/ }
|
149
156
|
proc_links.sources = []
|
@@ -153,254 +160,32 @@ module T2Flow # :nodoc:
|
|
153
160
|
proc_links.sinks = []
|
154
161
|
temp_sinks = []
|
155
162
|
sinks.each { |x| temp_sinks << x.sink }
|
156
|
-
|
163
|
+
|
157
164
|
# Match links by port into format
|
158
165
|
# my_port:name_of_link_im_linked_to:its_port
|
159
166
|
sources.each do |connection|
|
160
167
|
link = connection.sink
|
161
168
|
connected_proc_name = link.split(":")[0]
|
162
169
|
my_connection_port = link.split(":")[1]
|
163
|
-
|
170
|
+
|
164
171
|
if my_connection_port
|
165
172
|
source = my_connection_port << ":" << connection.source
|
166
173
|
proc_links.sources << source if source.split(":").size == 3
|
167
174
|
end
|
168
175
|
end
|
169
|
-
|
176
|
+
|
170
177
|
sinks.each do |connection|
|
171
178
|
link = connection.source
|
172
179
|
connected_proc_name = link.split(":")[0]
|
173
180
|
my_connection_port = link.split(":")[1]
|
174
|
-
|
181
|
+
|
175
182
|
if my_connection_port
|
176
183
|
sink = my_connection_port << ":" << connection.sink
|
177
184
|
proc_links.sinks << sink if sink.split(":").size == 3
|
178
185
|
end
|
179
186
|
end
|
180
|
-
|
181
|
-
return proc_links
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
# The entities within the Taverna 2 mdoel which contains the different
|
188
|
-
# elements of the workflows; processors, sinks, sources, etc...
|
189
|
-
class Dataflow
|
190
|
-
# This returns a DataflowAnnotation object.
|
191
|
-
attr_accessor :annotations
|
192
|
-
|
193
|
-
# Retrieve the list of processors specific to the dataflow.
|
194
|
-
attr_accessor :processors
|
195
|
-
|
196
|
-
# Retrieve the list of datalinks specific to the dataflow.
|
197
|
-
attr_accessor :datalinks
|
198
|
-
|
199
|
-
# Retrieve the list of sources specific to the dataflow.
|
200
|
-
attr_accessor :sources
|
201
|
-
|
202
|
-
# Retrieve the list of sinks specific to the dataflow.
|
203
|
-
attr_accessor :sinks
|
204
|
-
|
205
|
-
# Retrieve the list of coordinations specific to the dataflow.
|
206
|
-
attr_accessor :coordinations
|
207
|
-
|
208
|
-
# The unique identifier of the dataflow.
|
209
|
-
attr_accessor :dataflow_id
|
210
|
-
|
211
|
-
# The role of the workflow
|
212
|
-
attr_accessor :role
|
213
187
|
|
214
|
-
|
215
|
-
def initialize
|
216
|
-
@annotations = DataflowAnnotation.new
|
217
|
-
@processors = []
|
218
|
-
@datalinks = []
|
219
|
-
@sources = []
|
220
|
-
@sinks = []
|
221
|
-
@coordinations = []
|
222
|
-
end
|
223
|
-
|
224
|
-
def name
|
225
|
-
@annotations.name
|
226
|
-
end
|
227
|
-
|
228
|
-
# Retrieve beanshell processors specific to this dataflow.
|
229
|
-
def beanshells
|
230
|
-
@processors.select { |x| x.type == "beanshell" }
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
# This is the (shim) object within the workflow. This can be a beanshell,
|
237
|
-
# a webservice, a workflow, etc...
|
238
|
-
class Processor
|
239
|
-
# A string containing name of the processor.
|
240
|
-
attr_accessor :name
|
241
|
-
|
242
|
-
# A string containing the description of the processor if available.
|
243
|
-
# Returns nil otherwise.
|
244
|
-
attr_accessor :descriptions
|
245
|
-
|
246
|
-
def description
|
247
|
-
@descriptions.first
|
248
|
-
end
|
249
|
-
|
250
|
-
# A string for the type of processor, e.g. beanshell, workflow, webservice, etc...
|
251
|
-
attr_accessor :type
|
252
|
-
|
253
|
-
# For processors that have type "dataflow", this is the the reference
|
254
|
-
# to the dataflow. For all other processor types, this is nil.
|
255
|
-
attr_accessor :dataflow_id
|
256
|
-
|
257
|
-
# This only has a value in beanshell processors. This is the actual script
|
258
|
-
# embedded with the processor which does all the "work"
|
259
|
-
attr_accessor :script
|
260
|
-
|
261
|
-
# This is a list of inputs that the processor can take in.
|
262
|
-
attr_accessor :inputs
|
263
|
-
|
264
|
-
# This is a list of outputs that the processor can produce.
|
265
|
-
attr_accessor :outputs
|
266
|
-
|
267
|
-
# For processors of type "arbitrarywsdl", this is the URI to the location
|
268
|
-
# of the wsdl file.
|
269
|
-
attr_accessor :wsdl
|
270
|
-
|
271
|
-
# For processors of type "arbitrarywsdl", this is the operation invoked.
|
272
|
-
attr_accessor :wsdl_operation
|
273
|
-
|
274
|
-
# For soaplab and biomoby services, this is the endpoint URI.
|
275
|
-
attr_accessor :endpoint
|
276
|
-
|
277
|
-
# Authority name for the biomoby service.
|
278
|
-
attr_accessor :biomoby_authority_name
|
279
|
-
|
280
|
-
# Service name for the biomoby service. This is not necessarily the same
|
281
|
-
# as the processors name.
|
282
|
-
attr_accessor :biomoby_service_name
|
283
|
-
|
284
|
-
# Category for the biomoby service.
|
285
|
-
attr_accessor :biomoby_category
|
286
|
-
|
287
|
-
# Value for string constants
|
288
|
-
attr_accessor :value
|
289
|
-
|
290
|
-
attr_accessor :semantic_annotation
|
291
|
-
|
292
|
-
def initialize
|
293
|
-
@descriptions = []
|
294
|
-
end
|
295
|
-
|
296
|
-
end
|
297
|
-
|
298
|
-
|
299
|
-
# This object is returned after invoking model.get_processor_links(processor)
|
300
|
-
# . The object contains two lists of processors. Each element consists of:
|
301
|
-
# the input or output port the processor uses as a link, the name of the
|
302
|
-
# processor being linked, and the port of the processor used for the linking,
|
303
|
-
# all seperated by a colon (:) i.e.
|
304
|
-
# my_port:name_of_processor:processor_port
|
305
|
-
class ProcessorLinks
|
306
|
-
# The processors whose output is fed as input into the processor used in
|
307
|
-
# model.get_processors_linked_to(processor).
|
308
|
-
attr_accessor :sources
|
309
|
-
|
310
|
-
# A list of processors that are fed the output from the processor (used in
|
311
|
-
# model.get_processors_linked_to(processor) ) as input.
|
312
|
-
attr_accessor :sinks
|
313
|
-
end
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
# This is the annotation object specific to the dataflow it belongs to.
|
318
|
-
# A DataflowAnnotation contains metadata about a given dataflow element.
|
319
|
-
class DataflowAnnotation
|
320
|
-
# The name used of the dataflow
|
321
|
-
attr_accessor :name
|
322
|
-
|
323
|
-
# A list of titles that have been assigned to the dataflow.
|
324
|
-
attr_accessor :titles
|
325
|
-
|
326
|
-
# A list ot descriptive strings about the dataflow.
|
327
|
-
attr_accessor :descriptions
|
328
|
-
|
329
|
-
# A list of authors of the dataflow
|
330
|
-
attr_accessor :authors
|
331
|
-
|
332
|
-
attr_accessor :semantic_annotation
|
333
|
-
|
334
|
-
def initialize
|
335
|
-
@authors, @descriptions, @titles = [], [], []
|
336
|
-
end
|
337
|
-
end
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
# This represents a connection between any of the following pair of entities:
|
342
|
-
# {processor -> processor}, {workflow -> workflow}, {workflow -> processor},
|
343
|
-
# and {processor -> workflow}.
|
344
|
-
class Datalink
|
345
|
-
# The name of the source (the starting point of the connection).
|
346
|
-
attr_accessor :source
|
347
|
-
|
348
|
-
# The name of the sink (the endpoint of the connection).
|
349
|
-
attr_accessor :sink
|
350
|
-
end
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
# This is a representation of the 'Run after...' function in Taverna
|
355
|
-
# where the selected processor or workflow is set to run after another.
|
356
|
-
class Coordination
|
357
|
-
# The name of the processor/workflow which is to run first.
|
358
|
-
attr_accessor :control
|
359
|
-
|
360
|
-
# The name of the processor/workflow which is to run after the control.
|
361
|
-
attr_accessor :target
|
362
|
-
end
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
# This is the start node of a Datalink. Each source has a name and a port
|
367
|
-
# which is seperated by a colon; ":".
|
368
|
-
# This is represented as "source of a processor:port_name".
|
369
|
-
# A string that does not contain a colon can often be returned, signifiying
|
370
|
-
# a workflow source as opposed to that of a processor.
|
371
|
-
class Source
|
372
|
-
attr_accessor :name, :descriptions, :example_values, :semantic_annotation
|
373
|
-
end
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
# This is the start node of a Datalink. Each sink has a name and a port
|
378
|
-
# which is seperated by a colon; ":".
|
379
|
-
# This is represented as "sink of a processor:port_name".
|
380
|
-
# A string that does not contain a colon can often be returned, signifiying
|
381
|
-
# a workflow sink as opposed to that of a processor.
|
382
|
-
class Sink
|
383
|
-
attr_accessor :name, :descriptions, :example_values, :semantic_annotation
|
384
|
-
end
|
385
|
-
|
386
|
-
|
387
|
-
# A representation of a semantic annotation. It is linked to a +subject+,
|
388
|
-
# which can be a processor, port, or dataflow object. It has a +type+, which
|
389
|
-
# indicates the MIME type of it's +content+. By default, this will be text/rdf+n3.
|
390
|
-
# +Content+ is the content of the annotation, which in n3 form consists of one or more
|
391
|
-
# triples.
|
392
|
-
class SemanticAnnotation
|
393
|
-
attr_reader :subject, :type, :content
|
394
|
-
|
395
|
-
def initialize(subject, type, content)
|
396
|
-
@subject = subject
|
397
|
-
@type = type
|
398
|
-
@content = content
|
399
|
-
end
|
400
|
-
|
401
|
-
def to_s
|
402
|
-
@content
|
188
|
+
return proc_links
|
403
189
|
end
|
404
190
|
end
|
405
|
-
|
406
191
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This is a representation of the 'Run after...' function in Taverna
|
2
|
+
# where the selected processor or workflow is set to run after another.
|
3
|
+
module T2Flow
|
4
|
+
class Coordination
|
5
|
+
# The name of the processor/workflow which is to run first.
|
6
|
+
attr_accessor :control
|
7
|
+
|
8
|
+
# The name of the processor/workflow which is to run after the control.
|
9
|
+
attr_accessor :target
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# The entities within the Taverna 2 mdoel which contains the different
|
2
|
+
# elements of the workflows; processors, sinks, sources, etc...
|
3
|
+
module T2Flow
|
4
|
+
class Dataflow
|
5
|
+
# This returns a DataflowAnnotation object.
|
6
|
+
attr_accessor :annotations
|
7
|
+
|
8
|
+
# Retrieve the list of processors specific to the dataflow.
|
9
|
+
attr_accessor :processors
|
10
|
+
|
11
|
+
# Retrieve the list of datalinks specific to the dataflow.
|
12
|
+
attr_accessor :datalinks
|
13
|
+
|
14
|
+
# Retrieve the list of sources specific to the dataflow.
|
15
|
+
attr_accessor :sources
|
16
|
+
|
17
|
+
# Retrieve the list of sinks specific to the dataflow.
|
18
|
+
attr_accessor :sinks
|
19
|
+
|
20
|
+
# Retrieve the list of coordinations specific to the dataflow.
|
21
|
+
attr_accessor :coordinations
|
22
|
+
|
23
|
+
# The unique identifier of the dataflow.
|
24
|
+
attr_accessor :dataflow_id
|
25
|
+
|
26
|
+
# The role of the workflow
|
27
|
+
attr_accessor :role
|
28
|
+
|
29
|
+
# Creates a new Dataflow object.
|
30
|
+
def initialize
|
31
|
+
@annotations = DataflowAnnotation.new
|
32
|
+
@processors = []
|
33
|
+
@datalinks = []
|
34
|
+
@sources = []
|
35
|
+
@sinks = []
|
36
|
+
@coordinations = []
|
37
|
+
end
|
38
|
+
|
39
|
+
def name
|
40
|
+
@annotations.name
|
41
|
+
end
|
42
|
+
|
43
|
+
# Retrieve beanshell processors specific to this dataflow.
|
44
|
+
def beanshells
|
45
|
+
@processors.select { |x| x.type == "beanshell" }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# TODO: Remove this class. Not useful
|
51
|
+
# This is the annotation object specific to the dataflow it belongs to.
|
52
|
+
# A DataflowAnnotation contains metadata about a given dataflow element.
|
53
|
+
class DataflowAnnotation
|
54
|
+
# The name used of the dataflow
|
55
|
+
attr_accessor :name
|
56
|
+
|
57
|
+
# A list of titles that have been assigned to the dataflow.
|
58
|
+
attr_accessor :titles
|
59
|
+
|
60
|
+
# A list ot descriptive strings about the dataflow.
|
61
|
+
attr_accessor :descriptions
|
62
|
+
|
63
|
+
# A list of authors of the dataflow
|
64
|
+
attr_accessor :authors
|
65
|
+
|
66
|
+
attr_accessor :semantic_annotation
|
67
|
+
|
68
|
+
def initialize
|
69
|
+
@authors, @descriptions, @titles = [], [], []
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This represents a connection between any of the following pair of entities:
|
2
|
+
# {processor -> processor}, {workflow -> workflow}, {workflow -> processor},
|
3
|
+
# and {processor -> workflow}.
|
4
|
+
module T2Flow
|
5
|
+
class Datalink
|
6
|
+
# The name of the source (the starting point of the connection).
|
7
|
+
attr_accessor :source
|
8
|
+
|
9
|
+
# The name of the sink (the endpoint of the connection).
|
10
|
+
attr_accessor :sink
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module T2Flow
|
2
|
+
class Port
|
3
|
+
attr_accessor :name, :descriptions, :example_values, :semantic_annotation
|
4
|
+
end
|
5
|
+
|
6
|
+
# This is the start node of a Datalink. Each source has a name and a port
|
7
|
+
# which is seperated by a colon; ":".
|
8
|
+
# This is represented as "source of a processor:port_name".
|
9
|
+
# A string that does not contain a colon can often be returned, signifiying
|
10
|
+
# a workflow source as opposed to that of a processor.
|
11
|
+
class Source < Port
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
# This is the end node of a Datalink. Each sink has a name and a port
|
16
|
+
# which is seperated by a colon; ":".
|
17
|
+
# This is represented as "sink of a processor:port_name".
|
18
|
+
# A string that does not contain a colon can often be returned, signifiying
|
19
|
+
# a workflow sink as opposed to that of a processor.
|
20
|
+
class Sink < Port
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# This is the (shim) object within the workflow. This can be a beanshell,
|
2
|
+
# a webservice, a workflow, etc...
|
3
|
+
module T2Flow
|
4
|
+
class Processor
|
5
|
+
# A string containing name of the processor.
|
6
|
+
attr_accessor :name
|
7
|
+
|
8
|
+
# A string containing the description of the processor if available.
|
9
|
+
# Returns nil otherwise.
|
10
|
+
attr_accessor :descriptions
|
11
|
+
|
12
|
+
def description
|
13
|
+
@descriptions.first
|
14
|
+
end
|
15
|
+
|
16
|
+
# A string for the type of processor, e.g. beanshell, workflow, webservice, etc...
|
17
|
+
attr_accessor :type
|
18
|
+
|
19
|
+
# For processors that have type "dataflow", this is the the reference
|
20
|
+
# to the dataflow. For all other processor types, this is nil.
|
21
|
+
attr_accessor :dataflow_id
|
22
|
+
|
23
|
+
# This only has a value in beanshell processors. This is the actual script
|
24
|
+
# embedded with the processor which does all the "work"
|
25
|
+
attr_accessor :script
|
26
|
+
|
27
|
+
# This is a list of inputs that the processor can take in.
|
28
|
+
attr_accessor :inputs
|
29
|
+
|
30
|
+
# This is a list of outputs that the processor can produce.
|
31
|
+
attr_accessor :outputs
|
32
|
+
|
33
|
+
# For processors of type "arbitrarywsdl", this is the URI to the location
|
34
|
+
# of the wsdl file.
|
35
|
+
def wsdl
|
36
|
+
@configuration[:wsdl]
|
37
|
+
end
|
38
|
+
|
39
|
+
# For processors of type "arbitrarywsdl", this is the operation invoked.
|
40
|
+
def wsdl_operation
|
41
|
+
@configuration[:wsdl_operation]
|
42
|
+
end
|
43
|
+
|
44
|
+
# For soaplab and biomoby services, this is the endpoint URI.
|
45
|
+
def endpoint
|
46
|
+
@configuration[:endpoint]
|
47
|
+
end
|
48
|
+
|
49
|
+
# Authority name for the biomoby service.
|
50
|
+
def biomoby_authority_name
|
51
|
+
@configuration[:biomoby_authority_name]
|
52
|
+
end
|
53
|
+
|
54
|
+
# Service name for the biomoby service. This is not necessarily the same
|
55
|
+
# as the processors name.
|
56
|
+
def biomoby_service_name
|
57
|
+
@configuration[:biomoby_service_name]
|
58
|
+
end
|
59
|
+
|
60
|
+
# Category for the biomoby service.
|
61
|
+
def biomoby_category
|
62
|
+
@configuration[:biomoby_category]
|
63
|
+
end
|
64
|
+
|
65
|
+
# Value for string constants
|
66
|
+
def value
|
67
|
+
@configuration[:value]
|
68
|
+
end
|
69
|
+
|
70
|
+
attr_accessor :semantic_annotation
|
71
|
+
|
72
|
+
# Hash containing details of the processors configuration.
|
73
|
+
attr_accessor :configuration
|
74
|
+
|
75
|
+
def initialize
|
76
|
+
@descriptions = []
|
77
|
+
@configuration = {}
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
# This object is returned after invoking model.get_processor_links(processor)
|
83
|
+
# . The object contains two lists of processors. Each element consists of:
|
84
|
+
# the input or output port the processor uses as a link, the name of the
|
85
|
+
# processor being linked, and the port of the processor used for the linking,
|
86
|
+
# all seperated by a colon (:) i.e.
|
87
|
+
# my_port:name_of_processor:processor_port
|
88
|
+
class ProcessorLinks
|
89
|
+
# The processors whose output is fed as input into the processor used in
|
90
|
+
# model.get_processors_linked_to(processor).
|
91
|
+
attr_accessor :sources
|
92
|
+
|
93
|
+
# A list of processors that are fed the output from the processor (used in
|
94
|
+
# model.get_processors_linked_to(processor) ) as input.
|
95
|
+
attr_accessor :sinks
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# A representation of a semantic annotation. It is linked to a +subject+,
|
2
|
+
# which can be a processor, port, or dataflow object. It has a +type+, which
|
3
|
+
# indicates the MIME type of it's +content+. By default, this will be text/rdf+n3.
|
4
|
+
# +Content+ is the content of the annotation, which in n3 form consists of one or more
|
5
|
+
# triples.
|
6
|
+
module T2Flow
|
7
|
+
class SemanticAnnotation
|
8
|
+
attr_reader :subject, :type, :content
|
9
|
+
|
10
|
+
def initialize(subject, type, content)
|
11
|
+
@subject = subject
|
12
|
+
@type = type
|
13
|
+
@content = content
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
@content
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/t2flow/parser.rb
CHANGED
@@ -128,6 +128,14 @@ module T2Flow
|
|
128
128
|
activity.each_element do |node|
|
129
129
|
if node.name == "configBean"
|
130
130
|
activity_node = node.child
|
131
|
+
|
132
|
+
if activity_node.name == "net.sf.taverna.t2.component.ComponentActivityConfigurationBean"
|
133
|
+
processor.configuration[:component] = {}
|
134
|
+
processor.configuration[:component][:registry] = activity_node.find_first('./registryBase').content
|
135
|
+
processor.configuration[:component][:family_name] = activity_node.find_first('./familyName').content
|
136
|
+
processor.configuration[:component][:name] = activity_node.find_first('./componentName').content
|
137
|
+
processor.configuration[:component][:version] = activity_node.find_first('./componentVersion').content.to_i
|
138
|
+
end
|
131
139
|
|
132
140
|
if node["encoding"] == "dataflow"
|
133
141
|
processor.dataflow_id = activity_node["ref"]
|
@@ -139,21 +147,30 @@ module T2Flow
|
|
139
147
|
activity_node.each_element do |value_node|
|
140
148
|
case value_node.name
|
141
149
|
when "wsdl"
|
142
|
-
processor.wsdl = value_node.content
|
150
|
+
processor.configuration[:wsdl] = value_node.content
|
143
151
|
when "operation"
|
144
|
-
processor.wsdl_operation = value_node.content
|
152
|
+
processor.configuration[:wsdl_operation] = value_node.content
|
145
153
|
when /endpoint/i
|
146
|
-
processor.endpoint = value_node.content
|
154
|
+
processor.configuration[:endpoint] = value_node.content
|
147
155
|
when /servicename/i
|
148
|
-
processor.biomoby_service_name = value_node.content
|
156
|
+
processor.configuration[:biomoby_service_name] = value_node.content
|
149
157
|
when /authorityname/i
|
150
|
-
processor.biomoby_authority_name = value_node.content
|
158
|
+
processor.configuration[:biomoby_authority_name] = value_node.content
|
151
159
|
when "category"
|
152
|
-
processor.biomoby_category = value_node.content
|
160
|
+
processor.configuration[:biomoby_category] = value_node.content
|
153
161
|
when "script"
|
154
|
-
processor.script = value_node.content
|
162
|
+
processor.configuration[:script] = value_node.content
|
155
163
|
when "value"
|
156
|
-
processor.value = value_node.content
|
164
|
+
processor.configuration[:value] = value_node.content
|
165
|
+
when "presentationOrigin"
|
166
|
+
processor.configuration[:interaction_page] = value_node.content
|
167
|
+
when "connectionSettings"
|
168
|
+
if processor.type == 'rshell'
|
169
|
+
processor.configuration[:r_server] = value_node.find_first('./host').content + ":" +
|
170
|
+
value_node.find_first('./port').content
|
171
|
+
end
|
172
|
+
when "xpathExpression"
|
173
|
+
processor.configuration[:xpath_expression] = value_node.content
|
157
174
|
when "inputs" # ALL ports present in beanshell
|
158
175
|
value_node.each_element do |input|
|
159
176
|
input.each_element do |x|
|
data/taverna-t2flow.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "taverna-t2flow"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Finn Bacall", "Robert Haines", "David Withers", "Mannie Tagarira"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2014-03-11"
|
13
13
|
s.description = "This a gem developed by myGrid for the purpose of interacting with Taverna 2 workflows. An example use would be the image genaration for the model representing Taverna 2 workflows as used in myExperiment."
|
14
14
|
s.email = ["support@mygrid.org.uk"]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -18,13 +18,18 @@ Gem::Specification.new do |s|
|
|
18
18
|
"README.rdoc"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
|
-
".rvmrc",
|
22
21
|
"CHANGES.rdoc",
|
23
22
|
"LICENCE",
|
24
23
|
"README.rdoc",
|
25
24
|
"Rakefile",
|
26
25
|
"lib/t2flow/dot.rb",
|
27
26
|
"lib/t2flow/model.rb",
|
27
|
+
"lib/t2flow/model/coordination.rb",
|
28
|
+
"lib/t2flow/model/dataflow.rb",
|
29
|
+
"lib/t2flow/model/datalink.rb",
|
30
|
+
"lib/t2flow/model/port.rb",
|
31
|
+
"lib/t2flow/model/processor.rb",
|
32
|
+
"lib/t2flow/model/semantic_annotation.rb",
|
28
33
|
"lib/t2flow/parser.rb",
|
29
34
|
"lib/taverna-t2flow.rb",
|
30
35
|
"taverna-t2flow.gemspec",
|
@@ -38,6 +43,7 @@ Gem::Specification.new do |s|
|
|
38
43
|
"test/fixtures/998.t2flow",
|
39
44
|
"test/fixtures/999.t2flow",
|
40
45
|
"test/fixtures/basic.t2flow",
|
46
|
+
"test/fixtures/component_using_workflow.t2flow",
|
41
47
|
"test/fixtures/coordinated.t2flow",
|
42
48
|
"test/fixtures/image_to_tiff_migration_action.t2flow",
|
43
49
|
"test/fixtures/linked.t2flow",
|
@@ -52,7 +58,7 @@ Gem::Specification.new do |s|
|
|
52
58
|
s.homepage = "http://www.taverna.org.uk/"
|
53
59
|
s.rdoc_options = ["-N", "--tab-width=2", "--main=README.rdoc"]
|
54
60
|
s.require_paths = ["lib"]
|
55
|
-
s.rubygems_version = "1.8.
|
61
|
+
s.rubygems_version = "1.8.24"
|
56
62
|
s.summary = "Support for interacting with Taverna 2 workflows."
|
57
63
|
s.test_files = ["test/run_tests.rb"]
|
58
64
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.4.0"><dataflow id="fa8eeaf3-5816-4e19-afb4-468c318c9832" role="top"><name>Workflow1</name><inputPorts><port><name>in</name><depth>0</depth><granularDepth>0</granularDepth><annotations /></port></inputPorts><outputPorts><port><name>out</name><annotations /></port></outputPorts><processors><processor><name>Extract_PNG_dimensions</name><inputPorts><port><name>fromFilename</name><depth>0</depth></port></inputPorts><outputPorts><port><name>dimensions</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.component</group><artifact>component-activity</artifact><version>1.1.2</version></raven><class>net.sf.taverna.t2.component.ComponentActivity</class><inputMap><map from="fromFilename" to="fromFilename" /></inputMap><outputMap><map from="dimensions" to="dimensions" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.component.ComponentActivityConfigurationBean xmlns="">
|
2
|
+
<registryBase>http://www.myexperiment.org</registryBase>
|
3
|
+
<familyName>SCAPE Image Characterisation Component</familyName>
|
4
|
+
<componentName>Extract PNG dimensions</componentName>
|
5
|
+
<componentVersion>2</componentVersion>
|
6
|
+
</net.sf.taverna.t2.component.ComponentActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
|
7
|
+
<maxJobs>1</maxJobs>
|
8
|
+
</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
|
9
|
+
<backoffFactor>1.0</backoffFactor>
|
10
|
+
<initialDelay>1000</initialDelay>
|
11
|
+
<maxDelay>5000</maxDelay>
|
12
|
+
<maxRetries>0</maxRetries>
|
13
|
+
</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.4</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="fromFilename" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>Extract_PNG_dimensions</processor><port>fromFilename</port></sink><source type="dataflow"><port>in</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><processor>Extract_PNG_dimensions</processor><port>dimensions</port></source></datalink></datalinks><annotations><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
|
14
|
+
<annotationAssertions>
|
15
|
+
<net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
16
|
+
<annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
|
17
|
+
<identification>fa8eeaf3-5816-4e19-afb4-468c318c9832</identification>
|
18
|
+
</annotationBean>
|
19
|
+
<date>2014-03-11 09:20:07.794 UTC</date>
|
20
|
+
<creators />
|
21
|
+
<curationEventList />
|
22
|
+
</net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
23
|
+
</annotationAssertions>
|
24
|
+
</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></dataflow></workflow>
|
@@ -48,4 +48,17 @@ class ComponentWorkflowTest < Test::Unit::TestCase
|
|
48
48
|
@image_migration_wf.processors[0].semantic_annotation.content.gsub(/\s+/, ""),
|
49
49
|
"@image_migration_wf.processors[0].semantic_annotation")
|
50
50
|
end
|
51
|
+
|
52
|
+
def test_parses_component_information
|
53
|
+
p = File.expand_path(File.join(__FILE__, "..", "fixtures", "component_using_workflow.t2flow"))
|
54
|
+
wf = T2Flow::Parser.new.parse(File.new(p))
|
55
|
+
|
56
|
+
proc = wf.processors[0]
|
57
|
+
assert_not_nil(proc)
|
58
|
+
assert_not_nil(proc.configuration[:component])
|
59
|
+
assert_equal('http://www.myexperiment.org', proc.configuration[:component][:registry])
|
60
|
+
assert_equal('SCAPE Image Characterisation Component', proc.configuration[:component][:family_name])
|
61
|
+
assert_equal('Extract PNG dimensions', proc.configuration[:component][:name])
|
62
|
+
assert_equal(2, proc.configuration[:component][:version])
|
63
|
+
end
|
51
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taverna-t2flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -90,13 +90,18 @@ extra_rdoc_files:
|
|
90
90
|
- LICENCE
|
91
91
|
- README.rdoc
|
92
92
|
files:
|
93
|
-
- .rvmrc
|
94
93
|
- CHANGES.rdoc
|
95
94
|
- LICENCE
|
96
95
|
- README.rdoc
|
97
96
|
- Rakefile
|
98
97
|
- lib/t2flow/dot.rb
|
99
98
|
- lib/t2flow/model.rb
|
99
|
+
- lib/t2flow/model/coordination.rb
|
100
|
+
- lib/t2flow/model/dataflow.rb
|
101
|
+
- lib/t2flow/model/datalink.rb
|
102
|
+
- lib/t2flow/model/port.rb
|
103
|
+
- lib/t2flow/model/processor.rb
|
104
|
+
- lib/t2flow/model/semantic_annotation.rb
|
100
105
|
- lib/t2flow/parser.rb
|
101
106
|
- lib/taverna-t2flow.rb
|
102
107
|
- taverna-t2flow.gemspec
|
@@ -110,6 +115,7 @@ files:
|
|
110
115
|
- test/fixtures/998.t2flow
|
111
116
|
- test/fixtures/999.t2flow
|
112
117
|
- test/fixtures/basic.t2flow
|
118
|
+
- test/fixtures/component_using_workflow.t2flow
|
113
119
|
- test/fixtures/coordinated.t2flow
|
114
120
|
- test/fixtures/image_to_tiff_migration_action.t2flow
|
115
121
|
- test/fixtures/linked.t2flow
|
@@ -143,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
149
|
version: '0'
|
144
150
|
requirements: []
|
145
151
|
rubyforge_project:
|
146
|
-
rubygems_version: 1.8.
|
152
|
+
rubygems_version: 1.8.24
|
147
153
|
signing_key:
|
148
154
|
specification_version: 3
|
149
155
|
summary: Support for interacting with Taverna 2 workflows.
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm --create use 1.8.7@taverna2-gem
|