lutaml 0.9.33 → 0.9.35
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/Gemfile +8 -0
- data/bin/plantuml2lutaml +1 -1
- data/bin/yaml2lutaml +6 -4
- data/exe/lutaml-wsd2uml +1 -1
- data/exe/lutaml-yaml2uml +6 -4
- data/lib/lutaml/command_line.rb +3 -3
- data/lib/lutaml/formatter/base.rb +3 -3
- data/lib/lutaml/formatter/graphviz.rb +10 -10
- data/lib/lutaml/sysml/block.rb +1 -1
- data/lib/lutaml/sysml/constraint_block.rb +1 -1
- data/lib/lutaml/sysml/nested_connector_end.rb +1 -1
- data/lib/lutaml/sysml/requirement.rb +41 -33
- data/lib/lutaml/sysml/xmi_file.rb +382 -355
- data/lib/lutaml/uml/actor.rb +1 -1
- data/lib/lutaml/uml/association.rb +5 -5
- data/lib/lutaml/uml/connector.rb +1 -1
- data/lib/lutaml/uml/constructor_end.rb +1 -1
- data/lib/lutaml/uml/dependency.rb +1 -1
- data/lib/lutaml/uml/document.rb +0 -1
- data/lib/lutaml/uml/formatter/base.rb +2 -2
- data/lib/lutaml/uml/formatter/graphviz.rb +10 -10
- data/lib/lutaml/uml/has_members.rb +4 -4
- data/lib/lutaml/uml/instance.rb +1 -1
- data/lib/lutaml/uml/model.rb +1 -1
- data/lib/lutaml/uml/node/class_node.rb +1 -1
- data/lib/lutaml/uml/operation.rb +2 -2
- data/lib/lutaml/uml/package.rb +2 -2
- data/lib/lutaml/uml/parsers/dsl.rb +7 -4
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +6 -3
- data/lib/lutaml/uml/property.rb +4 -4
- data/lib/lutaml/uml/top_element.rb +2 -2
- data/lib/lutaml/uml/top_element_attribute.rb +1 -1
- data/lib/lutaml/uml/value.rb +2 -2
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/association_drop.rb +11 -2
- data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/connector_drop.rb +48 -0
- data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +2 -1
- data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +9 -3
- data/lib/lutaml/xmi/liquid_drops/source_target_drop.rb +36 -0
- data/lib/lutaml/xmi/parsers/xmi_base.rb +39 -19
- data/lib/lutaml/xmi.rb +0 -1
- data/lutaml.gemspec +2 -10
- metadata +6 -103
- data/lib/lutaml/xmi/version.rb +0 -5
@@ -1,332 +1,352 @@
|
|
1
|
-
module Lutaml
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
1
|
+
module Lutaml
|
2
|
+
module SysMl
|
3
|
+
class XmiFile
|
4
|
+
attr_accessor :package_list, :model_list, :class_list, :activity_list,
|
5
|
+
:property_list, :port_list,
|
6
|
+
:datatype_list, :instance_list,
|
7
|
+
:realization_list, :abstraction_list,
|
8
|
+
:association_list, :connector_list,
|
9
|
+
:connectorend_list, :constraint_list, :block_list,
|
10
|
+
:constraintblock_list, :requirement_list,
|
11
|
+
:testcase_list, :binding_connector_list,
|
12
|
+
:nested_connectorend_list, :derive_requirement_list,
|
13
|
+
:refine_requirement_list, :trace_requirement_list,
|
14
|
+
:copy_requirement_list, :verify_requirement_list,
|
15
|
+
:satisfy_requirement_list,
|
16
|
+
:allocate_requirement_list, :element_hash
|
17
|
+
|
18
|
+
def initialize # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
19
|
+
@package_list = []
|
20
|
+
@model_list = []
|
21
|
+
@class_list = []
|
22
|
+
@activity_list = []
|
23
|
+
@property_list = []
|
24
|
+
@port_list = []
|
25
|
+
@datatype_list = []
|
26
|
+
@instance_list = []
|
27
|
+
@realization_list = []
|
28
|
+
@abstraction_list = []
|
29
|
+
@association_list = []
|
30
|
+
@connector_list = []
|
31
|
+
@connectorend_list = []
|
32
|
+
@constraint_list = []
|
33
|
+
@block_list = []
|
34
|
+
@constraintblock_list = []
|
35
|
+
@requirement_list = []
|
36
|
+
@testcase_list = []
|
37
|
+
@binding_connector_list = []
|
38
|
+
@nested_connectorend_list = []
|
39
|
+
@derive_requirement_list = []
|
40
|
+
@refine_requirement_list = []
|
41
|
+
@trace_requirement_list = []
|
42
|
+
@copy_requirement_list = []
|
43
|
+
@verify_requirement_list = []
|
44
|
+
@satisfy_requirement_list = []
|
45
|
+
@allocate_requirement_list = []
|
46
|
+
|
47
|
+
@element_hash = Hash.new
|
48
|
+
end
|
41
49
|
|
42
|
-
|
43
|
-
|
44
|
-
|
50
|
+
def parse(filename) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
51
|
+
xmifile = File.new(filename, "r")
|
52
|
+
inxml = Nokogiri::XML(xmifile)
|
45
53
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
54
|
+
xmi_elements = inxml.xpath("//xmi:XMI")
|
55
|
+
if xmi_elements.empty?
|
56
|
+
puts "ERROR : File contains no 'xmi:XMI' XML elements : " \
|
57
|
+
"#{filename}, may not be XMI file."
|
58
|
+
xmifile.close
|
59
|
+
exit
|
60
|
+
end
|
52
61
|
|
53
|
-
|
54
|
-
|
62
|
+
# setup xmi namespace
|
63
|
+
xmi_ns = inxml.root.namespace_definitions.find do |ns|
|
64
|
+
ns.prefix == "xmi"
|
65
|
+
end
|
55
66
|
|
56
|
-
|
67
|
+
## Step 1: Find UML and SysML Core Objects in XMI file and create as
|
68
|
+
# instance of metamodel
|
57
69
|
|
58
|
-
|
59
|
-
|
70
|
+
inxml.xpath("//*").each do |xml_node| # rubocop:disable Metrics/BlockLength
|
71
|
+
element_new = nil
|
60
72
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
73
|
+
if xml_node.name.to_s == "packagedElement" &&
|
74
|
+
xml_node.attribute_with_ns("type", xmi_ns.href)
|
75
|
+
.to_s == "uml:Package"
|
76
|
+
element_new = Lutaml::Uml::Package.new
|
77
|
+
package_list.push element_new
|
78
|
+
end
|
67
79
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
80
|
+
if xml_node.name.to_s == "Model"
|
81
|
+
element_new = Lutaml::Uml::Model.new
|
82
|
+
model_list.push element_new
|
83
|
+
element_new.viewpoint = xml_node["viewpoint"]
|
84
|
+
element_new.href = xml_node["href"]
|
85
|
+
end
|
74
86
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
87
|
+
if xml_node.attribute_with_ns("type", xmi_ns.href).to_s == "uml:Class"
|
88
|
+
element_new = Lutaml::Uml::Class.new
|
89
|
+
if !xml_node["isAbstract"].nil?
|
90
|
+
element_new.is_abstract = xml_node["isAbstract"] == "true"
|
91
|
+
end
|
92
|
+
class_list.push element_new
|
79
93
|
end
|
80
|
-
class_list.push element_new
|
81
|
-
end
|
82
94
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
95
|
+
if xml_node.attribute_with_ns("type",
|
96
|
+
xmi_ns.href).to_s == "uml:Activity"
|
97
|
+
element_new = Lutaml::Uml::Activity.new
|
98
|
+
activity_list.push element_new
|
99
|
+
end
|
88
100
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
101
|
+
if xml_node.attribute_with_ns("type",
|
102
|
+
xmi_ns.href).to_s == "uml:Property"
|
103
|
+
element_new = Lutaml::Uml::Property.new
|
104
|
+
property_list.push element_new
|
105
|
+
end
|
94
106
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
107
|
+
if xml_node
|
108
|
+
.attribute_with_ns("type", xmi_ns.href)
|
109
|
+
.to_s == "uml:InstanceSpecification"
|
110
|
+
element_new = Lutaml::Uml::Instance.new
|
111
|
+
instance_list.push element_new
|
112
|
+
end
|
100
113
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
114
|
+
if xml_node.attribute_with_ns("type",
|
115
|
+
xmi_ns.href).to_s == "uml:DataType"
|
116
|
+
element_new = Lutaml::Uml::DataType.new
|
117
|
+
datatype_list.push element_new
|
118
|
+
end
|
106
119
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
120
|
+
if xml_node.attribute_with_ns("type", xmi_ns.href).to_s == "uml:Port"
|
121
|
+
element_new = Lutaml::Uml::Port.new
|
122
|
+
port_list.push element_new
|
123
|
+
end
|
111
124
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
125
|
+
if xml_node.attribute_with_ns("type",
|
126
|
+
xmi_ns.href).to_s == "uml:Connector"
|
127
|
+
element_new = Lutaml::Uml::Connector.new
|
128
|
+
connector_list.push element_new
|
129
|
+
end
|
117
130
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
131
|
+
if xml_node.attribute_with_ns("type",
|
132
|
+
xmi_ns.href).to_s == "uml:ConnectorEnd"
|
133
|
+
element_new = Lutaml::Uml::ConnectorEnd.new
|
134
|
+
connectorend_list.push element_new
|
135
|
+
end
|
123
136
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
137
|
+
if xml_node.attribute_with_ns("type",
|
138
|
+
xmi_ns.href).to_s == "uml:Constraint"
|
139
|
+
element_new = Lutaml::Uml::Constraint.new
|
140
|
+
constraint_list.push element_new
|
141
|
+
end
|
129
142
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
143
|
+
if xml_node.name.to_s == "Block"
|
144
|
+
element_new = SYSML::Block.new
|
145
|
+
block_list.push element_new
|
146
|
+
end
|
134
147
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
148
|
+
if xml_node.name.to_s == "Template"
|
149
|
+
element_new = SYSML::Block.new
|
150
|
+
block_list.push element_new
|
151
|
+
end
|
139
152
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
153
|
+
if xml_node.name.to_s == "ConstraintBlock"
|
154
|
+
element_new = SYSML::ConstraintBlock.new
|
155
|
+
constraintblock_list.push element_new
|
156
|
+
end
|
144
157
|
|
145
|
-
|
158
|
+
if (
|
159
|
+
xml_node.name.to_s.index("Requirement") ||
|
160
|
+
xml_node.name.to_s == "designConstraint"
|
161
|
+
) && xml_node.name.to_s != "RequirementRelated"
|
146
162
|
element_new = SYSML::Requirement.new
|
147
163
|
requirement_list.push element_new
|
148
164
|
element_new.id = xml_node.attribute_with_ns("id",
|
149
|
-
|
165
|
+
xmi_ns.href).to_s.strip
|
150
166
|
element_new.text = xml_node["Text"]
|
151
167
|
if xml_node.name != "Requirement"
|
152
168
|
element_new.stereotype.push xml_node.name
|
153
169
|
end
|
154
170
|
end
|
155
171
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
if xml_node.name.to_s == "BindingConnector"
|
162
|
-
element_new = SYSML::BindingConnector.new
|
163
|
-
binding_connector_list.push element_new
|
164
|
-
end
|
165
|
-
|
166
|
-
if xml_node.name.to_s == "NestedConnectorEnd"
|
167
|
-
element_new = SYSML::NestedConnectorEnd.new
|
168
|
-
nested_connectorend_list.push element_new
|
169
|
-
end
|
170
|
-
|
171
|
-
if xml_node.name.to_s == "DeriveReqt"
|
172
|
-
element_new = SYSML::DeriveRequirement.new
|
173
|
-
derive_requirement_list.push element_new
|
174
|
-
end
|
175
|
-
if xml_node.name.to_s == "refine"
|
176
|
-
element_new = SYSML::Refine.new
|
177
|
-
refine_requirement_list.push element_new
|
178
|
-
end
|
179
|
-
if xml_node.name.to_s == "trace"
|
180
|
-
element_new = SYSML::Trace.new
|
181
|
-
trace_requirement_list.push element_new
|
182
|
-
end
|
183
|
-
if xml_node.name.to_s == "Copy"
|
184
|
-
element_new = SYSML::Copy.new
|
185
|
-
copy_requirement_list.push element_new
|
186
|
-
end
|
187
|
-
if xml_node.name.to_s == "Verify"
|
188
|
-
element_new = SYSML::Verify.new
|
189
|
-
verify_requirement_list.push element_new
|
190
|
-
end
|
191
|
-
if xml_node.name.to_s == "Allocate"
|
192
|
-
element_new = SYSML::Allocate.new
|
193
|
-
allocate_requirement_list.push element_new
|
194
|
-
end
|
195
|
-
|
196
|
-
if xml_node.name.to_s == "Satisfy"
|
197
|
-
element_new = SYSML::Satisfy.new
|
198
|
-
satisfy_requirement_list.push element_new
|
199
|
-
end
|
172
|
+
if xml_node.name.to_s == "TestCase"
|
173
|
+
element_new = SYSML::TestCase.new
|
174
|
+
testcase_list.push element_new
|
175
|
+
end
|
200
176
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
end
|
177
|
+
if xml_node.name.to_s == "BindingConnector"
|
178
|
+
element_new = SYSML::BindingConnector.new
|
179
|
+
binding_connector_list.push element_new
|
180
|
+
end
|
206
181
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
end
|
182
|
+
if xml_node.name.to_s == "NestedConnectorEnd"
|
183
|
+
element_new = SYSML::NestedConnectorEnd.new
|
184
|
+
nested_connectorend_list.push element_new
|
185
|
+
end
|
212
186
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
187
|
+
if xml_node.name.to_s == "DeriveReqt"
|
188
|
+
element_new = SYSML::DeriveRequirement.new
|
189
|
+
derive_requirement_list.push element_new
|
190
|
+
end
|
191
|
+
if xml_node.name.to_s == "refine"
|
192
|
+
element_new = SYSML::Refine.new
|
193
|
+
refine_requirement_list.push element_new
|
194
|
+
end
|
195
|
+
if xml_node.name.to_s == "trace"
|
196
|
+
element_new = SYSML::Trace.new
|
197
|
+
trace_requirement_list.push element_new
|
198
|
+
end
|
199
|
+
if xml_node.name.to_s == "Copy"
|
200
|
+
element_new = SYSML::Copy.new
|
201
|
+
copy_requirement_list.push element_new
|
202
|
+
end
|
203
|
+
if xml_node.name.to_s == "Verify"
|
204
|
+
element_new = SYSML::Verify.new
|
205
|
+
verify_requirement_list.push element_new
|
206
|
+
end
|
207
|
+
if xml_node.name.to_s == "Allocate"
|
208
|
+
element_new = SYSML::Allocate.new
|
209
|
+
allocate_requirement_list.push element_new
|
210
|
+
end
|
218
211
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
new_href_node = xml_node["href"]
|
212
|
+
if xml_node.name.to_s == "Satisfy"
|
213
|
+
element_new = SYSML::Satisfy.new
|
214
|
+
satisfy_requirement_list.push element_new
|
215
|
+
end
|
224
216
|
|
225
|
-
if
|
226
|
-
|
227
|
-
|
217
|
+
if xml_node.attribute_with_ns("type",
|
218
|
+
xmi_ns.href).to_s == "uml:Abstraction"
|
219
|
+
element_new = Lutaml::Uml::Abstraction.new
|
220
|
+
abstraction_list.push element_new
|
228
221
|
end
|
229
222
|
|
230
|
-
if
|
231
|
-
|
223
|
+
if xml_node.attribute_with_ns("type",
|
224
|
+
xmi_ns.href).to_s == "uml:Realization"
|
225
|
+
element_new = Lutaml::Uml::Realization.new
|
226
|
+
realization_list.push element_new
|
232
227
|
end
|
233
228
|
|
234
|
-
if
|
235
|
-
|
229
|
+
if xml_node.attribute_with_ns("type",
|
230
|
+
xmi_ns.href).to_s == "uml:Association"
|
231
|
+
element_new = Lutaml::Uml::Association.new
|
232
|
+
association_list.push element_new
|
236
233
|
end
|
237
234
|
|
238
|
-
if !
|
239
|
-
|
240
|
-
|
241
|
-
|
235
|
+
if !element_new.nil?
|
236
|
+
new_xmi_id_node = xml_node.attribute_with_ns("id", xmi_ns.href)
|
237
|
+
new_xmi_uuid_node = xml_node.attribute_with_ns("uuid", xmi_ns.href)
|
238
|
+
new_name_node = xml_node["name"]
|
239
|
+
new_href_node = xml_node["href"]
|
240
|
+
|
241
|
+
if !new_xmi_id_node.nil?
|
242
|
+
element_new.xmi_id = new_xmi_id_node.to_s
|
243
|
+
element_hash[element_new.xmi_id] = element_new
|
242
244
|
end
|
243
|
-
|
244
|
-
|
245
|
+
|
246
|
+
if !new_xmi_uuid_node.nil?
|
247
|
+
element_new.xmi_uuid = new_xmi_uuid_node.to_s
|
245
248
|
end
|
246
|
-
end
|
247
249
|
|
248
|
-
|
249
|
-
xml_node
|
250
|
-
|
251
|
-
|
250
|
+
if !new_name_node.nil?
|
251
|
+
element_new.name = xml_node["name"].strip
|
252
|
+
end
|
253
|
+
|
254
|
+
if !new_href_node.nil?
|
255
|
+
element_new.href = new_href_node.to_s
|
256
|
+
if new_xmi_id_node == nil
|
257
|
+
element_hash[element_new.href] = element_new
|
258
|
+
end
|
259
|
+
if !xml_node.at("xmi:Extension/referenceExtension").nil?
|
260
|
+
element_new.name = xml_node
|
261
|
+
.at("xmi:Extension/referenceExtension")["referentPath"]
|
262
|
+
end
|
263
|
+
end
|
252
264
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
265
|
+
if !xml_node.parent.nil? &&
|
266
|
+
!xml_node.parent.attribute_with_ns("id", xmi_ns.href).nil? &&
|
267
|
+
!element_hash[xml_node
|
268
|
+
.parent.attribute_with_ns("id", xmi_ns.href).to_s].nil?
|
269
|
+
|
270
|
+
parent = element_hash[xml_node
|
271
|
+
.parent.attribute_with_ns("id", xmi_ns.href).to_s]
|
272
|
+
element_new.namespace = parent
|
273
|
+
if parent.is_a? Lutaml::Uml::Package
|
274
|
+
parent.contents.push element_new
|
275
|
+
end
|
258
276
|
end
|
259
277
|
end
|
260
278
|
end
|
261
|
-
end
|
262
|
-
|
263
|
-
for xml_node in inxml.xpath("//*")
|
264
279
|
|
265
|
-
|
266
|
-
|
267
|
-
|
280
|
+
inxml.xpath("//*").each do |xml_node| # rubocop:disable Metrics/BlockLength,Style/CombinableLoops
|
281
|
+
if !xml_node.attribute_with_ns("id", xmi_ns.href).nil? &&
|
282
|
+
!element_hash[xml_node
|
283
|
+
.attribute_with_ns("id", xmi_ns.href).to_s].nil?
|
268
284
|
|
269
|
-
|
270
|
-
|
271
|
-
|
285
|
+
this_thing = element_hash[xml_node
|
286
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
287
|
+
end
|
272
288
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
289
|
+
if xml_node.name.to_s == "nestedClassifier" &&
|
290
|
+
xml_node.attribute_with_ns(
|
291
|
+
"type", xmi_ns.href
|
292
|
+
).to_s == "uml:Class"
|
293
|
+
owning_class_xmi_id = xml_node
|
294
|
+
.parent.attribute_with_ns("id", xmi_ns.href).to_s
|
295
|
+
owned_class_xmi_id = xml_node
|
296
|
+
.attribute_with_ns("id", xmi_ns.href).to_s
|
297
|
+
owning_class = element_hash[owning_class_xmi_id]
|
298
|
+
owned_class = element_hash[owned_class_xmi_id]
|
299
|
+
owning_class.nested_classifier.push owned_class
|
300
|
+
end
|
284
301
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
302
|
+
if xml_node.attribute_with_ns("type", xmi_ns.href)
|
303
|
+
.to_s == "uml:Realization"
|
304
|
+
this_thing = element_hash[xml_node
|
305
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
306
|
+
supplier_xmi_id = xml_node.at("supplier")["idref"]
|
307
|
+
client_xmi_id = xml_node.at("client")["idref"]
|
308
|
+
this_thing.supplier.push element_hash[supplier_xmi_id]
|
309
|
+
this_thing.client.push element_hash[client_xmi_id]
|
310
|
+
end
|
294
311
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
312
|
+
if xml_node.attribute_with_ns("type",
|
313
|
+
xmi_ns.href).to_s == "uml:Abstraction"
|
314
|
+
this_thing = element_hash[xml_node
|
315
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
316
|
+
supplier_xmi_id = xml_node.at("supplier")["idref"]
|
317
|
+
client_xmi_id = xml_node.at("client")["idref"]
|
318
|
+
this_thing.supplier.push element_hash[supplier_xmi_id]
|
319
|
+
this_thing.client.push element_hash[client_xmi_id]
|
320
|
+
end
|
304
321
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
322
|
+
if xml_node.name.to_s == "Block"
|
323
|
+
this_thing = element_hash[xml_node
|
324
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
325
|
+
base_class_xmi_id = xml_node["base_Class"]
|
326
|
+
this_thing.base_class = element_hash[base_class_xmi_id]
|
327
|
+
end
|
311
328
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
329
|
+
if xml_node.name.to_s == "Template"
|
330
|
+
this_thing = element_hash[xml_node
|
331
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
332
|
+
base_class_xmi_id = xml_node["base_Class"]
|
333
|
+
this_thing.base_class = element_hash[base_class_xmi_id]
|
334
|
+
this_thing.base_class.stereotype.push "Template"
|
335
|
+
end
|
319
336
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
337
|
+
if xml_node.name.to_s == "ConstraintBlock"
|
338
|
+
this_thing = element_hash[xml_node
|
339
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
340
|
+
base_class_xmi_id = xml_node["base_Class"]
|
341
|
+
this_thing.base_class = element_hash[base_class_xmi_id]
|
342
|
+
end
|
326
343
|
|
327
|
-
|
328
|
-
|
329
|
-
|
344
|
+
if (
|
345
|
+
xml_node.name.to_s.index("Requirement") ||
|
346
|
+
(xml_node.name.to_s == "designConstraint")
|
347
|
+
) && xml_node.name.to_s != "RequirementRelated"
|
348
|
+
this_thing = element_hash[xml_node
|
349
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
330
350
|
base_class_xmi_id = xml_node["base_Class"]
|
331
351
|
this_thing.base_class = element_hash[base_class_xmi_id]
|
332
352
|
this_thing.refined_by = element_hash[xml_node["RefinedBy"]]
|
@@ -334,76 +354,81 @@ module Lutaml::SysMl
|
|
334
354
|
this_thing.traced_to = element_hash[xml_node["TracedTo"]]
|
335
355
|
end
|
336
356
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
357
|
+
if xml_node.name.to_s == "TestCase"
|
358
|
+
this_thing = element_hash[xml_node
|
359
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
360
|
+
this_thing.base_behavior = element_hash[xml_node["base_Behavior"]]
|
361
|
+
this_thing.verifies = element_hash[xml_node["Verifies"]]
|
362
|
+
end
|
343
363
|
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
364
|
+
if xml_node.name.to_s == "BindingConnector"
|
365
|
+
this_thing = element_hash[xml_node
|
366
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
367
|
+
base_connector_xmi_id = xml_node["base_Connector"]
|
368
|
+
this_thing.base_connector = element_hash[base_connector_xmi_id]
|
369
|
+
end
|
350
370
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
371
|
+
if xml_node.name.to_s == "NestedConnectorEnd"
|
372
|
+
this_thing = element_hash[xml_node
|
373
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
374
|
+
base_connectorend_xmi_id = xml_node["base_ConnectorEnd"]
|
375
|
+
this_thing.base_connectorend =
|
376
|
+
element_hash[base_connectorend_xmi_id]
|
377
|
+
if xml_node["propertyPath"] == nil
|
378
|
+
xml_node.xpath("./propertyPath").each do |prop_path|
|
379
|
+
# to deal with href = '#xmi:id' i.e. local references
|
380
|
+
href_parts = prop_path["href"].split("#")
|
381
|
+
prop = if href_parts[0].empty?
|
382
|
+
element_hash[href_parts[1]]
|
383
|
+
else
|
384
|
+
element_hash[prop_path["href"]]
|
385
|
+
end
|
386
|
+
this_thing.property_path.push prop
|
387
|
+
end
|
388
|
+
else
|
389
|
+
this_thing.property_path
|
390
|
+
.push element_hash[xml_node["propertyPath"]]
|
366
391
|
end
|
367
|
-
else
|
368
|
-
this_thing.property_path.push element_hash[xml_node["propertyPath"]]
|
369
392
|
end
|
370
|
-
end
|
371
|
-
|
372
|
-
if xml_node.name.to_s == "Satisfy"
|
373
|
-
this_thing = element_hash[xml_node.attribute_with_ns("id",
|
374
|
-
xmiNS.href).to_s]
|
375
|
-
base_realization_xmi_id = xml_node["base_Realization"]
|
376
|
-
this_thing.base_realization = element_hash[base_realization_xmi_id]
|
377
|
-
end
|
378
393
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
end
|
394
|
+
if xml_node.name.to_s == "Satisfy"
|
395
|
+
this_thing = element_hash[xml_node
|
396
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
397
|
+
base_realization_xmi_id = xml_node["base_Realization"]
|
398
|
+
this_thing.base_realization = element_hash[base_realization_xmi_id]
|
399
|
+
end
|
386
400
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
this_thing.member_end.push element_hash[item["idref"]]
|
401
|
+
if ["DeriveReqt", "refine", "trace", "Copy", "Verify", "Allocate", # rubocop:disable Performance/CollectionLiteralInLoop
|
402
|
+
""].include? xml_node.name.to_s
|
403
|
+
this_thing = element_hash[xml_node
|
404
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
405
|
+
base_abstraction_xmi_id = xml_node["base_Abstraction"]
|
406
|
+
this_thing.base_abstraction = element_hash[base_abstraction_xmi_id]
|
394
407
|
end
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
408
|
+
|
409
|
+
if xml_node.attribute_with_ns("type",
|
410
|
+
xmi_ns.href).to_s == "uml:Association"
|
411
|
+
this_thing = element_hash[xml_node
|
412
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
413
|
+
member_end_list = xml_node.xpath("./memberEnd")
|
414
|
+
member_end_list.each do |item|
|
415
|
+
this_thing.member_end.push element_hash[item["idref"]]
|
416
|
+
end
|
417
|
+
owned_end_list = xml_node.xpath("./ownedEnd")
|
418
|
+
owned_end_list.each do |item|
|
419
|
+
this_thing.owned_end.push element_hash[item.attribute_with_ns(
|
420
|
+
"id", xmi_ns.href
|
421
|
+
).to_s]
|
422
|
+
end
|
399
423
|
end
|
400
|
-
end
|
401
424
|
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
425
|
+
if ["uml:Property", "uml:Port"].include?( # rubocop:disable Performance/CollectionLiteralInLoop
|
426
|
+
xml_node.attribute_with_ns("type", xmi_ns.href).to_s,
|
427
|
+
) &&
|
428
|
+
!["definingFeature", "partWithPort", "propertyPath", "role"] # rubocop:disable Performance/CollectionLiteralInLoop
|
429
|
+
.include?(xml_node.name.to_s)
|
430
|
+
this_thing = element_hash[xml_node
|
431
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
407
432
|
if !xml_node["association"].nil?
|
408
433
|
this_thing.association = element_hash[xml_node["association"]]
|
409
434
|
end
|
@@ -416,7 +441,7 @@ module Lutaml::SysMl
|
|
416
441
|
|
417
442
|
if !xml_node.at("lowerValue").nil?
|
418
443
|
|
419
|
-
this_thing.lowerValue = if xml_node.at("lowerValue")["value"]
|
444
|
+
this_thing.lowerValue = if xml_node.at("lowerValue")["value"].nil?
|
420
445
|
"0"
|
421
446
|
else
|
422
447
|
xml_node.at("lowerValue")["value"]
|
@@ -427,29 +452,31 @@ module Lutaml::SysMl
|
|
427
452
|
end
|
428
453
|
end
|
429
454
|
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
455
|
+
if xml_node.attribute_with_ns("type",
|
456
|
+
xmi_ns.href).to_s == "uml:Connector"
|
457
|
+
this_thing = element_hash[xml_node
|
458
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
459
|
+
connector_end_list = xml_node.xpath("./end")
|
460
|
+
connector_end_list.each do |end_xml_node|
|
461
|
+
this_thing.connector_end
|
462
|
+
.push element_hash[end_xml_node.attribute_with_ns(
|
463
|
+
"id", xmi_ns.href
|
464
|
+
).to_s]
|
465
|
+
end
|
439
466
|
end
|
440
|
-
end
|
441
467
|
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
468
|
+
if xml_node.attribute_with_ns("type",
|
469
|
+
xmi_ns.href).to_s == "uml:ConnectorEnd"
|
470
|
+
this_thing = element_hash[xml_node
|
471
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
472
|
+
this_thing.connector = element_hash[xml_node.parent
|
473
|
+
.attribute_with_ns("id", xmi_ns.href).to_s]
|
474
|
+
this_thing.role = element_hash[xml_node["role"]]
|
475
|
+
if this_thing.role == nil
|
476
|
+
this_thing.role = element_hash[xml_node.at("role")["href"]]
|
477
|
+
end
|
478
|
+
this_thing.part_with_port = element_hash[xml_node["part_with_port"]]
|
479
|
+
end
|
453
480
|
end
|
454
481
|
end
|
455
482
|
end
|