cpee-transformation 1.0.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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +2 -0
  3. data/LICENSE +165 -0
  4. data/README.md +1 -0
  5. data/Rakefile +21 -0
  6. data/cpee-transformation.gemspec +29 -0
  7. data/lib/cpee/transformation/beautiful.rb +182 -0
  8. data/lib/cpee/transformation/bpmn2.rb +144 -0
  9. data/lib/cpee/transformation/cpee.rb +309 -0
  10. data/lib/cpee/transformation/dataflow.rb +127 -0
  11. data/lib/cpee/transformation/graphviz.rb +100 -0
  12. data/lib/cpee/transformation/implementation.rb +144 -0
  13. data/lib/cpee/transformation/implementation.xml +47 -0
  14. data/lib/cpee/transformation/mermaid.rb +242 -0
  15. data/lib/cpee/transformation/ptml.rb +316 -0
  16. data/lib/cpee/transformation/structures.rb +570 -0
  17. data/lib/cpee/transformation/target.rb +58 -0
  18. data/lib/cpee/transformation/text-bf.rb +201 -0
  19. data/lib/cpee/transformation/text-df-PO-extended.rb +221 -0
  20. data/lib/cpee/transformation/text-df-PO-reduced.rb +211 -0
  21. data/lib/cpee/transformation/transformation_text_cpee.xml +49 -0
  22. data/lib/cpee/transformation/transformation_xml_cpee.xml +49 -0
  23. data/lib/cpee/transformation/transformation_xml_text.xml +49 -0
  24. data/lib/cpee/transformation/transformer.rb +300 -0
  25. data/server/trans +38 -0
  26. data/tools/bpmn2_to_cpee.rb +84 -0
  27. data/tools/bpmn2_to_mermaid.rb +85 -0
  28. data/tools/bpmn2_to_ptml.rb +87 -0
  29. data/tools/cpee-trans +74 -0
  30. data/tools/cpee_to_cpee.rb +83 -0
  31. data/tools/cpee_to_dataflow.rb +83 -0
  32. data/tools/cpee_to_mermaid.rb +85 -0
  33. data/tools/cpee_to_ptml.rb +87 -0
  34. data/tools/cpee_to_text_bf.rb +85 -0
  35. data/tools/cpee_to_text_df-poe.rb +85 -0
  36. data/tools/cpee_to_text_df-por.rb +85 -0
  37. data/tools/mermaid_to_cpee.rb +85 -0
  38. data/tools/ptml_to_cpee.rb +87 -0
  39. metadata +160 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 82860b1b2f751e6d29319250031aea2eae811e7d4e5d8570417ace70a9c21ff4
4
+ data.tar.gz: c6c8bff280aa7fdfa979039277d30308f8d5438b0d8a420a4cee92b86a5e457f
5
+ SHA512:
6
+ metadata.gz: 6c62e768e1c33b837150a64c72f4ed0bcc504a50ff18704701df7e094e980b87625ca246cb15212892a4a53326d7c30be5a65b15d403828145aedede7db2df0d
7
+ data.tar.gz: e4c327c3ef7b21baac4f29755f8405004baa70a1b7f539536f3421e0a246fb918fad960c1761d670a32b7c89229237c5ad2cb63023bba77dba3bf3043b4ce8d2
data/AUTHORS ADDED
@@ -0,0 +1,2 @@
1
+ Juergen 'eTM' Mangler <juergen.mangler@gmail.com>
2
+ Nataliia Klievtsova <n.klievtsova@gmail.com>
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # cpee-transformation
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require 'rake'
2
+ require 'rubygems/package_task'
3
+
4
+ spec = eval(File.read('cpee-transformation.gemspec'))
5
+ Gem::PackageTask.new(spec) do |pkg|
6
+ pkg.need_zip = true
7
+ pkg.need_tar = true
8
+ FileUtils.mkdir 'pkg' rescue nil
9
+ FileUtils.rm_rf Dir.glob('pkg/*')
10
+ FileUtils.ln_sf "#{pkg.name}.gem", "pkg/#{spec.name}.gem"
11
+ end
12
+
13
+ task :default => [:gem]
14
+
15
+ task :push => :gem do |r|
16
+ `gem push pkg/cpee-transformation.gem`
17
+ end
18
+
19
+ task :install => :gem do |r|
20
+ `gem install pkg/cpee-transformation.gem`
21
+ end
@@ -0,0 +1,29 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "cpee-transformation"
3
+ s.version = "1.0.0"
4
+ s.platform = Gem::Platform::RUBY
5
+ s.license = "LGPL-3.0-or-later"
6
+ s.summary = "CPEE Transformation between different formats"
7
+
8
+ s.description = "see http://cpee.org"
9
+
10
+ s.files = Dir['{server/*,tools/**/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-transformation.gemspec README.md AUTHORS)
11
+ s.require_path = 'lib'
12
+ s.extra_rdoc_files = ['README.md']
13
+ s.bindir = 'tools'
14
+ s.executables = ['bpmn2_to_cpee.rb', 'bpmn2_to_mermaid.rb', 'bpmn2_to_ptml.rb', 'cpee_to_cpee.rb', 'cpee_to_mermaid.rb', 'cpee_to_ptml.rb', 'cpee_to_text_bf.rb', 'cpee_to_text_df-poe.rb', 'cpee_to_text_df-por.rb', 'cpee-trans', 'mermaid_to_cpee.rb', 'ptml_to_cpee.rb']
15
+
16
+ s.required_ruby_version = '>=3.4'
17
+
18
+ s.authors = ['Juergen eTM Mangler', 'Nataliia Klievtsova']
19
+
20
+ s.email = 'juergen.mangler@gmail.com'
21
+ s.homepage = 'http://github.com/etm/cpee-transformation/'
22
+
23
+ s.add_runtime_dependency 'riddl', '~> 1.0'
24
+ s.add_runtime_dependency 'json', '~> 2.10'
25
+ s.add_runtime_dependency 'xml-smart', '~> 0.4'
26
+ s.add_runtime_dependency 'typhoeus', '~> 1.4'
27
+ s.add_runtime_dependency 'highline', '~> 2.0'
28
+ end
29
+
@@ -0,0 +1,182 @@
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 COPYING in the main directory). If not,
17
+ # see <http://www.gnu.org/licenses/>.
18
+
19
+ require_relative 'structures'
20
+ require 'securerandom'
21
+ require 'json'
22
+
23
+ module CPEE
24
+
25
+ module Transformation
26
+
27
+ module Source
28
+
29
+ class Beautiful
30
+ attr_reader :tree, :start, :dataelements, :endpoints, :graph, :traces
31
+
32
+ def initialize(text) #{{{
33
+ Node.class_variable_set(:@@niceid, {})
34
+
35
+ @tree = Tree.new
36
+ @start = nil
37
+
38
+ @dataelements = {}
39
+ @endpoints = {}
40
+ @graph = Graph.new
41
+
42
+ extract_log(text)
43
+
44
+ @traces = Traces.new [[@start]]
45
+ end #}}}
46
+
47
+ def map_nodes(node)
48
+ case node
49
+ when 'task'; :task
50
+ when 'parallelgateway'; :parallelGateway
51
+ when 'exclusivegateway'; :exclusiveGateway
52
+ when 'eventbasedgateway'; :eventBasedGateway
53
+ when 'inclusivegateway'; :inclusiveGateway
54
+ when 'endevent'; :endEvent
55
+ when 'startevent'; :startEvent
56
+ else
57
+ nil
58
+ end
59
+ end
60
+ private :map_nodes
61
+
62
+ def extract_log(text) #{{{
63
+ first = nil
64
+ decisions = {}
65
+ decisions_join = {}
66
+ loops = []
67
+ loops_end = []
68
+ parallel_joins = []
69
+ @start = Node.new(0,SecureRandom.uuid,:startEvent,'start',0,1)
70
+ @graph.add_node @start
71
+ last = @start
72
+ cond = nil
73
+ text.each_line do |line|
74
+ if line =~ /^\s*beautiful_pipeline_end_check\s-\s(\d+)\s-\s(\d+)/ #{{{
75
+ key = $1
76
+ if decisions[key]
77
+ decisions_join[key] << last
78
+ end
79
+ lid = SecureRandom.uuid
80
+ n1 = Node.new(0,lid,:exclusiveGateway,'xor end',0,0)
81
+ graph.add_node n1
82
+ decisions_join[key].each do |e|
83
+ graph.add_link Link.new(e.id,lid,nil)
84
+ end
85
+ last = n1
86
+ decisions_join.delete(key)
87
+ decisions.delete(key) #}}}
88
+ elsif line =~ /^\s*beautiful_pipeline_check\s-\s(\d+)\s-\s(\d+)/ #{{{
89
+ key = $1
90
+ if decisions[key]
91
+ decisions_join[key] << last
92
+ last = decisions[key]
93
+ else
94
+ lid = SecureRandom.uuid
95
+ n1 = Node.new(0,lid,:exclusiveGateway,'xor otherwise',0,0)
96
+ graph.add_node n1
97
+ graph.add_link Link.new(last.id,lid,nil)
98
+ last = n1
99
+ decisions[key] = n1
100
+ decisions_join[key] = []
101
+ end #}}}
102
+ elsif line =~ /^\s*beautiful_pipeline_check\s-\s(\d+)\s-\s(.*)\s-\s(\d+)/ #{{{
103
+ key = $1
104
+ if decisions[key]
105
+ decisions_join[key] << last
106
+ last = decisions[key]
107
+ else
108
+ lid = SecureRandom.uuid
109
+ cond = $2
110
+ n1 = Node.new(0,lid,:exclusiveGateway,'xor',0,0)
111
+ graph.add_link Link.new(last.id,lid,nil)
112
+ graph.add_node n1
113
+ last = n1
114
+ decisions[key] = n1
115
+ decisions_join[key] = []
116
+ end #}}}
117
+ elsif line =~ /^\s*beautiful_pipeline_loop\s-\s(.*)\s-\s(\d+)/ #{{{
118
+ lid1 = SecureRandom.uuid
119
+ lid2 = SecureRandom.uuid
120
+ cond = $1
121
+ n1 = Node.new(0,lid1,:exclusiveGateway,'loope',0,0)
122
+ n2 = Node.new(0,lid2,:exclusiveGateway,'loops',0,0)
123
+ graph.add_link Link.new(last.id,lid1,nil)
124
+ graph.add_link Link.new(lid1,lid2,nil)
125
+ graph.add_node n1
126
+ graph.add_node n2
127
+ last = n2
128
+ loops << n1
129
+ loops_end << n2 #}}}
130
+ elsif line =~ /^\s*beautiful_pipeline_end_loop\s-\s(\d+)/ #{{{
131
+ graph.add_link Link.new(last.id,loops.last.id,nil)
132
+ last = n1
133
+ loops << n1
134
+ last = loops_end.pop
135
+ loops.pop #}}}
136
+ elsif line =~ /^\s*beautiful_pipeline_continue\s-\s(\d+)/ #{{{
137
+ graph.add_link Link.new(last.id,loops.last.id,nil) #}}}
138
+ elsif line =~ /^\s*beautiful_pipeline_break\s-\s(\d+)/ #{{{
139
+ lid = SecureRandom.uuid
140
+ n1 = Node.new(0,lid,:break,'break',0,0)
141
+ graph.add_node n1
142
+ graph.add_link Link.new(last.id,lid,nil)
143
+ last = n1 #}}}
144
+ elsif line =~ /^\s*beautiful_pipeline_parallel\s-\s(\d+)/ #{{{
145
+ lid = SecureRandom.uuid
146
+ n1 = Node.new(0,lid,:parallelGateway,'parallel_start',0,0)
147
+ parallel_joins << [ n1, {} ]
148
+ last = n1 #}}}
149
+ elsif line =~ /^\s*beautiful_pipeline_end_parallel\s-\s(\d+)/ #{{{
150
+ lay = $1
151
+ lid = SecureRandom.uuid
152
+ n1 = Node.new(0,lid,:parallelGateway,'parallel_join',0,0)
153
+ start, list = parallel_joins.pop
154
+ list.each do |e|
155
+ graph.add_link Link.new(e.id,lid,nil)
156
+ end #}}}
157
+ elsif line =~ /^\s*(\{.*\})\s-\s(\d+)/ #{{{
158
+ pj = parallel_joins.last
159
+ pid = $2
160
+ j = JSON::parse($1.gsub(/'/,'"'))
161
+ lid = SecureRandom.uuid
162
+ n1 = Node.new(0,lid,:task,j.dig('name'),0,0)
163
+ graph.add_node n1
164
+ if pj.nil? || pj[1].has_key?(pid)
165
+ graph.add_link Link.new(last.id,lid,cond.nil? ? nil : cond)
166
+ else
167
+ graph.add_link Link.new(pj[0].id,lid,cond.nil? ? nil : cond)
168
+ end
169
+ cond = nil
170
+ last = n1
171
+ pj[1][pid] = n1 if pj
172
+ end #}}}
173
+ end
174
+ end #}}}
175
+
176
+ end
177
+
178
+ end
179
+
180
+ end
181
+
182
+ end
@@ -0,0 +1,144 @@
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 COPYING in the main directory). If not,
17
+ # see <http://www.gnu.org/licenses/>.
18
+
19
+ require_relative 'structures'
20
+ require 'xml/smart'
21
+
22
+ module CPEE
23
+
24
+ module Transformation
25
+
26
+ module Source
27
+
28
+ class BPMN2
29
+ attr_reader :tree, :start, :dataelements, :endpoints, :graph, :traces
30
+
31
+ def initialize(xml) #{{{
32
+ Node.class_variable_set(:@@niceid, {})
33
+
34
+ @tree = Tree.new
35
+ @start = nil
36
+
37
+ doc = XML::Smart.string(xml)
38
+ doc.register_namespace 'bm', "http://www.omg.org/spec/BPMN/20100524/MODEL"
39
+
40
+ @dataelements = {}
41
+ @endpoints = {}
42
+ @graph = Graph.new
43
+
44
+ extract_dataelements(doc)
45
+ extract_endpoints(doc)
46
+ extract_nodelink(doc)
47
+
48
+ if @start.nil?
49
+ @traces = Traces.new [[]]
50
+ else
51
+ @traces = Traces.new [[@start]]
52
+ end
53
+ end #}}}
54
+
55
+ def extract_dataelements(doc) #{{{
56
+ doc.find("/bm:definitions/bm:process/bm:property[bm:dataState/@name='cpee:dataelement']").each do |ref|
57
+ if ref.attributes['itemSubjectRef']
58
+ doc.find("/bm:definitions/bm:itemDefinition[@id=\"" + ref.attributes['itemSubjectRef'] + "\"]").each do |sref|
59
+ @dataelements[ref.attributes['name']] = sref.attributes['structureRef'].to_s
60
+ end
61
+ else
62
+ @dataelements[ref.attributes['name']] = ''
63
+ end
64
+ end
65
+ end #}}}
66
+
67
+ def extract_endpoints(doc) #{{{
68
+ doc.find("/bm:definitions/bm:process/bm:property[bm:dataState/@name='cpee:endpoint']/@itemSubjectRef").each do |ref|
69
+ doc.find("/bm:definitions/bm:itemDefinition[@id=\"" + ref.value + "\"]/@structureRef").each do |sref|
70
+ @endpoints[ref.value] = sref.value
71
+ end
72
+ end
73
+ end #}}}
74
+
75
+ def extract_nodelink(doc) #{{{
76
+ doc.find("/bm:definitions/bm:process/bm:*[@id and @name and not(@itemSubjectRef) and not(name()='sequenceFlow')]").each do |e|
77
+ n = Node.new(self.object_id,e.attributes['id'],e.qname.name.to_sym,e.attributes['name'].strip,e.find('count(bm:incoming)'),e.find('count(bm:outgoing)'))
78
+
79
+ if e.attributes['scriptFormat'] != ''
80
+ n.script_type = e.attributes['scriptFormat']
81
+ end
82
+
83
+ e.find("bm:property[@name='cpee:endpoint']/@itemSubjectRef").each do |ep|
84
+ n.endpoints << ep.value
85
+ end
86
+ e.find("bm:property[@name='cpee:method']/@itemSubjectRef").each do |m|
87
+ n.methods << m.value
88
+ end
89
+ e.find("bm:script").each do |s|
90
+ n.script ||= ''
91
+ n.script << s.text.strip
92
+ end
93
+ e.find("bm:ioSpecification/bm:dataInput").each do |a|
94
+ name = a.attributes['name']
95
+ value = a.attributes['itemSubjectRef']
96
+ unless name.nil?
97
+ if @dataelements.keys.include?(value)
98
+ n.arguments[name] = 'data.' + value
99
+ else
100
+ n.arguments[name] = value
101
+ end
102
+ end
103
+ end
104
+ e.find("bm:ioSpecification/bm:dataOutput").each do |a|
105
+ ref = a.attributes['id']
106
+ e.find("bm:dataOutputAssociation[bm:sourceRef=\"#{ref}\"]").each do |d|
107
+ n.script_var = ref
108
+ n.script_id = d.find("string(bm:targetRef)")
109
+ end
110
+ end
111
+
112
+ @graph.add_node n
113
+ @start = n if n.type == :startEvent && @start == nil
114
+ end
115
+
116
+ # extract all sequences to a links
117
+ doc.find("/bm:definitions/bm:process/bm:sequenceFlow").each do |e|
118
+ source = e.attributes['sourceRef']
119
+ target = e.attributes['targetRef']
120
+ cond = e.find('bm:conditionExpression')
121
+ @graph.add_link Link.new(source, target, cond.empty? ? nil : cond.first.text.strip)
122
+ end
123
+
124
+ @graph.clean_up do |node|
125
+ if node.type == :scriptTask && (x = @graph.find_script_id(node.id)).any?
126
+ x.each do |k,n|
127
+ n.script = node.script
128
+ n.script_type = node.script_type
129
+ end
130
+ true
131
+ else
132
+ false
133
+ end
134
+ end
135
+ end #}}}
136
+
137
+ end
138
+
139
+ end
140
+
141
+
142
+ end
143
+
144
+ end