cpee-transformation 1.0.6 → 1.1.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.
- checksums.yaml +4 -4
- data/README.md +10 -3
- data/cpee-transformation.gemspec +2 -2
- data/lib/cpee/transformation/bpmn2.rb +6 -3
- data/lib/cpee/transformation/cpee.rb +7 -5
- data/lib/cpee/transformation/graphviz.rb +230 -33
- data/lib/cpee/transformation/implementation.rb +7 -0
- data/lib/cpee/transformation/implementation.xml +3 -0
- data/lib/cpee/transformation/mermaid.rb +57 -20
- data/lib/cpee/transformation/pnml.rb +243 -0
- data/lib/cpee/transformation/target.rb +2 -1
- data/lib/cpee/transformation/transformer.rb +1 -1
- data/tools/trans_bpmn2-to-graphviz +85 -0
- data/tools/trans_cpee-to-graphviz +85 -0
- data/tools/trans_cpee-to-pnml +85 -0
- data/tools/trans_cpee-to-pnml-with-lifecycle +85 -0
- metadata +31 -27
- data/server/trans.pid +0 -1
- /data/tools/{bpmn2_to_cpee.rb → trans_bpmn2-to-cpee} +0 -0
- /data/tools/{bpmn2_to_mermaid.rb → trans_bpmn2-to-mermaid} +0 -0
- /data/tools/{bpmn2_to_ptml.rb → trans_bpmn2-to-ptml} +0 -0
- /data/tools/{cpee_to_bpmn2.rb → trans_cpee-to-bpmn2} +0 -0
- /data/tools/{cpee_to_cpee.rb → trans_cpee-to-cpee} +0 -0
- /data/tools/{cpee_to_dataflow.rb → trans_cpee-to-dataflow} +0 -0
- /data/tools/{cpee_to_mermaid.rb → trans_cpee-to-mermaid} +0 -0
- /data/tools/{cpee_to_ptml.rb → trans_cpee-to-ptml} +0 -0
- /data/tools/{cpee_to_text_bf.rb → trans_cpee-to-text-bf} +0 -0
- /data/tools/{cpee_to_text_df-poe.rb → trans_cpee-to-text-df-poe} +0 -0
- /data/tools/{cpee_to_text_df-por.rb → trans_cpee-to-text-df-por} +0 -0
- /data/tools/{mermaid_to_cpee.rb → trans_mermaid-to-cpee} +0 -0
- /data/tools/{ptml_to_cpee.rb → trans_ptml-to-cpee} +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
#
|
|
3
|
+
# This file is part of CPEE-TRANSFORMATION.
|
|
4
|
+
#
|
|
5
|
+
# CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or (at your
|
|
8
|
+
# option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
|
|
11
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
13
|
+
# for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with CPEE-TRANSFORMATION (file LICENSE in the main directory). If not,
|
|
17
|
+
# see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require_relative 'target'
|
|
20
|
+
require 'xml/smart'
|
|
21
|
+
|
|
22
|
+
module CPEE
|
|
23
|
+
|
|
24
|
+
module Transformation
|
|
25
|
+
|
|
26
|
+
module Target #{{{
|
|
27
|
+
|
|
28
|
+
### workflow net in the pnml dialect pm4py reads ($invisible$, finalmarkings).
|
|
29
|
+
### every print_* gets the place it starts from and returns the place it
|
|
30
|
+
### ends in, nil after break and terminate
|
|
31
|
+
class PNML < Default
|
|
32
|
+
|
|
33
|
+
def generate
|
|
34
|
+
@places = []
|
|
35
|
+
@transitions = []
|
|
36
|
+
@arcs = []
|
|
37
|
+
@exits = []
|
|
38
|
+
@start = place(1,'start')
|
|
39
|
+
@end = place(0,'end')
|
|
40
|
+
last = generate_in_list(@tree,silent(@start))
|
|
41
|
+
silent(last,@end) if last
|
|
42
|
+
reduce
|
|
43
|
+
to_xml
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def place(tokens=0,id=nil)
|
|
49
|
+
@places << { :id => id || "p#{@places.length + 1}", :tokens => tokens }
|
|
50
|
+
@places.last
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def transition(name,silent=false)
|
|
54
|
+
@transitions << { :id => "t#{@transitions.length + 1}", :name => name, :silent => silent }
|
|
55
|
+
@transitions.last
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def arc(source,target)
|
|
59
|
+
@arcs << [source,target]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def step(from,to,name,silent)
|
|
63
|
+
to ||= place
|
|
64
|
+
t = transition(name,silent)
|
|
65
|
+
arc(from,t)
|
|
66
|
+
arc(t,to)
|
|
67
|
+
to
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def silent(from,to=nil,name=nil) = step(from,to,name,true)
|
|
71
|
+
def visible(from,name) = step(from,nil,name,false)
|
|
72
|
+
|
|
73
|
+
def script?(node)
|
|
74
|
+
node.endpoints.empty? && ((!node.script.nil? && node.script.strip != '') || node.type == :scriptTask)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def activity(node,from)
|
|
78
|
+
label = node.label.to_s.strip
|
|
79
|
+
visible(from,label.empty? ? node.id.to_s : label)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
### after break or terminate nothing is reachable
|
|
83
|
+
def alive(pn) = pn || place
|
|
84
|
+
|
|
85
|
+
def print_Node(node,pn) = activity(node,alive(pn))
|
|
86
|
+
|
|
87
|
+
def print_Break(node,pn)
|
|
88
|
+
silent(alive(pn),@exits.last || @end,'break')
|
|
89
|
+
nil
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def print_Terminate(node,pn)
|
|
93
|
+
silent(alive(pn),@end,'terminate')
|
|
94
|
+
nil
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def print_Parallel(node,pn)
|
|
98
|
+
### a place is a deferred choice
|
|
99
|
+
return choice(node.sub,alive(pn)) if node.type == :eventBasedGateway
|
|
100
|
+
split = transition(nil,true)
|
|
101
|
+
join = transition(nil,true)
|
|
102
|
+
arc(alive(pn),split)
|
|
103
|
+
node.sub.each do |branch|
|
|
104
|
+
bp = place
|
|
105
|
+
arc(split,bp)
|
|
106
|
+
last = generate_in_list(branch,bp)
|
|
107
|
+
arc(last,join) if last
|
|
108
|
+
end
|
|
109
|
+
to = place
|
|
110
|
+
arc(join,to)
|
|
111
|
+
to
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
### inclusive: parallel, every branch can be skipped (also all of them)
|
|
115
|
+
def print_Conditional(node,pn)
|
|
116
|
+
return choice(node.sub,alive(pn)) unless node.type == :inclusiveGateway
|
|
117
|
+
split = transition(nil,true)
|
|
118
|
+
join = transition(nil,true)
|
|
119
|
+
arc(alive(pn),split)
|
|
120
|
+
node.sub.each do |branch|
|
|
121
|
+
bp = place
|
|
122
|
+
arc(split,bp)
|
|
123
|
+
last = choice([branch,[]],bp)
|
|
124
|
+
arc(last,join) if last
|
|
125
|
+
end
|
|
126
|
+
to = place
|
|
127
|
+
arc(join,to)
|
|
128
|
+
to
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
### exclusive: all branches start in the same place, conditions are lost
|
|
132
|
+
def choice(branches,pn)
|
|
133
|
+
merge = place
|
|
134
|
+
reached = false
|
|
135
|
+
branches.each do |branch|
|
|
136
|
+
last = generate_in_list(branch,pn)
|
|
137
|
+
next unless last
|
|
138
|
+
silent(last,merge)
|
|
139
|
+
reached = true
|
|
140
|
+
end
|
|
141
|
+
reached ? merge : nil
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
### single: body plus the (implicit) way out, like in the other targets.
|
|
145
|
+
### otherwise the alternatives decide, and only breaks leave the loop
|
|
146
|
+
def print_Loop(node,pn)
|
|
147
|
+
head = silent(alive(pn))
|
|
148
|
+
exit = place
|
|
149
|
+
@exits.push exit
|
|
150
|
+
single = node.sub.length == 1 || (node.sub.length == 2 && node.sub[1].condition.empty? && ((node.sub[1].length == 1 && node.sub[1][0].class.name.gsub(/\w+:+/,'') == 'Break') || node.sub[1].length == 0))
|
|
151
|
+
finite = single && (node.sub.length == 2 || node.sub[0].condition.any?)
|
|
152
|
+
silent(head,exit) if finite && node.mode == :pre_test
|
|
153
|
+
last = single ? generate_in_list(node.sub[0],head) : choice(node.sub,head)
|
|
154
|
+
if last
|
|
155
|
+
silent(last,head) unless last.equal?(head)
|
|
156
|
+
silent(last,exit) if finite && node.mode != :pre_test
|
|
157
|
+
end
|
|
158
|
+
@exits.pop
|
|
159
|
+
exit
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def inputs(n) = @arcs.select { |s,t| t.equal?(n) }
|
|
163
|
+
def outputs(n) = @arcs.select { |s,t| s.equal?(n) }
|
|
164
|
+
|
|
165
|
+
### fuse places connected by a silent transition, if the first place
|
|
166
|
+
### leads nowhere else. Does not change what the net can do
|
|
167
|
+
def reduce
|
|
168
|
+
loop do
|
|
169
|
+
fused = @transitions.any? do |t|
|
|
170
|
+
next false unless t[:silent]
|
|
171
|
+
ins, outs = inputs(t), outputs(t)
|
|
172
|
+
next false unless ins.length == 1 && outs.length == 1
|
|
173
|
+
p, q = ins[0][0], outs[0][1]
|
|
174
|
+
next false if p.equal?(q) || outputs(p).length != 1
|
|
175
|
+
if inputs(q).length == 1
|
|
176
|
+
keep, gone = p, q
|
|
177
|
+
moved = outputs(q).map { |s,x| [keep,x] }
|
|
178
|
+
elsif p[:tokens] == 0
|
|
179
|
+
keep, gone = q, p
|
|
180
|
+
moved = inputs(p).map { |x,s| [x,keep] }
|
|
181
|
+
else
|
|
182
|
+
next false
|
|
183
|
+
end
|
|
184
|
+
next false if moved.any? { |a| @arcs.any? { |b| b[0].equal?(a[0]) && b[1].equal?(a[1]) } }
|
|
185
|
+
@arcs.reject! { |s,x| s.equal?(gone) || x.equal?(gone) || s.equal?(t) || x.equal?(t) }
|
|
186
|
+
@arcs.concat moved
|
|
187
|
+
@transitions.delete_if { |x| x.equal?(t) }
|
|
188
|
+
@places.delete_if { |x| x.equal?(gone) }
|
|
189
|
+
@start = keep if gone.equal?(@start)
|
|
190
|
+
@end = keep if gone.equal?(@end)
|
|
191
|
+
keep[:id] = gone[:id] if %w(start end).include?(gone[:id])
|
|
192
|
+
true
|
|
193
|
+
end
|
|
194
|
+
break unless fused
|
|
195
|
+
end
|
|
196
|
+
@places.select! { |x| x.equal?(@start) || x.equal?(@end) || @arcs.any? { |s,t| s.equal?(x) || t.equal?(x) } }
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def to_xml
|
|
200
|
+
res = XML::Smart.string('<pnml xmlns="http://www.pnml.org/version-2009/grammar/pnml"><net id="net1" type="http://www.pnml.org/version-2009/grammar/pnmlcoremodel"><page id="page1"/></net></pnml>')
|
|
201
|
+
res.register_namespace 'p', 'http://www.pnml.org/version-2009/grammar/pnml'
|
|
202
|
+
net = res.find('/p:pnml/p:net').first
|
|
203
|
+
page = res.find('/p:pnml/p:net/p:page').first
|
|
204
|
+
@places.each do |x|
|
|
205
|
+
n = page.add('place', 'id' => x[:id])
|
|
206
|
+
n.add('name').add('text',x[:id])
|
|
207
|
+
n.add('initialMarking').add('text',x[:tokens].to_s) if x[:tokens] > 0
|
|
208
|
+
end
|
|
209
|
+
@transitions.each do |x|
|
|
210
|
+
n = page.add('transition', 'id' => x[:id])
|
|
211
|
+
n.add('name').add('text',x[:name] || x[:id])
|
|
212
|
+
n.add('toolspecific', 'tool' => 'ProM', 'version' => '6.4', 'activity' => '$invisible$') if x[:silent]
|
|
213
|
+
end
|
|
214
|
+
@arcs.each_with_index do |(s,t),i|
|
|
215
|
+
page.add('arc', 'id' => "a#{i + 1}", 'source' => s[:id], 'target' => t[:id])
|
|
216
|
+
end
|
|
217
|
+
net.add('finalmarkings').add('marking').add('place', 'idref' => @end[:id]).add('text','1')
|
|
218
|
+
res.to_s
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
### calls as in cpee logs: calling, receiving (once or more), done.
|
|
224
|
+
### scripts only log done. names are <id>_<lifecycle>
|
|
225
|
+
class PNML_with_lifecycle < PNML
|
|
226
|
+
|
|
227
|
+
private
|
|
228
|
+
|
|
229
|
+
def activity(node,from)
|
|
230
|
+
return visible(from,"#{node.id}_done") if script?(node)
|
|
231
|
+
called = visible(from,"#{node.id}_calling")
|
|
232
|
+
received = visible(called,"#{node.id}_receiving")
|
|
233
|
+
silent(received,called,'redo_receiving')
|
|
234
|
+
visible(received,"#{node.id}_done")
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end #}}}
|
|
240
|
+
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
end
|
|
@@ -23,8 +23,9 @@ module CPEE
|
|
|
23
23
|
module Target
|
|
24
24
|
|
|
25
25
|
class Default
|
|
26
|
-
def initialize(tree)
|
|
26
|
+
def initialize(tree,dir=nil)
|
|
27
27
|
@tree = tree
|
|
28
|
+
@dir = dir # layout direction of the source model (td, lr), if known
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
### SingleParallel markers are only printed by targets that know them
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
#
|
|
4
|
+
# This file is part of CPEE-TRANSFORMATION.
|
|
5
|
+
#
|
|
6
|
+
# CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or (at your
|
|
9
|
+
# option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
|
|
12
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
+
# for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with CPEE-TRANSFORMATION (file LICENSE in the main directory). If not,
|
|
18
|
+
# see <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
def wrap(s1, s2, width=78, indent=ARGV.options.summary_width + 3)
|
|
21
|
+
lines = []
|
|
22
|
+
s = ARGV.options.summary_indent + s1 + ' ' * (indent - s1.length - ARGV.options.summary_indent.length) + s2
|
|
23
|
+
line, s = s[0..indent-2], s[indent..-1]
|
|
24
|
+
s.split(/\n/).each do |ss|
|
|
25
|
+
ss.split(/[ \t]+/).each do |word|
|
|
26
|
+
if line.size + word.size >= width
|
|
27
|
+
lines << line
|
|
28
|
+
line = (" " * (indent)) + word
|
|
29
|
+
else
|
|
30
|
+
line << " " << word
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
lines << line if line
|
|
34
|
+
line = (" " * (indent-1))
|
|
35
|
+
end
|
|
36
|
+
return lines.join("\n")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
require 'optparse'
|
|
40
|
+
|
|
41
|
+
require_relative '../lib/cpee/transformation/transformer' rescue nil
|
|
42
|
+
require_relative '../lib/cpee/transformation/bpmn2' rescue nil
|
|
43
|
+
require_relative '../lib/cpee/transformation/graphviz' rescue nil
|
|
44
|
+
|
|
45
|
+
interactive = false
|
|
46
|
+
printtree = false
|
|
47
|
+
|
|
48
|
+
ARGV.options { |opt|
|
|
49
|
+
opt.summary_indent = ' ' * 2
|
|
50
|
+
opt.summary_width = 18
|
|
51
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} FNAME\n"
|
|
52
|
+
opt.on("Options:")
|
|
53
|
+
opt.on("--help", "-h", "This text") { puts opt; exit }
|
|
54
|
+
opt.on("--interactive", "-i", "Interactive mode") { interactive = true }
|
|
55
|
+
opt.on("--tree", "-t", "Print tree") { printtree = true }
|
|
56
|
+
opt.on("")
|
|
57
|
+
opt.on(wrap("[FNAME]","convert cpee bpmn2 in file FNAME to graphviz and output to console."))
|
|
58
|
+
opt.parse!
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ARGV.length != 1
|
|
62
|
+
puts ARGV.options
|
|
63
|
+
exit
|
|
64
|
+
else
|
|
65
|
+
f = ARGV[0]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
model = CPEE::Transformation::Source::BPMN2.new(File.read(f))
|
|
69
|
+
|
|
70
|
+
trans = CPEE::Transformation::Transformer.new(model)
|
|
71
|
+
traces = trans.build_traces
|
|
72
|
+
|
|
73
|
+
if interactive
|
|
74
|
+
puts traces.legend
|
|
75
|
+
puts
|
|
76
|
+
tree = trans.build_tree(true)
|
|
77
|
+
else
|
|
78
|
+
tree = trans.build_tree(false)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if printtree
|
|
82
|
+
puts tree.to_s
|
|
83
|
+
else
|
|
84
|
+
puts trans.generate_model(CPEE::Transformation::Target::Graphviz)
|
|
85
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
#
|
|
4
|
+
# This file is part of CPEE-TRANSFORMATION.
|
|
5
|
+
#
|
|
6
|
+
# CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or (at your
|
|
9
|
+
# option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
|
|
12
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
+
# for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with CPEE-TRANSFORMATION (file LICENSE in the main directory). If not,
|
|
18
|
+
# see <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
def wrap(s1, s2, width=78, indent=ARGV.options.summary_width + 3)
|
|
21
|
+
lines = []
|
|
22
|
+
s = ARGV.options.summary_indent + s1 + ' ' * (indent - s1.length - ARGV.options.summary_indent.length) + s2
|
|
23
|
+
line, s = s[0..indent-2], s[indent..-1]
|
|
24
|
+
s.split(/\n/).each do |ss|
|
|
25
|
+
ss.split(/[ \t]+/).each do |word|
|
|
26
|
+
if line.size + word.size >= width
|
|
27
|
+
lines << line
|
|
28
|
+
line = (" " * (indent)) + word
|
|
29
|
+
else
|
|
30
|
+
line << " " << word
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
lines << line if line
|
|
34
|
+
line = (" " * (indent-1))
|
|
35
|
+
end
|
|
36
|
+
return lines.join("\n")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
require 'optparse'
|
|
40
|
+
|
|
41
|
+
require_relative '../lib/cpee/transformation/transformer' rescue nil
|
|
42
|
+
require_relative '../lib/cpee/transformation/cpee' rescue nil
|
|
43
|
+
require_relative '../lib/cpee/transformation/graphviz' rescue nil
|
|
44
|
+
|
|
45
|
+
interactive = false
|
|
46
|
+
printtree = false
|
|
47
|
+
|
|
48
|
+
ARGV.options { |opt|
|
|
49
|
+
opt.summary_indent = ' ' * 2
|
|
50
|
+
opt.summary_width = 18
|
|
51
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} FNAME\n"
|
|
52
|
+
opt.on("Options:")
|
|
53
|
+
opt.on("--help", "-h", "This text") { puts opt; exit }
|
|
54
|
+
opt.on("--interactive", "-i", "Interactive mode") { interactive = true }
|
|
55
|
+
opt.on("--tree", "-t", "Print tree") { printtree = true }
|
|
56
|
+
opt.on("")
|
|
57
|
+
opt.on(wrap("[FNAME]","convert cpee tree in file FNAME to graphviz and output to console."))
|
|
58
|
+
opt.parse!
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ARGV.length != 1
|
|
62
|
+
puts ARGV.options
|
|
63
|
+
exit
|
|
64
|
+
else
|
|
65
|
+
f = ARGV[0]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
model = CPEE::Transformation::Source::CPEE.new(File.read(f))
|
|
69
|
+
|
|
70
|
+
trans = CPEE::Transformation::Transformer.new(model)
|
|
71
|
+
traces = trans.build_traces
|
|
72
|
+
|
|
73
|
+
if interactive
|
|
74
|
+
puts traces.legend
|
|
75
|
+
puts
|
|
76
|
+
tree = trans.build_tree(true)
|
|
77
|
+
else
|
|
78
|
+
tree = trans.build_tree(false)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if printtree
|
|
82
|
+
puts tree.to_s
|
|
83
|
+
else
|
|
84
|
+
puts trans.generate_model(CPEE::Transformation::Target::Graphviz)
|
|
85
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
#
|
|
4
|
+
# This file is part of CPEE-TRANSFORMATION.
|
|
5
|
+
#
|
|
6
|
+
# CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or (at your
|
|
9
|
+
# option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
|
|
12
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
+
# for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with CPEE-TRANSFORMATION (file LICENSE in the main directory). If not,
|
|
18
|
+
# see <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
def wrap(s1, s2, width=78, indent=ARGV.options.summary_width + 3)
|
|
21
|
+
lines = []
|
|
22
|
+
s = ARGV.options.summary_indent + s1 + ' ' * (indent - s1.length - ARGV.options.summary_indent.length) + s2
|
|
23
|
+
line, s = s[0..indent-2], s[indent..-1]
|
|
24
|
+
s.split(/\n/).each do |ss|
|
|
25
|
+
ss.split(/[ \t]+/).each do |word|
|
|
26
|
+
if line.size + word.size >= width
|
|
27
|
+
lines << line
|
|
28
|
+
line = (" " * (indent)) + word
|
|
29
|
+
else
|
|
30
|
+
line << " " << word
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
lines << line if line
|
|
34
|
+
line = (" " * (indent-1))
|
|
35
|
+
end
|
|
36
|
+
return lines.join("\n")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
require 'optparse'
|
|
40
|
+
|
|
41
|
+
require_relative '../lib/cpee/transformation/transformer' rescue nil
|
|
42
|
+
require_relative '../lib/cpee/transformation/cpee' rescue nil
|
|
43
|
+
require_relative '../lib/cpee/transformation/pnml' rescue nil
|
|
44
|
+
|
|
45
|
+
interactive = false
|
|
46
|
+
printtree = false
|
|
47
|
+
|
|
48
|
+
ARGV.options { |opt|
|
|
49
|
+
opt.summary_indent = ' ' * 2
|
|
50
|
+
opt.summary_width = 18
|
|
51
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} FNAME\n"
|
|
52
|
+
opt.on("Options:")
|
|
53
|
+
opt.on("--help", "-h", "This text") { puts opt; exit }
|
|
54
|
+
opt.on("--interactive", "-i", "Interactive mode") { interactive = true }
|
|
55
|
+
opt.on("--tree", "-t", "Print tree") { printtree = true }
|
|
56
|
+
opt.on("")
|
|
57
|
+
opt.on(wrap("[FNAME]","convert cpee tree in file FNAME to pnml and output to console."))
|
|
58
|
+
opt.parse!
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ARGV.length != 1
|
|
62
|
+
puts ARGV.options
|
|
63
|
+
exit
|
|
64
|
+
else
|
|
65
|
+
f = ARGV[0]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
model = CPEE::Transformation::Source::CPEE.new(File.read(f))
|
|
69
|
+
|
|
70
|
+
trans = CPEE::Transformation::Transformer.new(model)
|
|
71
|
+
traces = trans.build_traces
|
|
72
|
+
|
|
73
|
+
if interactive
|
|
74
|
+
puts traces.legend
|
|
75
|
+
puts
|
|
76
|
+
tree = trans.build_tree(true)
|
|
77
|
+
else
|
|
78
|
+
tree = trans.build_tree(false)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if printtree
|
|
82
|
+
puts tree.to_s
|
|
83
|
+
else
|
|
84
|
+
puts trans.generate_model(CPEE::Transformation::Target::PNML)
|
|
85
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
#
|
|
4
|
+
# This file is part of CPEE-TRANSFORMATION.
|
|
5
|
+
#
|
|
6
|
+
# CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or (at your
|
|
9
|
+
# option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
|
|
12
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
+
# for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with CPEE-TRANSFORMATION (file LICENSE in the main directory). If not,
|
|
18
|
+
# see <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
def wrap(s1, s2, width=78, indent=ARGV.options.summary_width + 3)
|
|
21
|
+
lines = []
|
|
22
|
+
s = ARGV.options.summary_indent + s1 + ' ' * (indent - s1.length - ARGV.options.summary_indent.length) + s2
|
|
23
|
+
line, s = s[0..indent-2], s[indent..-1]
|
|
24
|
+
s.split(/\n/).each do |ss|
|
|
25
|
+
ss.split(/[ \t]+/).each do |word|
|
|
26
|
+
if line.size + word.size >= width
|
|
27
|
+
lines << line
|
|
28
|
+
line = (" " * (indent)) + word
|
|
29
|
+
else
|
|
30
|
+
line << " " << word
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
lines << line if line
|
|
34
|
+
line = (" " * (indent-1))
|
|
35
|
+
end
|
|
36
|
+
return lines.join("\n")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
require 'optparse'
|
|
40
|
+
|
|
41
|
+
require_relative '../lib/cpee/transformation/transformer' rescue nil
|
|
42
|
+
require_relative '../lib/cpee/transformation/cpee' rescue nil
|
|
43
|
+
require_relative '../lib/cpee/transformation/pnml' rescue nil
|
|
44
|
+
|
|
45
|
+
interactive = false
|
|
46
|
+
printtree = false
|
|
47
|
+
|
|
48
|
+
ARGV.options { |opt|
|
|
49
|
+
opt.summary_indent = ' ' * 2
|
|
50
|
+
opt.summary_width = 18
|
|
51
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} FNAME\n"
|
|
52
|
+
opt.on("Options:")
|
|
53
|
+
opt.on("--help", "-h", "This text") { puts opt; exit }
|
|
54
|
+
opt.on("--interactive", "-i", "Interactive mode") { interactive = true }
|
|
55
|
+
opt.on("--tree", "-t", "Print tree") { printtree = true }
|
|
56
|
+
opt.on("")
|
|
57
|
+
opt.on(wrap("[FNAME]","convert cpee tree in file FNAME to pnml with calling/receiving/done transitions and output to console."))
|
|
58
|
+
opt.parse!
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ARGV.length != 1
|
|
62
|
+
puts ARGV.options
|
|
63
|
+
exit
|
|
64
|
+
else
|
|
65
|
+
f = ARGV[0]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
model = CPEE::Transformation::Source::CPEE.new(File.read(f))
|
|
69
|
+
|
|
70
|
+
trans = CPEE::Transformation::Transformer.new(model)
|
|
71
|
+
traces = trans.build_traces
|
|
72
|
+
|
|
73
|
+
if interactive
|
|
74
|
+
puts traces.legend
|
|
75
|
+
puts
|
|
76
|
+
tree = trans.build_tree(true)
|
|
77
|
+
else
|
|
78
|
+
tree = trans.build_tree(false)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if printtree
|
|
82
|
+
puts tree.to_s
|
|
83
|
+
else
|
|
84
|
+
puts trans.generate_model(CPEE::Transformation::Target::PNML_with_lifecycle)
|
|
85
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpee-transformation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen eTM Mangler
|
|
@@ -83,19 +83,19 @@ dependencies:
|
|
|
83
83
|
description: see http://cpee.org
|
|
84
84
|
email: juergen.mangler@gmail.com
|
|
85
85
|
executables:
|
|
86
|
-
- bpmn2_to_cpee.rb
|
|
87
|
-
- bpmn2_to_mermaid.rb
|
|
88
|
-
- bpmn2_to_ptml.rb
|
|
89
86
|
- cpee-trans
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
87
|
+
- trans_bpmn2-to-cpee
|
|
88
|
+
- trans_bpmn2-to-mermaid
|
|
89
|
+
- trans_bpmn2-to-ptml
|
|
90
|
+
- trans_cpee-to-bpmn2
|
|
91
|
+
- trans_cpee-to-cpee
|
|
92
|
+
- trans_cpee-to-mermaid
|
|
93
|
+
- trans_cpee-to-ptml
|
|
94
|
+
- trans_cpee-to-text-bf
|
|
95
|
+
- trans_cpee-to-text-df-poe
|
|
96
|
+
- trans_cpee-to-text-df-por
|
|
97
|
+
- trans_mermaid-to-cpee
|
|
98
|
+
- trans_ptml-to-cpee
|
|
99
99
|
extensions: []
|
|
100
100
|
extra_rdoc_files:
|
|
101
101
|
- README.md
|
|
@@ -113,6 +113,7 @@ files:
|
|
|
113
113
|
- lib/cpee/transformation/implementation.rb
|
|
114
114
|
- lib/cpee/transformation/implementation.xml
|
|
115
115
|
- lib/cpee/transformation/mermaid.rb
|
|
116
|
+
- lib/cpee/transformation/pnml.rb
|
|
116
117
|
- lib/cpee/transformation/ptml.rb
|
|
117
118
|
- lib/cpee/transformation/structures.rb
|
|
118
119
|
- lib/cpee/transformation/target.rb
|
|
@@ -125,21 +126,24 @@ files:
|
|
|
125
126
|
- lib/cpee/transformation/transformer.rb
|
|
126
127
|
- server/trans
|
|
127
128
|
- server/trans.conf
|
|
128
|
-
- server/trans.pid
|
|
129
|
-
- tools/bpmn2_to_cpee.rb
|
|
130
|
-
- tools/bpmn2_to_mermaid.rb
|
|
131
|
-
- tools/bpmn2_to_ptml.rb
|
|
132
129
|
- tools/cpee-trans
|
|
133
|
-
- tools/
|
|
134
|
-
- tools/
|
|
135
|
-
- tools/
|
|
136
|
-
- tools/
|
|
137
|
-
- tools/
|
|
138
|
-
- tools/
|
|
139
|
-
- tools/
|
|
140
|
-
- tools/
|
|
141
|
-
- tools/
|
|
142
|
-
- tools/
|
|
130
|
+
- tools/trans_bpmn2-to-cpee
|
|
131
|
+
- tools/trans_bpmn2-to-graphviz
|
|
132
|
+
- tools/trans_bpmn2-to-mermaid
|
|
133
|
+
- tools/trans_bpmn2-to-ptml
|
|
134
|
+
- tools/trans_cpee-to-bpmn2
|
|
135
|
+
- tools/trans_cpee-to-cpee
|
|
136
|
+
- tools/trans_cpee-to-dataflow
|
|
137
|
+
- tools/trans_cpee-to-graphviz
|
|
138
|
+
- tools/trans_cpee-to-mermaid
|
|
139
|
+
- tools/trans_cpee-to-pnml
|
|
140
|
+
- tools/trans_cpee-to-pnml-with-lifecycle
|
|
141
|
+
- tools/trans_cpee-to-ptml
|
|
142
|
+
- tools/trans_cpee-to-text-bf
|
|
143
|
+
- tools/trans_cpee-to-text-df-poe
|
|
144
|
+
- tools/trans_cpee-to-text-df-por
|
|
145
|
+
- tools/trans_mermaid-to-cpee
|
|
146
|
+
- tools/trans_ptml-to-cpee
|
|
143
147
|
homepage: http://github.com/etm/cpee-transformation/
|
|
144
148
|
licenses:
|
|
145
149
|
- LGPL-3.0-or-later
|
data/server/trans.pid
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1235950
|