xmi 0.5.2 → 0.5.4
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/.github/workflows/rake.yml +5 -1
- data/.rubocop_todo.yml +52 -9
- data/lib/xmi/extension.rb +4 -12
- data/lib/xmi/parser_pipeline.rb +70 -0
- data/lib/xmi/root.rb +3 -12
- data/lib/xmi/sparx/connector/appearance.rb +27 -0
- data/lib/xmi/sparx/connector/connector.rb +52 -0
- data/lib/xmi/sparx/connector/end_base.rb +56 -0
- data/lib/xmi/sparx/connector/end_constraint.rb +33 -0
- data/lib/xmi/sparx/connector/end_modifiers.rb +19 -0
- data/lib/xmi/sparx/connector/end_role.rb +21 -0
- data/lib/xmi/sparx/connector/end_style.rb +17 -0
- data/lib/xmi/sparx/connector/end_type.rb +21 -0
- data/lib/xmi/sparx/connector/labels.rb +27 -0
- data/lib/xmi/sparx/connector/model.rb +19 -0
- data/lib/xmi/sparx/connector/properties.rb +19 -0
- data/lib/xmi/sparx/connector.rb +15 -233
- data/lib/xmi/sparx/element/association.rb +58 -0
- data/lib/xmi/sparx/element/attribute.rb +58 -0
- data/lib/xmi/sparx/element/bounds.rb +19 -0
- data/lib/xmi/sparx/element/code.rb +19 -0
- data/lib/xmi/sparx/element/containment.rb +19 -0
- data/lib/xmi/sparx/element/coords.rb +19 -0
- data/lib/xmi/sparx/element/documentation.rb +17 -0
- data/lib/xmi/sparx/element/element.rb +62 -0
- data/lib/xmi/sparx/element/extended_properties.rb +21 -0
- data/lib/xmi/sparx/element/flags.rb +29 -0
- data/lib/xmi/sparx/element/links.rb +22 -0
- data/lib/xmi/sparx/element/model.rb +26 -0
- data/lib/xmi/sparx/element/package_properties.rb +21 -0
- data/lib/xmi/sparx/element/paths.rb +17 -0
- data/lib/xmi/sparx/element/project.rb +29 -0
- data/lib/xmi/sparx/element/properties.rb +41 -0
- data/lib/xmi/sparx/element/stereotype.rb +17 -0
- data/lib/xmi/sparx/element/style.rb +17 -0
- data/lib/xmi/sparx/element/styleex.rb +17 -0
- data/lib/xmi/sparx/element/tag.rb +32 -0
- data/lib/xmi/sparx/element/times.rb +23 -0
- data/lib/xmi/sparx/element/xrefs.rb +17 -0
- data/lib/xmi/sparx/element.rb +28 -445
- data/lib/xmi/sparx/extension.rb +4 -12
- data/lib/xmi/sparx/gml/application_schema.rb +26 -0
- data/lib/xmi/sparx/gml/code_list.rb +23 -0
- data/lib/xmi/sparx/gml/data_type.rb +18 -0
- data/lib/xmi/sparx/gml/enumeration.rb +18 -0
- data/lib/xmi/sparx/gml/feature_type.rb +21 -0
- data/lib/xmi/sparx/gml/property.rb +24 -0
- data/lib/xmi/sparx/gml/shared_attributes.rb +39 -0
- data/lib/xmi/sparx/gml/type.rb +18 -0
- data/lib/xmi/sparx/gml/union.rb +18 -0
- data/lib/xmi/sparx/gml.rb +10 -125
- data/lib/xmi/sparx/index.rb +248 -0
- data/lib/xmi/sparx/mappings/base_mapping.rb +13 -137
- data/lib/xmi/sparx/root.rb +20 -7
- data/lib/xmi/sparx.rb +1 -0
- data/lib/xmi/uml/annotated_element.rb +16 -0
- data/lib/xmi/uml/association_generalization.rb +20 -0
- data/lib/xmi/uml/bounds.rb +43 -0
- data/lib/xmi/uml/default_value.rb +42 -0
- data/lib/xmi/uml/diagram.rb +25 -0
- data/lib/xmi/uml/member_end.rb +16 -0
- data/lib/xmi/uml/owned_attribute.rb +31 -0
- data/lib/xmi/uml/owned_comment.rb +29 -0
- data/lib/xmi/uml/owned_element.rb +33 -0
- data/lib/xmi/uml/owned_end.rb +34 -0
- data/lib/xmi/uml/owned_literal.rb +23 -0
- data/lib/xmi/uml/owned_operation.rb +22 -0
- data/lib/xmi/uml/owned_parameter.rb +29 -0
- data/lib/xmi/uml/package_import.rb +30 -0
- data/lib/xmi/uml/packaged_element.rb +49 -0
- data/lib/xmi/uml/precondition.rb +22 -0
- data/lib/xmi/uml/profile.rb +43 -0
- data/lib/xmi/uml/profile_application.rb +34 -0
- data/lib/xmi/uml/specification.rb +20 -0
- data/lib/xmi/uml/type.rb +18 -0
- data/lib/xmi/uml/uml_model.rb +29 -0
- data/lib/xmi/uml.rb +27 -502
- data/lib/xmi/version.rb +1 -1
- data/lib/xmi/version_registry.rb +2 -1
- data/lib/xmi/xmi_identity.rb +46 -0
- data/lib/xmi.rb +11 -6
- metadata +68 -2
data/lib/xmi/uml.rb
CHANGED
|
@@ -2,507 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
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
|
-
xml do
|
|
33
|
-
root "memberEnd"
|
|
34
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
35
|
-
|
|
36
|
-
map_attribute "idref", to: :idref
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
class OwnedEnd < Lutaml::Model::Serializable
|
|
41
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
42
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
43
|
-
attribute :association, :string
|
|
44
|
-
attribute :name, :string
|
|
45
|
-
attribute :type_attr, :string
|
|
46
|
-
attribute :uml_type, Uml::Type
|
|
47
|
-
attribute :member_end, :string
|
|
48
|
-
attribute :lower, :integer
|
|
49
|
-
attribute :upper, :integer
|
|
50
|
-
attribute :is_composite, :boolean
|
|
51
|
-
|
|
52
|
-
xml do
|
|
53
|
-
root "ownedEnd"
|
|
54
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
55
|
-
|
|
56
|
-
map_attribute "type", to: :type
|
|
57
|
-
map_attribute "id", to: :id
|
|
58
|
-
map_attribute "association", to: :association
|
|
59
|
-
map_attribute "name", to: :name
|
|
60
|
-
map_attribute "memberEnd", to: :member_end
|
|
61
|
-
map_attribute "type", to: :type_attr
|
|
62
|
-
map_attribute "lower", to: :lower
|
|
63
|
-
map_attribute "upper", to: :upper
|
|
64
|
-
map_attribute "isComposite", to: :is_composite
|
|
65
|
-
map_element "type", to: :uml_type
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
class DefaultValue < Lutaml::Model::Serializable
|
|
70
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
71
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
72
|
-
attribute :value, :string
|
|
73
|
-
|
|
74
|
-
xml do
|
|
75
|
-
root "defaultValue"
|
|
76
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
77
|
-
|
|
78
|
-
map_attribute "type", to: :type
|
|
79
|
-
map_attribute "id", to: :id
|
|
80
|
-
map_attribute "value", to: :value
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
class UpperValue < DefaultValue
|
|
85
|
-
xml do
|
|
86
|
-
root "upperValue"
|
|
87
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
88
|
-
|
|
89
|
-
map_attribute "type", to: :type
|
|
90
|
-
map_attribute "id", to: :id
|
|
91
|
-
map_attribute "value", to: :value
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
class LowerValue < DefaultValue
|
|
96
|
-
xml do
|
|
97
|
-
root "lowerValue"
|
|
98
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
99
|
-
|
|
100
|
-
map_attribute "type", to: :type
|
|
101
|
-
map_attribute "id", to: :id
|
|
102
|
-
map_attribute "value", to: :value
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
class OwnedLiteral < Lutaml::Model::Serializable
|
|
107
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
108
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
109
|
-
attribute :name, :string
|
|
110
|
-
attribute :uml_type, Uml::Type
|
|
111
|
-
|
|
112
|
-
xml do
|
|
113
|
-
root "ownedLiteral"
|
|
114
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
115
|
-
|
|
116
|
-
map_attribute "type", to: :type
|
|
117
|
-
map_attribute "id", to: :id
|
|
118
|
-
map_attribute "name", to: :name
|
|
119
|
-
|
|
120
|
-
map_element "type", to: :uml_type
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
class OwnedAttribute < Lutaml::Model::Serializable
|
|
125
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
126
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
127
|
-
attribute :association, :string
|
|
128
|
-
attribute :name, :string
|
|
129
|
-
attribute :is_derived, :string
|
|
130
|
-
attribute :uml_type, Uml::Type
|
|
131
|
-
attribute :upper_value, UpperValue
|
|
132
|
-
attribute :lower_value, LowerValue
|
|
133
|
-
|
|
134
|
-
xml do
|
|
135
|
-
root "ownedAttribute"
|
|
136
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
137
|
-
|
|
138
|
-
map_attribute "type", to: :type
|
|
139
|
-
map_attribute "id", to: :id
|
|
140
|
-
map_attribute "association", to: :association
|
|
141
|
-
map_attribute "name", to: :name
|
|
142
|
-
map_attribute "isDerived", to: :is_derived
|
|
143
|
-
|
|
144
|
-
map_element "type", to: :uml_type
|
|
145
|
-
map_element "upperValue", to: :upper_value
|
|
146
|
-
map_element "lowerValue", to: :lower_value
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
class OwnedParameter < Lutaml::Model::Serializable
|
|
151
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
152
|
-
attribute :name, :string
|
|
153
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
154
|
-
attribute :direction, :string
|
|
155
|
-
attribute :upper_value, UpperValue
|
|
156
|
-
attribute :lower_value, LowerValue
|
|
157
|
-
attribute :default_value, DefaultValue
|
|
158
|
-
|
|
159
|
-
xml do
|
|
160
|
-
root "ownedParameter"
|
|
161
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
162
|
-
|
|
163
|
-
map_attribute "id", to: :id
|
|
164
|
-
map_attribute "name", to: :name
|
|
165
|
-
map_attribute "type", to: :type
|
|
166
|
-
map_attribute "direction", to: :direction
|
|
167
|
-
|
|
168
|
-
map_element "upperValue", to: :upper_value
|
|
169
|
-
map_element "lowerValue", to: :lower_value
|
|
170
|
-
map_element "defaultValue", to: :default_value
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
class Specification < Lutaml::Model::Serializable
|
|
175
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
176
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
177
|
-
attribute :language, :string
|
|
178
|
-
|
|
179
|
-
xml do
|
|
180
|
-
root "specification"
|
|
181
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
182
|
-
|
|
183
|
-
map_attribute "id", to: :id
|
|
184
|
-
map_attribute "type", to: :type
|
|
185
|
-
map_attribute "language", to: :language
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
class Precondition < Lutaml::Model::Serializable
|
|
190
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
191
|
-
attribute :name, :string
|
|
192
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
193
|
-
attribute :specification, Specification
|
|
194
|
-
|
|
195
|
-
xml do
|
|
196
|
-
root "precondition"
|
|
197
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
198
|
-
|
|
199
|
-
map_attribute "id", to: :id
|
|
200
|
-
map_attribute "name", to: :name
|
|
201
|
-
map_attribute "type", to: :type
|
|
202
|
-
map_element "specification", to: :specification
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
class OwnedOperation < Lutaml::Model::Serializable
|
|
207
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
208
|
-
attribute :name, :string
|
|
209
|
-
attribute :owned_parameter, OwnedParameter, collection: true
|
|
210
|
-
attribute :precondition, Precondition
|
|
211
|
-
attribute :uml_type, Uml::Type, collection: true
|
|
212
|
-
|
|
213
|
-
xml do
|
|
214
|
-
root "ownedOperation"
|
|
215
|
-
map_attribute "id", to: :id
|
|
216
|
-
map_attribute "name", to: :name
|
|
217
|
-
map_element "ownedParameter", to: :owned_parameter, value_map: VALUE_MAP
|
|
218
|
-
map_element "precondition", to: :precondition
|
|
219
|
-
map_element "type", to: :uml_type, value_map: VALUE_MAP
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
class OwnedComment < Lutaml::Model::Serializable
|
|
224
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
225
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
226
|
-
attribute :name, :string
|
|
227
|
-
attribute :body_element, :string
|
|
228
|
-
attribute :body_attribute, :string
|
|
229
|
-
attribute :annotated_attribute, :string
|
|
230
|
-
attribute :annotated_element, AnnotatedElement
|
|
231
|
-
|
|
232
|
-
xml do
|
|
233
|
-
root "ownedComment"
|
|
234
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
235
|
-
|
|
236
|
-
map_attribute "type", to: :type
|
|
237
|
-
map_attribute "id", to: :id
|
|
238
|
-
map_attribute "name", to: :name
|
|
239
|
-
map_attribute "body", to: :body_attribute
|
|
240
|
-
map_attribute "annotatedElement", to: :annotated_attribute
|
|
241
|
-
|
|
242
|
-
map_element "annotatedElement", to: :annotated_element
|
|
243
|
-
map_element "body", to: :body_element
|
|
244
|
-
end
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
class AssociationGeneralization < Lutaml::Model::Serializable
|
|
248
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
249
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
250
|
-
attribute :general, :string
|
|
251
|
-
|
|
252
|
-
xml do
|
|
253
|
-
root "generalization"
|
|
254
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
255
|
-
|
|
256
|
-
map_attribute "type", to: :type
|
|
257
|
-
map_attribute "id", to: :id
|
|
258
|
-
map_attribute "general", to: :general
|
|
259
|
-
end
|
|
260
|
-
end
|
|
261
|
-
|
|
262
|
-
class PackagedElement < Lutaml::Model::Serializable
|
|
263
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
264
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
265
|
-
attribute :name, :string
|
|
266
|
-
attribute :member_end, :string
|
|
267
|
-
attribute :member_ends, MemberEnd, collection: true
|
|
268
|
-
attribute :owned_literal, OwnedLiteral, collection: true
|
|
269
|
-
attribute :owned_operation, OwnedOperation, collection: true
|
|
270
|
-
|
|
271
|
-
# EA specific
|
|
272
|
-
attribute :supplier, :string
|
|
273
|
-
attribute :client, :string
|
|
274
|
-
|
|
275
|
-
attribute :packaged_element, PackagedElement, collection: true
|
|
276
|
-
attribute :owned_end, OwnedEnd, collection: true
|
|
277
|
-
attribute :owned_attribute, OwnedAttribute, collection: true
|
|
278
|
-
attribute :owned_comment, OwnedComment, collection: true
|
|
279
|
-
attribute :generalization, AssociationGeneralization, collection: true
|
|
280
|
-
|
|
281
|
-
xml do
|
|
282
|
-
root "packagedElement"
|
|
283
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
284
|
-
|
|
285
|
-
map_attribute "type", to: :type
|
|
286
|
-
map_attribute "id", to: :id
|
|
287
|
-
map_attribute "name", to: :name
|
|
288
|
-
map_attribute "memberEnd", to: :member_end
|
|
289
|
-
|
|
290
|
-
# EA specific
|
|
291
|
-
map_attribute "supplier", to: :supplier
|
|
292
|
-
map_attribute "client", to: :client
|
|
293
|
-
|
|
294
|
-
map_element "generalization", to: :generalization, value_map: VALUE_MAP
|
|
295
|
-
map_element "ownedComment", to: :owned_comment, value_map: VALUE_MAP
|
|
296
|
-
map_element "ownedEnd", to: :owned_end, value_map: VALUE_MAP
|
|
297
|
-
map_element "ownedLiteral", to: :owned_literal, value_map: VALUE_MAP
|
|
298
|
-
map_element "ownedAttribute", to: :owned_attribute, value_map: VALUE_MAP
|
|
299
|
-
map_element "ownedOperation", to: :owned_operation, value_map: VALUE_MAP
|
|
300
|
-
map_element "packagedElement", to: :packaged_element,
|
|
301
|
-
value_map: VALUE_MAP
|
|
302
|
-
map_element "memberEnd", to: :member_ends, value_map: VALUE_MAP
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
class Bounds < Lutaml::Model::Serializable
|
|
307
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
308
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
309
|
-
attribute :x, :integer
|
|
310
|
-
attribute :y, :integer
|
|
311
|
-
attribute :height, :integer
|
|
312
|
-
attribute :width, :integer
|
|
313
|
-
|
|
314
|
-
xml do
|
|
315
|
-
root "bounds"
|
|
316
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
317
|
-
|
|
318
|
-
map_attribute "type", to: :type
|
|
319
|
-
map_attribute "id", to: :id
|
|
320
|
-
map_attribute "x", to: :x
|
|
321
|
-
map_attribute "y", to: :y
|
|
322
|
-
map_attribute "height", to: :height
|
|
323
|
-
map_attribute "width", to: :width
|
|
324
|
-
end
|
|
325
|
-
end
|
|
326
|
-
|
|
327
|
-
class Waypoint < Lutaml::Model::Serializable
|
|
328
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
329
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
330
|
-
attribute :x, :integer
|
|
331
|
-
attribute :y, :integer
|
|
332
|
-
|
|
333
|
-
xml do
|
|
334
|
-
root "waypoint"
|
|
335
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
336
|
-
|
|
337
|
-
map_attribute "type", to: :type
|
|
338
|
-
map_attribute "id", to: :id
|
|
339
|
-
map_attribute "x", to: :x
|
|
340
|
-
map_attribute "y", to: :y
|
|
341
|
-
end
|
|
342
|
-
end
|
|
343
|
-
|
|
344
|
-
class OwnedElement < Lutaml::Model::Serializable
|
|
345
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
346
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
347
|
-
attribute :text, :string
|
|
348
|
-
attribute :model_element, :string
|
|
349
|
-
attribute :owned_element, OwnedElement, collection: true
|
|
350
|
-
attribute :bounds, Bounds, collection: true
|
|
351
|
-
attribute :source, :string
|
|
352
|
-
attribute :target, :string
|
|
353
|
-
attribute :waypoint, Waypoint
|
|
354
|
-
|
|
355
|
-
xml do
|
|
356
|
-
root "ownedElement"
|
|
357
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
358
|
-
|
|
359
|
-
map_attribute "type", to: :type
|
|
360
|
-
map_attribute "id", to: :id
|
|
361
|
-
map_attribute "text", to: :text
|
|
362
|
-
map_attribute "modelElement", to: :model_element
|
|
363
|
-
|
|
364
|
-
map_element "ownedElement", to: :owned_element, value_map: VALUE_MAP
|
|
365
|
-
map_element "bounds", to: :bounds, value_map: VALUE_MAP
|
|
366
|
-
map_element "source", to: :source
|
|
367
|
-
map_element "target", to: :target
|
|
368
|
-
map_element "waypoint", to: :waypoint
|
|
369
|
-
end
|
|
370
|
-
end
|
|
371
|
-
|
|
372
|
-
class Diagram < Lutaml::Model::Serializable
|
|
373
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
374
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
375
|
-
attribute :is_frame, :boolean
|
|
376
|
-
attribute :model_element, :string
|
|
377
|
-
attribute :owned_element, OwnedElement, collection: true
|
|
378
|
-
|
|
379
|
-
xml do
|
|
380
|
-
root "Diagram"
|
|
381
|
-
namespace ::Xmi::Namespace::Omg::UmlDi
|
|
382
|
-
|
|
383
|
-
map_attribute "type", to: :type
|
|
384
|
-
map_attribute "id", to: :id
|
|
385
|
-
map_attribute "isFrame", to: :is_frame
|
|
386
|
-
map_attribute "modelElement", to: :model_element
|
|
387
|
-
|
|
388
|
-
map_element "ownedElement", to: :owned_element, value_map: VALUE_MAP
|
|
389
|
-
end
|
|
390
|
-
end
|
|
391
|
-
|
|
392
|
-
class ProfileApplicationAppliedProfile < Lutaml::Model::Serializable
|
|
393
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
394
|
-
attribute :href, :string
|
|
395
|
-
|
|
396
|
-
xml do
|
|
397
|
-
root "appliedProfile"
|
|
398
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
399
|
-
|
|
400
|
-
map_attribute "type", to: :type
|
|
401
|
-
map_attribute "href", to: :href
|
|
402
|
-
end
|
|
403
|
-
end
|
|
404
|
-
|
|
405
|
-
class ProfileApplication < Lutaml::Model::Serializable
|
|
406
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
407
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
408
|
-
attribute :applied_profile, ProfileApplicationAppliedProfile
|
|
409
|
-
|
|
410
|
-
xml do
|
|
411
|
-
root "profileApplication"
|
|
412
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
413
|
-
|
|
414
|
-
map_attribute "type", to: :type
|
|
415
|
-
map_attribute "id", to: :id
|
|
416
|
-
|
|
417
|
-
map_element "appliedProfile", to: :applied_profile
|
|
418
|
-
end
|
|
419
|
-
end
|
|
420
|
-
|
|
421
|
-
class ImportedPackage < Lutaml::Model::Serializable
|
|
422
|
-
attribute :href, :string
|
|
423
|
-
|
|
424
|
-
xml do
|
|
425
|
-
root "importedPackage"
|
|
426
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
427
|
-
|
|
428
|
-
map_attribute "href", to: :href
|
|
429
|
-
end
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
class PackageImport < Lutaml::Model::Serializable
|
|
433
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
434
|
-
attribute :imported_package, ImportedPackage
|
|
435
|
-
|
|
436
|
-
xml do
|
|
437
|
-
root "packageImport"
|
|
438
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
439
|
-
|
|
440
|
-
map_attribute "id", to: :id
|
|
441
|
-
|
|
442
|
-
map_element "importedPackage", to: :imported_package
|
|
443
|
-
end
|
|
444
|
-
end
|
|
445
|
-
|
|
446
|
-
class UmlModel < Lutaml::Model::Serializable
|
|
447
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
448
|
-
attribute :name, :string
|
|
449
|
-
attribute :profile_application, ProfileApplication, collection: true
|
|
450
|
-
attribute :packaged_element, PackagedElement, collection: true
|
|
451
|
-
attribute :package_import, PackageImport, collection: true
|
|
452
|
-
attribute :diagram, Diagram
|
|
453
|
-
|
|
454
|
-
xml do
|
|
455
|
-
root "Model"
|
|
456
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
457
|
-
|
|
458
|
-
map_attribute "type", to: :type
|
|
459
|
-
map_attribute "name", to: :name
|
|
460
|
-
|
|
461
|
-
map_element "packageImport", to: :package_import, value_map: VALUE_MAP
|
|
462
|
-
map_element "packagedElement", to: :packaged_element,
|
|
463
|
-
value_map: VALUE_MAP
|
|
464
|
-
map_element "Diagram", to: :diagram
|
|
465
|
-
map_element "profileApplication", to: :profile_application,
|
|
466
|
-
value_map: VALUE_MAP
|
|
467
|
-
end
|
|
468
|
-
end
|
|
469
|
-
|
|
470
|
-
module ProfileAttributes
|
|
471
|
-
def self.included(klass)
|
|
472
|
-
klass.class_eval do
|
|
473
|
-
attribute :packaged_element, PackagedElement, collection: true
|
|
474
|
-
attribute :package_import, PackageImport, collection: true
|
|
475
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
476
|
-
attribute :name, :string
|
|
477
|
-
# attribute :xmi, :string
|
|
478
|
-
# attribute :uml, :string
|
|
479
|
-
attribute :ns_prefix, :string
|
|
480
|
-
|
|
481
|
-
# Is this an EA thing?
|
|
482
|
-
attribute :metamodel_reference, :string
|
|
483
|
-
end
|
|
484
|
-
end
|
|
485
|
-
end
|
|
486
|
-
|
|
487
|
-
class Profile < Lutaml::Model::Serializable
|
|
488
|
-
include ProfileAttributes
|
|
489
|
-
|
|
490
|
-
attribute :owned_comment, OwnedComment, collection: true
|
|
491
|
-
|
|
492
|
-
xml do
|
|
493
|
-
root "Profile"
|
|
494
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
495
|
-
|
|
496
|
-
map_attribute "id", to: :id
|
|
497
|
-
map_attribute "name", to: :name
|
|
498
|
-
map_attribute "metamodelReference", to: :metamodel_reference
|
|
499
|
-
map_attribute "nsPrefix", to: :ns_prefix
|
|
500
|
-
|
|
501
|
-
map_element "ownedComment", to: :owned_comment, value_map: VALUE_MAP
|
|
502
|
-
map_element "packageImport", to: :package_import, value_map: VALUE_MAP
|
|
503
|
-
map_element "packagedElement", to: :packaged_element,
|
|
504
|
-
value_map: VALUE_MAP
|
|
505
|
-
end
|
|
506
|
-
end
|
|
5
|
+
autoload :AnnotatedElement, "xmi/uml/annotated_element"
|
|
6
|
+
autoload :Type, "xmi/uml/type"
|
|
7
|
+
autoload :MemberEnd, "xmi/uml/member_end"
|
|
8
|
+
autoload :DefaultValue, "xmi/uml/default_value"
|
|
9
|
+
autoload :UpperValue, "xmi/uml/default_value"
|
|
10
|
+
autoload :LowerValue, "xmi/uml/default_value"
|
|
11
|
+
autoload :OwnedEnd, "xmi/uml/owned_end"
|
|
12
|
+
autoload :OwnedLiteral, "xmi/uml/owned_literal"
|
|
13
|
+
autoload :OwnedAttribute, "xmi/uml/owned_attribute"
|
|
14
|
+
autoload :Specification, "xmi/uml/specification"
|
|
15
|
+
autoload :OwnedParameter, "xmi/uml/owned_parameter"
|
|
16
|
+
autoload :Precondition, "xmi/uml/precondition"
|
|
17
|
+
autoload :OwnedOperation, "xmi/uml/owned_operation"
|
|
18
|
+
autoload :OwnedComment, "xmi/uml/owned_comment"
|
|
19
|
+
autoload :AssociationGeneralization, "xmi/uml/association_generalization"
|
|
20
|
+
autoload :PackagedElement, "xmi/uml/packaged_element"
|
|
21
|
+
autoload :Bounds, "xmi/uml/bounds"
|
|
22
|
+
autoload :Waypoint, "xmi/uml/bounds"
|
|
23
|
+
autoload :OwnedElement, "xmi/uml/owned_element"
|
|
24
|
+
autoload :Diagram, "xmi/uml/diagram"
|
|
25
|
+
autoload :ProfileApplicationAppliedProfile, "xmi/uml/profile_application"
|
|
26
|
+
autoload :ProfileApplication, "xmi/uml/profile_application"
|
|
27
|
+
autoload :ImportedPackage, "xmi/uml/package_import"
|
|
28
|
+
autoload :PackageImport, "xmi/uml/package_import"
|
|
29
|
+
autoload :UmlModel, "xmi/uml/uml_model"
|
|
30
|
+
autoload :ProfileAttributes, "xmi/uml/profile"
|
|
31
|
+
autoload :Profile, "xmi/uml/profile"
|
|
507
32
|
end
|
|
508
33
|
end
|
data/lib/xmi/version.rb
CHANGED
data/lib/xmi/version_registry.rb
CHANGED
|
@@ -158,7 +158,8 @@ module Xmi
|
|
|
158
158
|
# Extend fallback chain only if it won't create a cycle.
|
|
159
159
|
# A cycle would occur if reg's fallback chain includes primary_register.
|
|
160
160
|
# We check this by seeing if primary_register.id appears in reg's fallback.
|
|
161
|
-
|
|
161
|
+
# Use add_fallback to keep Register and TypeContext in sync and invalidate caches.
|
|
162
|
+
primary_register.add_fallback(reg.id) unless reg.fallback.include?(primary_register.id)
|
|
162
163
|
end
|
|
163
164
|
end
|
|
164
165
|
# rubocop:enable Metrics/CyclomaticComplexity
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Xmi
|
|
4
|
+
# Shared XMI identity attributes and their XML mappings.
|
|
5
|
+
#
|
|
6
|
+
# Many XMI elements share the same set of identity attributes:
|
|
7
|
+
# id, label, uuid, href, idref, type. This module centralizes their
|
|
8
|
+
# declarations to prevent divergence bugs (e.g., issue #74 where
|
|
9
|
+
# idref was declared as :string instead of ::Xmi::Type::XmiIdRef).
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# class MyElement < Lutaml::Model::Serializable
|
|
13
|
+
# include Xmi::XmiIdentity::Attributes
|
|
14
|
+
#
|
|
15
|
+
# xml do
|
|
16
|
+
# Xmi::XmiIdentity.apply_xml_mappings(self)
|
|
17
|
+
# end
|
|
18
|
+
# end
|
|
19
|
+
module XmiIdentity
|
|
20
|
+
module Attributes
|
|
21
|
+
def self.included(klass)
|
|
22
|
+
klass.class_eval do
|
|
23
|
+
attribute :id, ::Xmi::Type::XmiId
|
|
24
|
+
attribute :label, ::Xmi::Type::XmiLabel
|
|
25
|
+
attribute :uuid, ::Xmi::Type::XmiUuid
|
|
26
|
+
attribute :href, :string
|
|
27
|
+
attribute :idref, ::Xmi::Type::XmiIdRef
|
|
28
|
+
attribute :type, ::Xmi::Type::XmiType
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Apply XMI identity XML attribute mappings to a mapping builder.
|
|
34
|
+
# Call this inside an `xml do ... end` block.
|
|
35
|
+
#
|
|
36
|
+
# @param mapping [Lutaml::Xml::Mapping] the mapping builder (self in xml block)
|
|
37
|
+
def self.apply_xml_mappings(mapping)
|
|
38
|
+
mapping.map_attribute "id", to: :id
|
|
39
|
+
mapping.map_attribute "label", to: :label
|
|
40
|
+
mapping.map_attribute "uuid", to: :uuid
|
|
41
|
+
mapping.map_attribute "href", to: :href
|
|
42
|
+
mapping.map_attribute "idref", to: :idref
|
|
43
|
+
mapping.map_attribute "type", to: :type
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/lib/xmi.rb
CHANGED
|
@@ -22,6 +22,7 @@ require_relative "xmi/namespace/dynamic"
|
|
|
22
22
|
require_relative "xmi/type"
|
|
23
23
|
require_relative "xmi/namespace_detector"
|
|
24
24
|
require_relative "xmi/namespace_registry"
|
|
25
|
+
require_relative "xmi/xmi_identity"
|
|
25
26
|
|
|
26
27
|
module Xmi
|
|
27
28
|
class Error < StandardError; end
|
|
@@ -52,14 +53,18 @@ require_relative "xmi/extension"
|
|
|
52
53
|
require_relative "xmi/replace"
|
|
53
54
|
require_relative "xmi/ea_root"
|
|
54
55
|
require_relative "xmi/uml"
|
|
55
|
-
require_relative "xmi/custom_profile"
|
|
56
|
-
require_relative "xmi/root"
|
|
57
|
-
require_relative "xmi/sparx"
|
|
58
|
-
|
|
59
|
-
# Unified parsing API
|
|
60
|
-
require_relative "xmi/parsing"
|
|
61
56
|
|
|
62
57
|
module Xmi
|
|
58
|
+
# Lazy-loaded top-level modules — autoload avoids loading these
|
|
59
|
+
# until their constants are actually referenced at runtime.
|
|
60
|
+
autoload :CustomProfile, "xmi/custom_profile"
|
|
61
|
+
autoload :Root, "xmi/root"
|
|
62
|
+
autoload :Sparx, "xmi/sparx"
|
|
63
|
+
|
|
64
|
+
# Unified parsing API
|
|
65
|
+
autoload :Parsing, "xmi/parsing"
|
|
66
|
+
autoload :ParserPipeline, "xmi/parser_pipeline"
|
|
67
|
+
|
|
63
68
|
class << self
|
|
64
69
|
# @api public
|
|
65
70
|
# Initialize all version registers
|