mannie-taverna-t2flow 0.0.2 → 0.0.3
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/README +1 -1
- data/lib/t2flow/model.rb +2 -2
- data/lib/t2flow/parser.rb +37 -7
- metadata +1 -1
data/README
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Taverna[http://taverna.sourceforge.net] 2 Interaction Gem
|
2
2
|
|
3
3
|
Author:: Emmanuel Tagarira
|
4
|
-
Version:: 0.0.
|
4
|
+
Version:: 0.0.3
|
5
5
|
Contact:: mailto:emmanuel.tagarira@student.manchester.ac.uk
|
6
6
|
URL:: http://taverna.sourceforge.net/
|
7
7
|
Licence:: LGPL 3 (See LICENCE or http://www.gnu.org/licenses/lgpl.html)
|
data/lib/t2flow/model.rb
CHANGED
@@ -227,7 +227,7 @@ module T2Flow # :nodoc:
|
|
227
227
|
# A string that does not contain a colon can often be returned, signifiying
|
228
228
|
# a workflow source as opposed to that of a processor.
|
229
229
|
class Source
|
230
|
-
attr_accessor :name
|
230
|
+
attr_accessor :name, :descriptions, :example_values
|
231
231
|
end
|
232
232
|
|
233
233
|
|
@@ -238,7 +238,7 @@ module T2Flow # :nodoc:
|
|
238
238
|
# A string that does not contain a colon can often be returned, signifiying
|
239
239
|
# a workflow sink as opposed to that of a processor.
|
240
240
|
class Sink
|
241
|
-
attr_accessor :name
|
241
|
+
attr_accessor :name, :descriptions, :example_values
|
242
242
|
end
|
243
243
|
|
244
244
|
end
|
data/lib/t2flow/parser.rb
CHANGED
@@ -81,21 +81,51 @@ module T2Flow
|
|
81
81
|
port.each do |elt|
|
82
82
|
case elt.name
|
83
83
|
when "name": source.name = elt.content
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
when "annotations"
|
85
|
+
elt.each do |ann|
|
86
|
+
node = LibXML::XML::Parser.string("#{ann}").parse
|
87
|
+
content_node = node.find_first("//annotationBean")
|
88
|
+
content = content_node.child.next.content
|
89
|
+
|
90
|
+
case content_node["class"]
|
91
|
+
when /freetextdescription/i
|
92
|
+
source.descriptions = [] unless source.descriptions
|
93
|
+
source.descriptions << content
|
94
|
+
when /examplevalue/i
|
95
|
+
source.example_values = [] unless source.example_values
|
96
|
+
source.example_values << content
|
97
|
+
end # case
|
98
|
+
end # elt.each
|
99
|
+
end # case
|
100
|
+
end # port.each
|
101
|
+
|
87
102
|
dataflow.sources << source
|
88
103
|
end
|
89
104
|
|
90
105
|
def add_sink(dataflow, port) # :nodoc:
|
91
106
|
sink = Sink.new
|
92
|
-
|
107
|
+
|
93
108
|
port.each do |elt|
|
94
109
|
case elt.name
|
95
110
|
when "name": sink.name = elt.content
|
96
|
-
|
97
|
-
|
98
|
-
|
111
|
+
when "annotations"
|
112
|
+
elt.each do |ann|
|
113
|
+
node = LibXML::XML::Parser.string("#{ann}").parse
|
114
|
+
content_node = node.find_first("//annotationBean")
|
115
|
+
content = content_node.child.next.content
|
116
|
+
|
117
|
+
case content_node["class"]
|
118
|
+
when /freetextdescription/i
|
119
|
+
sink.descriptions = [] unless sink.descriptions
|
120
|
+
sink.descriptions << content
|
121
|
+
when /examplevalue/i
|
122
|
+
sink.example_values = [] unless sink.example_values
|
123
|
+
sink.example_values << content
|
124
|
+
end # case
|
125
|
+
end # elt.each
|
126
|
+
end # case
|
127
|
+
end # port.each
|
128
|
+
|
99
129
|
dataflow.sinks << sink
|
100
130
|
end
|
101
131
|
|