xmi 0.3.21 → 0.5.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +13 -6
  3. data/.gitignore +2 -1
  4. data/.rubocop.yml +12 -13
  5. data/.rubocop_todo.yml +150 -13
  6. data/CHANGELOG.md +55 -0
  7. data/CODE_OF_CONDUCT.md +84 -0
  8. data/Gemfile +10 -0
  9. data/README.adoc +319 -6
  10. data/benchmark_parse.rb +60 -0
  11. data/docs/migration.md +141 -0
  12. data/docs/versioning.md +255 -0
  13. data/lib/xmi/add.rb +14 -38
  14. data/lib/xmi/{the_custom_profile.rb → custom_profile.rb} +25 -25
  15. data/lib/xmi/delete.rb +14 -38
  16. data/lib/xmi/difference.rb +14 -38
  17. data/lib/xmi/documentation.rb +16 -101
  18. data/lib/xmi/ea_root.rb +114 -33
  19. data/lib/xmi/extension.rb +6 -6
  20. data/lib/xmi/namespace/dynamic.rb +28 -0
  21. data/lib/xmi/namespace/omg.rb +81 -0
  22. data/lib/xmi/namespace/sparx.rb +39 -0
  23. data/lib/xmi/namespace.rb +9 -0
  24. data/lib/xmi/namespace_detector.rb +138 -0
  25. data/lib/xmi/namespace_registry.rb +119 -0
  26. data/lib/xmi/parsing.rb +113 -0
  27. data/lib/xmi/replace.rb +14 -38
  28. data/lib/xmi/root.rb +49 -213
  29. data/lib/xmi/sparx/connector.rb +241 -0
  30. data/lib/xmi/sparx/custom_profile.rb +19 -0
  31. data/lib/xmi/sparx/diagram.rb +97 -0
  32. data/lib/xmi/sparx/ea_stub.rb +20 -0
  33. data/lib/xmi/{extensions/eauml.rb → sparx/ea_uml.rb} +3 -2
  34. data/lib/xmi/sparx/element.rb +453 -0
  35. data/lib/xmi/sparx/extension.rb +43 -0
  36. data/lib/xmi/{extensions → sparx}/gml.rb +9 -3
  37. data/lib/xmi/sparx/mappings/base_mapping.rb +182 -0
  38. data/lib/xmi/sparx/mappings.rb +10 -0
  39. data/lib/xmi/sparx/primitive_type.rb +18 -0
  40. data/lib/xmi/sparx/root.rb +60 -0
  41. data/lib/xmi/sparx/sys_ph_s.rb +18 -0
  42. data/lib/xmi/sparx.rb +17 -1376
  43. data/lib/xmi/type.rb +37 -0
  44. data/lib/xmi/uml.rb +191 -469
  45. data/lib/xmi/v20110701.rb +81 -0
  46. data/lib/xmi/v20131001.rb +68 -0
  47. data/lib/xmi/v20161101.rb +61 -0
  48. data/lib/xmi/version.rb +1 -1
  49. data/lib/xmi/version_registry.rb +164 -0
  50. data/lib/xmi/versioned.rb +142 -0
  51. data/lib/xmi.rb +83 -11
  52. data/scripts-xmi-profile/profile_xmi_simple.rb +213 -0
  53. data/xmi.gemspec +3 -9
  54. metadata +38 -77
@@ -0,0 +1,453 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Sparx
5
+ module Element
6
+ class Documentation < Lutaml::Model::Serializable
7
+ attribute :value, :string
8
+
9
+ xml do
10
+ root "documentation"
11
+
12
+ map_attribute "value", to: :value
13
+ end
14
+ end
15
+
16
+ class Model < Lutaml::Model::Serializable
17
+ attribute :package, :string
18
+ attribute :package2, :string
19
+ attribute :tpos, :integer
20
+ attribute :ea_localid, :string
21
+ attribute :ea_eleType, :string
22
+
23
+ xml do
24
+ root "model"
25
+ namespace ::Xmi::Namespace::Omg::Uml
26
+
27
+ map_attribute "package", to: :package
28
+ map_attribute "package2", to: :package2
29
+ map_attribute "tpos", to: :tpos
30
+ map_attribute "ea_localid", to: :ea_localid
31
+ map_attribute "ea_eleType", to: :ea_eleType
32
+ end
33
+ end
34
+
35
+ class Properties < Lutaml::Model::Serializable
36
+ attribute :name, :string
37
+ attribute :type, ::Xmi::Type::XmiType
38
+ attribute :is_specification, :boolean
39
+ attribute :is_root, :boolean
40
+ attribute :is_leaf, :boolean
41
+ attribute :is_abstract, :boolean
42
+ attribute :is_active, :boolean
43
+ attribute :s_type, :string
44
+ attribute :n_type, :string
45
+ attribute :scope, :string
46
+ attribute :stereotype, :string
47
+ attribute :alias, :string
48
+ attribute :documentation, :string
49
+
50
+ xml do
51
+ root "properties"
52
+
53
+ map_attribute "name", to: :name
54
+ map_attribute "type", to: :type
55
+ map_attribute "isSpecification", to: :is_specification
56
+ map_attribute "isRoot", to: :is_root
57
+ map_attribute "isLeaf", to: :is_leaf
58
+ map_attribute "isAbstract", to: :is_abstract
59
+ map_attribute "isActive", to: :is_active
60
+ map_attribute "sType", to: :s_type
61
+ map_attribute "nType", to: :n_type
62
+ map_attribute "scope", to: :scope
63
+ map_attribute "stereotype", to: :stereotype
64
+ map_attribute "alias", to: :alias
65
+ map_attribute "documentation", to: :documentation
66
+ end
67
+ end
68
+
69
+ class Project < Lutaml::Model::Serializable
70
+ attribute :author, :string
71
+ attribute :version, :string
72
+ attribute :phase, :string
73
+ attribute :created, :string
74
+ attribute :modified, :string
75
+ attribute :complexity, :integer
76
+ attribute :status, :string
77
+
78
+ xml do
79
+ root "project"
80
+
81
+ map_attribute "author", to: :author
82
+ map_attribute "version", to: :version
83
+ map_attribute "phase", to: :phase
84
+ map_attribute "created", to: :created
85
+ map_attribute "modified", to: :modified
86
+ map_attribute "complexity", to: :complexity
87
+ map_attribute "status", to: :status
88
+ end
89
+ end
90
+
91
+ class Code < Lutaml::Model::Serializable
92
+ attribute :gentype, :string
93
+ attribute :product_name, :string
94
+
95
+ xml do
96
+ root "code"
97
+
98
+ map_attribute "gentype", to: :gentype
99
+ map_attribute "product_name", to: :product_name
100
+ end
101
+ end
102
+
103
+ class Style < Lutaml::Model::Serializable
104
+ attribute :appearance, :string
105
+
106
+ xml do
107
+ root "style"
108
+
109
+ map_attribute "appearance", to: :appearance
110
+ end
111
+ end
112
+
113
+ class Tag < Lutaml::Model::Serializable
114
+ attribute :id, ::Xmi::Type::XmiId
115
+ attribute :name, :string
116
+ attribute :value, :string
117
+ attribute :model_element, :string
118
+
119
+ xml do
120
+ root "tag"
121
+
122
+ map_attribute "id", to: :id
123
+ map_attribute "name", to: :name
124
+ map_attribute "value", to: :value
125
+ map_attribute "modelElement", to: :model_element
126
+ end
127
+ end
128
+
129
+ class Tags < Lutaml::Model::Serializable
130
+ attribute :tags, Tag, collection: true
131
+
132
+ xml do
133
+ root "tags"
134
+ map_element "tag", to: :tags, value_map: VALUE_MAP
135
+ end
136
+ end
137
+
138
+ class Xrefs < Lutaml::Model::Serializable
139
+ attribute :value, :string
140
+
141
+ xml do
142
+ root "xrefs"
143
+
144
+ map_attribute "value", to: :value
145
+ end
146
+ end
147
+
148
+ class ExtendedProperties < Lutaml::Model::Serializable
149
+ attribute :tagged, :string
150
+ attribute :package_name, :string
151
+ attribute :virtual_inheritance, :integer
152
+
153
+ xml do
154
+ root "extendedProperties"
155
+
156
+ map_attribute "tagged", to: :tagged
157
+ map_attribute "package_name", to: :package_name
158
+ map_attribute "virtualInheritance", to: :virtual_inheritance
159
+ end
160
+ end
161
+
162
+ class PackageProperties < Lutaml::Model::Serializable
163
+ attribute :version, :string
164
+ attribute :xmiver, :string
165
+ attribute :tpos, :string
166
+
167
+ xml do
168
+ root "packagedproperties"
169
+
170
+ map_attribute "version", to: :version
171
+ map_attribute "xmiver", to: :xmiver
172
+ map_attribute "tpos", to: :tpos
173
+ end
174
+ end
175
+
176
+ class Paths < Lutaml::Model::Serializable
177
+ attribute :xmlpath, :string
178
+
179
+ xml do
180
+ root "paths"
181
+
182
+ map_attribute "xmlpath", to: :xmlpath
183
+ end
184
+ end
185
+
186
+ class Times < Lutaml::Model::Serializable
187
+ attribute :created, :string
188
+ attribute :modified, :string
189
+ attribute :last_load_date, :string
190
+ attribute :last_save_date, :string
191
+
192
+ xml do
193
+ root "times"
194
+
195
+ map_attribute "created", to: :created
196
+ map_attribute "modified", to: :modified
197
+ map_attribute "lastloaddate", to: :last_load_date
198
+ map_attribute "lastsavedate", to: :last_save_date
199
+ end
200
+ end
201
+
202
+ class Flags < Lutaml::Model::Serializable
203
+ attribute :is_controlled, :integer
204
+ attribute :is_protected, :integer
205
+ attribute :batch_save, :integer
206
+ attribute :batch_load, :integer
207
+ attribute :used_td, :integer
208
+ attribute :log_xml, :integer
209
+ attribute :package_flags, :string
210
+
211
+ xml do
212
+ root "flags"
213
+
214
+ map_attribute "iscontrolled", to: :is_controlled
215
+ map_attribute "isprotected", to: :is_protected
216
+ map_attribute "batchsave", to: :batch_save
217
+ map_attribute "batchload", to: :batch_load
218
+ map_attribute "usedtd", to: :used_td
219
+ map_attribute "logxml", to: :log_xml
220
+ map_attribute "packageFlags", to: :package_flags
221
+ end
222
+ end
223
+
224
+ class Association < Lutaml::Model::Serializable
225
+ attribute :id, ::Xmi::Type::XmiId
226
+ attribute :start, :string
227
+ attribute :end, :string
228
+ attribute :name, :string, default: -> { "Association" }
229
+
230
+ xml do
231
+ root "Association"
232
+
233
+ map_attribute "id", to: :id
234
+ map_attribute "start", to: :start
235
+ map_attribute "end", to: :end
236
+ end
237
+ end
238
+
239
+ class Generalization < Association
240
+ attribute :name, :string, default: -> { "Generalization" }
241
+
242
+ xml do
243
+ root "Generalization"
244
+
245
+ map_attribute "id", to: :id
246
+ map_attribute "start", to: :start
247
+ map_attribute "end", to: :end
248
+ end
249
+ end
250
+
251
+ class Aggregation < Association
252
+ attribute :name, :string, default: -> { "Aggregation" }
253
+
254
+ xml do
255
+ root "Aggregation"
256
+
257
+ map_attribute "id", to: :id
258
+ map_attribute "start", to: :start
259
+ map_attribute "end", to: :end
260
+ end
261
+ end
262
+
263
+ class NoteLink < Association
264
+ attribute :name, :string, default: -> { "NoteLink" }
265
+
266
+ xml do
267
+ root "NoteLink"
268
+
269
+ map_attribute "id", to: :id
270
+ map_attribute "start", to: :start
271
+ map_attribute "end", to: :end
272
+ end
273
+ end
274
+
275
+ class Styleex < Lutaml::Model::Serializable
276
+ attribute :value, :string
277
+
278
+ xml do
279
+ root "styleex"
280
+
281
+ map_attribute "value", to: :value
282
+ end
283
+ end
284
+
285
+ class Bounds < Lutaml::Model::Serializable
286
+ attribute :lower, :integer
287
+ attribute :upper, :integer
288
+
289
+ xml do
290
+ root "bounds"
291
+
292
+ map_attribute "lower", to: :lower
293
+ map_attribute "upper", to: :upper
294
+ end
295
+ end
296
+
297
+ class Stereotype < Lutaml::Model::Serializable
298
+ attribute :stereotype, :string
299
+
300
+ xml do
301
+ root "stereotype"
302
+
303
+ map_attribute "stereotype", to: :stereotype
304
+ end
305
+ end
306
+
307
+ class Containment < Lutaml::Model::Serializable
308
+ attribute :containment, :string
309
+ attribute :position, :integer
310
+
311
+ xml do
312
+ root "containment"
313
+
314
+ map_attribute "containment", to: :containment
315
+ map_attribute "position", to: :position
316
+ end
317
+ end
318
+
319
+ class Coords < Lutaml::Model::Serializable
320
+ attribute :ordered, :integer
321
+ attribute :scale, :integer
322
+
323
+ xml do
324
+ root "coords"
325
+
326
+ map_attribute "ordered", to: :ordered
327
+ map_attribute "scale", to: :scale
328
+ end
329
+ end
330
+
331
+ class Attribute < Lutaml::Model::Serializable
332
+ attribute :idref, ::Xmi::Type::XmiIdRef
333
+ attribute :name, :string
334
+ attribute :scope, :string
335
+ attribute :initial, :string
336
+ attribute :documentation, Documentation
337
+ attribute :options, :string
338
+ attribute :style, :string
339
+ attribute :tags, :string, collection: true
340
+ attribute :model, Model
341
+ attribute :properties, Properties
342
+ attribute :coords, Coords
343
+ attribute :containment, Containment
344
+ attribute :stereotype, Stereotype
345
+ attribute :bounds, Bounds
346
+ attribute :styleex, Styleex
347
+ attribute :xrefs, Xrefs
348
+
349
+ xml do
350
+ root "attribute"
351
+
352
+ map_attribute "idref", to: :idref
353
+ map_attribute "name", to: :name
354
+ map_attribute "scope", to: :scope
355
+
356
+ map_element "initial", to: :initial
357
+ map_element "options", to: :options
358
+ map_element "style", to: :style
359
+ map_element "tags", to: :tags, value_map: VALUE_MAP
360
+ map_element "documentation", to: :documentation
361
+ map_element "model", to: :model
362
+ map_element "properties", to: :properties
363
+ map_element "coords", to: :coords
364
+ map_element "containment", to: :containment
365
+ map_element "stereotype", to: :stereotype
366
+ map_element "bounds", to: :bounds
367
+ map_element "styleex", to: :styleex
368
+ map_element "xrefs", to: :xrefs
369
+ end
370
+ end
371
+
372
+ class Attributes < Lutaml::Model::Serializable
373
+ attribute :attribute, Attribute, collection: true
374
+
375
+ xml do
376
+ root "attributes"
377
+
378
+ map_element "attribute", to: :attribute, value_map: VALUE_MAP
379
+ end
380
+ end
381
+
382
+ class Links < Lutaml::Model::Serializable
383
+ attribute :association, Association, collection: true
384
+ attribute :generalization, Generalization, collection: true
385
+ attribute :note_link, NoteLink, collection: true
386
+
387
+ xml do
388
+ root "links"
389
+
390
+ map_element "Association", to: :association, value_map: VALUE_MAP
391
+ map_element "Generalization", to: :generalization,
392
+ value_map: VALUE_MAP
393
+ map_element "NoteLink", to: :note_link, value_map: VALUE_MAP
394
+ end
395
+ end
396
+
397
+ class Element < Lutaml::Model::Serializable
398
+ attribute :idref, ::Xmi::Type::XmiIdRef
399
+ attribute :type, ::Xmi::Type::XmiType
400
+ attribute :name, :string
401
+ attribute :scope, :string
402
+ attribute :model, Model
403
+ attribute :properties, Properties
404
+ attribute :project, Project
405
+ attribute :code, Code
406
+ attribute :style, Style
407
+ attribute :tags, Tags
408
+ attribute :xrefs, Xrefs
409
+ attribute :extended_properties, ExtendedProperties
410
+ attribute :package_properties, PackageProperties
411
+ attribute :paths, Paths
412
+ attribute :times, Times
413
+ attribute :flags, Flags
414
+ attribute :links, Links, collection: true
415
+ attribute :attributes, Attributes
416
+
417
+ xml do
418
+ root "element"
419
+
420
+ map_attribute "idref", to: :idref
421
+ map_attribute "type", to: :type
422
+ map_attribute "name", to: :name
423
+ map_attribute "scope", to: :scope
424
+
425
+ map_element "model", to: :model
426
+ map_element "properties", to: :properties
427
+ map_element "project", to: :project
428
+ map_element "code", to: :code
429
+ map_element "style", to: :style
430
+ map_element "tags", to: :tags
431
+ map_element "xrefs", to: :xrefs
432
+ map_element "extendedProperties", to: :extended_properties
433
+ map_element "packageproperties", to: :package_properties
434
+ map_element "paths", to: :paths
435
+ map_element "times", to: :times
436
+ map_element "flags", to: :flags
437
+ map_element "links", to: :links
438
+ map_element "attributes", to: :attributes
439
+ end
440
+ end
441
+
442
+ class Elements < Lutaml::Model::Serializable
443
+ attribute :element, Element, collection: true
444
+
445
+ xml do
446
+ root "elements"
447
+
448
+ map_element "element", to: :element, value_map: VALUE_MAP
449
+ end
450
+ end
451
+ end
452
+ end
453
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Sparx
5
+ class Extension < Lutaml::Model::Serializable
6
+ attribute :id, ::Xmi::Type::XmiId
7
+ attribute :label, ::Xmi::Type::XmiLabel
8
+ attribute :uuid, ::Xmi::Type::XmiUuid
9
+ attribute :href, :string
10
+ attribute :idref, ::Xmi::Type::XmiIdRef
11
+ attribute :type, ::Xmi::Type::XmiType
12
+ attribute :extender, :string
13
+ attribute :extender_id, :string
14
+ attribute :elements, Element::Elements
15
+ attribute :connectors, Connector::Connectors
16
+ attribute :primitive_types, PrimitiveType::PrimitiveTypes
17
+ attribute :diagrams, Diagram::Diagrams
18
+ attribute :ea_stub, EaStub, collection: true
19
+ attribute :profiles, CustomProfile::Profiles
20
+
21
+ xml do
22
+ root "Extension"
23
+ namespace ::Xmi::Namespace::Omg::Xmi
24
+
25
+ map_attribute "id", to: :id
26
+ map_attribute "label", to: :label
27
+ map_attribute "uuid", to: :uuid
28
+ map_attribute "href", to: :href
29
+ map_attribute "idref", to: :idref
30
+ map_attribute "type", to: :type
31
+ map_attribute "extender", to: :extender
32
+ map_attribute "extenderID", to: :extender_id
33
+
34
+ map_element "elements", to: :elements
35
+ map_element "connectors", to: :connectors
36
+ map_element "primitivetypes", to: :primitive_types
37
+ map_element "profiles", to: :profiles
38
+ map_element "diagrams", to: :diagrams
39
+ map_element "EAStub", to: :ea_stub, value_map: VALUE_MAP
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir[File.join(__dir__, "ea_extensions", "*.rb")].each { |file| require file }
4
-
5
3
  module Xmi
6
- class EaRoot
4
+ module Sparx
7
5
  module Gml
8
6
  class ApplicationSchema < Lutaml::Model::Serializable
9
7
  # prefix altered_ is prepended to xmlns to avoid conflict with
@@ -16,6 +14,7 @@ module Xmi
16
14
 
17
15
  xml do
18
16
  root "ApplicationSchema"
17
+ namespace ::Xmi::Namespace::Sparx::Gml
19
18
 
20
19
  map_attribute "version", to: :version
21
20
  map_attribute "xsdDocument", to: :xsd_document
@@ -32,6 +31,7 @@ module Xmi
32
31
 
33
32
  xml do
34
33
  root "CodeList"
34
+ namespace ::Xmi::Namespace::Sparx::Gml
35
35
 
36
36
  map_attribute "asDictionary", to: :as_dictionary
37
37
  map_attribute "defaultCodeSpace", to: :default_code_space
@@ -46,6 +46,7 @@ module Xmi
46
46
 
47
47
  xml do
48
48
  root "DataType"
49
+ namespace ::Xmi::Namespace::Sparx::Gml
49
50
 
50
51
  map_attribute "isCollection", to: :is_collection
51
52
  map_attribute "noPropertyType", to: :no_property_type
@@ -60,6 +61,7 @@ module Xmi
60
61
 
61
62
  xml do
62
63
  root "Union"
64
+ namespace ::Xmi::Namespace::Sparx::Gml
63
65
 
64
66
  map_attribute "isCollection", to: :is_collection
65
67
  map_attribute "noPropertyType", to: :no_property_type
@@ -72,6 +74,7 @@ module Xmi
72
74
 
73
75
  xml do
74
76
  root "Enumeration"
77
+ namespace ::Xmi::Namespace::Sparx::Gml
75
78
 
76
79
  map_attribute "base_Enumeration", to: :base_enumeration
77
80
  end
@@ -84,6 +87,7 @@ module Xmi
84
87
 
85
88
  xml do
86
89
  root "Type"
90
+ namespace ::Xmi::Namespace::Sparx::Gml
87
91
 
88
92
  map_attribute "isCollection", to: :is_collection
89
93
  map_attribute "noPropertyType", to: :no_property_type
@@ -99,6 +103,7 @@ module Xmi
99
103
 
100
104
  xml do
101
105
  root "FeatureType"
106
+ namespace ::Xmi::Namespace::Sparx::Gml
102
107
 
103
108
  map_attribute "isCollection", to: :is_collection
104
109
  map_attribute "noPropertyType", to: :no_property_type
@@ -115,6 +120,7 @@ module Xmi
115
120
 
116
121
  xml do
117
122
  root "property"
123
+ namespace ::Xmi::Namespace::Sparx::Gml
118
124
 
119
125
  map_attribute "sequenceNumber", to: :sequence_number
120
126
  map_attribute "base_Property", to: :base_property