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