xmi 0.5.11 → 0.6.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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/.rubocop_todo.yml +102 -7
  4. data/CLAUDE.md +43 -14
  5. data/lib/xmi/add.rb +0 -3
  6. data/lib/xmi/delete.rb +0 -3
  7. data/lib/xmi/difference.rb +0 -2
  8. data/lib/xmi/documentation.rb +0 -2
  9. data/lib/xmi/ea_root.rb +5 -4
  10. data/lib/xmi/namespace.rb +3 -3
  11. data/lib/xmi/replace.rb +0 -3
  12. data/lib/xmi/root.rb +0 -3
  13. data/lib/xmi/type.rb +0 -2
  14. data/lib/xmi/uml/association.rb +10 -0
  15. data/lib/xmi/uml/association_class.rb +15 -0
  16. data/lib/xmi/uml/association_generalization.rb +1 -8
  17. data/lib/xmi/uml/base.rb +32 -0
  18. data/lib/xmi/uml/bounds.rb +2 -25
  19. data/lib/xmi/uml/data_type.rb +10 -0
  20. data/lib/xmi/uml/default_value.rb +5 -34
  21. data/lib/xmi/uml/dependency.rb +15 -0
  22. data/lib/xmi/uml/diagram.rb +2 -8
  23. data/lib/xmi/uml/enumeration.rb +10 -0
  24. data/lib/xmi/uml/extension.rb +16 -0
  25. data/lib/xmi/uml/imported_package.rb +17 -0
  26. data/lib/xmi/uml/instance_specification.rb +11 -0
  27. data/lib/xmi/uml/interface.rb +10 -0
  28. data/lib/xmi/uml/interface_realization.rb +26 -0
  29. data/lib/xmi/uml/literal_boolean.rb +15 -0
  30. data/lib/xmi/uml/literal_integer.rb +15 -0
  31. data/lib/xmi/uml/literal_null.rb +14 -0
  32. data/lib/xmi/uml/literal_string.rb +15 -0
  33. data/lib/xmi/uml/literal_unlimited_natural.rb +16 -0
  34. data/lib/xmi/uml/lower_value.rb +11 -0
  35. data/lib/xmi/uml/opaque_expression.rb +31 -0
  36. data/lib/xmi/uml/owned_attribute.rb +28 -13
  37. data/lib/xmi/uml/owned_comment.rb +1 -8
  38. data/lib/xmi/uml/owned_element.rb +4 -8
  39. data/lib/xmi/uml/owned_end.rb +15 -12
  40. data/lib/xmi/uml/owned_literal.rb +1 -9
  41. data/lib/xmi/uml/owned_operation.rb +11 -4
  42. data/lib/xmi/uml/owned_parameter.rb +18 -12
  43. data/lib/xmi/uml/package.rb +10 -0
  44. data/lib/xmi/uml/package_import.rb +0 -12
  45. data/lib/xmi/uml/packaged_element.rb +50 -10
  46. data/lib/xmi/uml/precondition.rb +1 -8
  47. data/lib/xmi/uml/primitive_type.rb +10 -0
  48. data/lib/xmi/uml/profile.rb +11 -25
  49. data/lib/xmi/uml/profile_application.rb +4 -22
  50. data/lib/xmi/uml/profile_application_applied_profile.rb +21 -0
  51. data/lib/xmi/uml/realization.rb +12 -0
  52. data/lib/xmi/uml/signal.rb +16 -0
  53. data/lib/xmi/uml/slot.rb +18 -0
  54. data/lib/xmi/uml/specification.rb +3 -8
  55. data/lib/xmi/uml/stereotype.rb +16 -0
  56. data/lib/xmi/uml/uml_class.rb +15 -0
  57. data/lib/xmi/uml/uml_model.rb +4 -10
  58. data/lib/xmi/uml/upper_value.rb +11 -0
  59. data/lib/xmi/uml/usage.rb +16 -0
  60. data/lib/xmi/uml/value_specification.rb +46 -0
  61. data/lib/xmi/uml/waypoint.rb +17 -0
  62. data/lib/xmi/uml.rb +31 -6
  63. data/lib/xmi/uml_di/base.rb +22 -0
  64. data/lib/xmi/uml_di.rb +10 -0
  65. data/lib/xmi/version.rb +1 -1
  66. data/lib/xmi.rb +38 -27
  67. metadata +34 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 621742aa6b438d4102e5bed3f5c9e726d0b2e79058516c2fde73b801e324dd4f
4
- data.tar.gz: a1d9fe2a101517e214cd61b834494865777b23db5d1da98509d9ef5c0ddbd8c6
3
+ metadata.gz: db371f76bfe7fa3b6f16392f150e7bdd4a70b390053317de58ae11ea4d469fa8
4
+ data.tar.gz: b5d0ac779b25967ba94abaa37ec726414a296680c313d451dbc7f3ec230ab4f1
5
5
  SHA512:
6
- metadata.gz: 2f20f758fbbfd769b8ed45e8b808e0b6b621a2bfef67eca6d6063cd9749c5e05ea22e870d0dae4d04d1e06dc95e29413f1231c22b201c5ccd42fe0cb6ba678c5
7
- data.tar.gz: 8551b6d715330eb214bf6d58135007656cc34f9057b0e8497ba139d07d84e568594a5cc886d9beaf4352694ea1ce92c8757adac79013c387426abb13837f1abd
6
+ metadata.gz: 6caff8c35f558fb0394b45cea65f04094ffc546b69844f2a7d8ce1fa946a1e961ece15e5569ae170a82e33b57dd007ea313e0f3d6c966251ef18d4dcefe8d94b
7
+ data.tar.gz: e3f580a640f314257ecd3a0c8d387dbb4e2136c7845b17dbaa99e79ab3b3bda00eb4291c77dcb3e9089bdb3bafdd8396a501b64c5b1faab291eb0f703bc1aa46
data/.gitignore CHANGED
@@ -14,3 +14,11 @@
14
14
  Gemfile.lock
15
15
  .DS_Store
16
16
  /old-docs
17
+
18
+ # Editor / sed transient files
19
+ *.bak
20
+ *.swp
21
+ *~
22
+
23
+ # Local TODO scratchpads (track work in issues/PRs instead)
24
+ TODO*
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-05-20 14:51:37 UTC using RuboCop version 1.86.1.
3
+ # on 2026-07-02 17:45:26 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -11,13 +11,96 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'xmi.gemspec'
13
13
 
14
- # Offense count: 79
14
+ # Offense count: 11
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
17
+ # SupportedStyles: with_first_argument, with_fixed_indentation
18
+ Layout/ArgumentAlignment:
19
+ Exclude:
20
+ - 'lib/xmi/uml.rb'
21
+ - 'spec/xmi/uml/autoload_spec.rb'
22
+ - 'spec/xmi/uml/literal_classes_spec.rb'
23
+ - 'spec/xmi/uml/owned_end_spec.rb'
24
+
25
+ # Offense count: 3
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: EnforcedStyleAlignWith.
28
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
29
+ Layout/BlockAlignment:
30
+ Exclude:
31
+ - 'spec/xmi/uml/instance_specification_spec.rb'
32
+ - 'spec/xmi/uml/slot_spec.rb'
33
+
34
+ # Offense count: 3
35
+ # This cop supports safe autocorrection (--autocorrect).
36
+ Layout/BlockEndNewline:
37
+ Exclude:
38
+ - 'spec/xmi/uml/instance_specification_spec.rb'
39
+ - 'spec/xmi/uml/slot_spec.rb'
40
+
41
+ # Offense count: 1
42
+ # This cop supports safe autocorrection (--autocorrect).
43
+ Layout/ClosingParenthesisIndentation:
44
+ Exclude:
45
+ - 'spec/xmi/uml/slot_spec.rb'
46
+
47
+ # Offense count: 1
48
+ # This cop supports safe autocorrection (--autocorrect).
49
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
50
+ # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
51
+ Layout/FirstArgumentIndentation:
52
+ Exclude:
53
+ - 'spec/xmi/uml/slot_spec.rb'
54
+
55
+ # Offense count: 12
56
+ # This cop supports safe autocorrection (--autocorrect).
57
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
58
+ # SupportedHashRocketStyles: key, separator, table
59
+ # SupportedColonStyles: key, separator, table
60
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
61
+ Layout/HashAlignment:
62
+ Exclude:
63
+ - 'lib/xmi.rb'
64
+ - 'lib/xmi/uml/packaged_element.rb'
65
+ - 'lib/xmi/uml/uml_model.rb'
66
+ - 'spec/xmi/uml/literal_classes_spec.rb'
67
+
68
+ # Offense count: 6
69
+ # This cop supports safe autocorrection (--autocorrect).
70
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
71
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
72
+ Layout/IndentationWidth:
73
+ Exclude:
74
+ - 'spec/xmi/uml/instance_specification_spec.rb'
75
+ - 'spec/xmi/uml/slot_spec.rb'
76
+
77
+ # Offense count: 131
15
78
  # This cop supports safe autocorrection (--autocorrect).
16
79
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
80
  # URISchemes: http, https
18
81
  Layout/LineLength:
19
82
  Enabled: false
20
83
 
84
+ # Offense count: 1
85
+ # This cop supports safe autocorrection (--autocorrect).
86
+ # Configuration parameters: EnforcedStyle.
87
+ # SupportedStyles: symmetrical, new_line, same_line
88
+ Layout/MultilineMethodCallBraceLayout:
89
+ Exclude:
90
+ - 'spec/xmi/uml/slot_spec.rb'
91
+
92
+ # Offense count: 10
93
+ # This cop supports safe autocorrection (--autocorrect).
94
+ # Configuration parameters: AllowInHeredoc.
95
+ Layout/TrailingWhitespace:
96
+ Exclude:
97
+ - 'lib/xmi/uml.rb'
98
+ - 'lib/xmi/uml/packaged_element.rb'
99
+ - 'lib/xmi/uml/uml_model.rb'
100
+ - 'spec/xmi/uml/autoload_spec.rb'
101
+ - 'spec/xmi/uml/literal_classes_spec.rb'
102
+ - 'spec/xmi/uml/owned_end_spec.rb'
103
+
21
104
  # Offense count: 6
22
105
  # Configuration parameters: AllowedMethods.
23
106
  # AllowedMethods: enums
@@ -52,7 +135,7 @@ Metrics/CyclomaticComplexity:
52
135
  - 'lib/xmi/ea_root/code_generation.rb'
53
136
  - 'lib/xmi/sparx/index.rb'
54
137
 
55
- # Offense count: 30
138
+ # Offense count: 29
56
139
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
57
140
  Metrics/MethodLength:
58
141
  Max: 55
@@ -95,17 +178,17 @@ RSpec/ContextWording:
95
178
  - 'spec/xmi/sparx/sparx_root_gml_spec.rb'
96
179
  - 'spec/xmi/sparx/sparx_root_mdg_spec.rb'
97
180
 
98
- # Offense count: 4
181
+ # Offense count: 5
99
182
  # Configuration parameters: IgnoredMetadata.
100
183
  RSpec/DescribeClass:
101
184
  Exclude:
102
185
  - 'spec/performance/xmi_parsing_spec.rb'
103
186
  - 'spec/xmi/edge_cases_spec.rb'
104
187
  - 'spec/xmi/namespace_aliases_spec.rb'
105
- - 'spec/xmi/versioning_spec.rb'
106
188
  - 'spec/xmi/sparx/mixed_prefix_style_spec.rb'
189
+ - 'spec/xmi/versioning_spec.rb'
107
190
 
108
- # Offense count: 37
191
+ # Offense count: 52
109
192
  # Configuration parameters: CountAsOne.
110
193
  RSpec/ExampleLength:
111
194
  Max: 33
@@ -120,7 +203,7 @@ RSpec/MultipleDescribes:
120
203
  Exclude:
121
204
  - 'spec/xmi/sparx/gml/shared_attributes_spec.rb'
122
205
 
123
- # Offense count: 57
206
+ # Offense count: 120
124
207
  RSpec/MultipleExpectations:
125
208
  Max: 8
126
209
 
@@ -148,6 +231,18 @@ RSpec/SpecFilePathFormat:
148
231
  - 'spec/xmi/sparx/sparx_root_xmi2013_uml2013_spec.rb'
149
232
  - 'spec/xmi/sparx/sparx_root_xmi_parsing_spec.rb'
150
233
 
234
+ # Offense count: 5
235
+ # This cop supports safe autocorrection (--autocorrect).
236
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
237
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
238
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
239
+ # FunctionalMethods: let, let!, subject, watch
240
+ # AllowedMethods: lambda, proc, it
241
+ Style/BlockDelimiters:
242
+ Exclude:
243
+ - 'spec/xmi/uml/instance_specification_spec.rb'
244
+ - 'spec/xmi/uml/slot_spec.rb'
245
+
151
246
  # Offense count: 4
152
247
  # Configuration parameters: AllowedClasses.
153
248
  Style/OneClassPerFile:
data/CLAUDE.md CHANGED
@@ -102,24 +102,39 @@ end
102
102
 
103
103
  ### Model Definition Pattern
104
104
 
105
- Models use lutaml-model syntax with explicit namespace declarations:
106
- ```ruby
107
- class MyModel < Lutaml::Model::Serializable
108
- attribute :id, ::Xmi::Type::XmiId
105
+ Concrete UML classes inherit from `Xmi::Uml::Base`, which carries
106
+ the shared boilerplate (`skip_reference_registration`, `type` and
107
+ `id` attrs, UML namespace, and their `map_attribute` lines).
108
+ Subclasses declare only their unique attributes and the `root`
109
+ element name. Verified via spike: lutaml-model inherits `xml do`
110
+ block contents (namespace + map_attribute) from the parent class.
109
111
 
110
- xml do
111
- root "Model"
112
- namespace ::Xmi::Namespace::Omg::Uml
113
- namespace_scope [::Xmi::Namespace::Omg::Xmi, ::Xmi::Namespace::Omg::Uml]
114
-
115
- # Attributes with XMI namespace require explicit declaration
116
- map_attribute "id", to: :id,
117
- namespace: "http://www.omg.org/spec/XMI/20131001",
118
- prefix: "xmi"
112
+ UML Diagram Interchange elements (Bounds, Waypoint, Diagram,
113
+ OwnedElement) inherit from `Xmi::UmlDi::Base` instead — same
114
+ pattern, different namespace.
115
+
116
+ ```ruby
117
+ # lib/xmi/uml/my_element.rb
118
+ module Xmi
119
+ module Uml
120
+ class MyElement < Base
121
+ attribute :name, :string
122
+
123
+ xml do
124
+ root "myElement"
125
+ map_attribute "name", to: :name
126
+ end
127
+ end
119
128
  end
120
129
  end
121
130
  ```
122
131
 
132
+ For backward compatibility, raw `Lutaml::Model::Serializable`
133
+ inheritance still works but is discouraged for new UML classes.
134
+ The small reference-holder classes (AnnotatedElement, MemberEnd,
135
+ Type, ImportedPackage) intentionally stay direct from Serializable
136
+ because they don't carry the type+id pair that Base provides.
137
+
123
138
  ### Dynamic Extension Loading
124
139
 
125
140
  `Xmi::EaRoot.load_extension(xml_path)` dynamically generates Ruby classes from EA MDG extension XML files. This creates stereotype classes under `Xmi::EaRoot::{ModuleName}::{ClassName}` and updates `Root` mappings.
@@ -128,6 +143,15 @@ Extensions use `NamespaceRegistry` to look up or create namespace classes dynami
128
143
  - Existing namespace URIs resolve to predefined classes
129
144
  - New URIs create dynamic classes under `Xmi::Namespace::Dynamic::{ModuleName}`
130
145
 
146
+ ### Polymorphic Dispatch
147
+
148
+ Two attributes use lutaml-model's polymorphic dispatch on `xmi:type`:
149
+
150
+ - `PackagedElement.packaged_element` (and `UmlModel.packaged_element`) — dispatches to typed subclasses (`UmlClass`, `Association`, `Interface`, `InstanceSpecification`, etc.). Map: `Xmi::Uml::PACKAGED_ELEMENT_POLYMORPHIC_MAP` in `lib/xmi/uml/packaged_element.rb`.
151
+ - `Slot.value`, `OwnedAttribute.upper_value`/`lower_value`/`default_value`, `OwnedEnd.upper_value`/`lower_value`/`default_value`, `OwnedParameter.upper_value`/`lower_value`/`default_value` — dispatch to ValueSpecification subclasses (`OpaqueExpression`, `LiteralString`, `LiteralInteger`, etc.). Map: `Xmi::Uml::VALUE_SPECIFICATION_POLYMORPHIC_MAP` in `lib/xmi/uml/value_specification.rb`.
152
+
153
+ **Known limitation:** polymorphic dispatch crashes with `TypeError` if the discriminator is missing or unrecognized. This is a lutaml-model upstream issue (it calls `Object.const_get(nil)`); the failure mode is locked in by `spec/xmi/uml/polymorphic_robustness_spec.rb`. Fix lives upstream, not here.
154
+
131
155
  ### Key Files
132
156
 
133
157
  | File | Purpose |
@@ -136,7 +160,12 @@ Extensions use `NamespaceRegistry` to look up or create namespace classes dynami
136
160
  | `lib/xmi/sparx.rb` | Module with autoload declarations for Sparx components |
137
161
  | `lib/xmi/sparx/root.rb` | Main `Root` class with parsing and namespace normalization |
138
162
  | `lib/xmi/root.rb` | Base `Root` class with common XMI attributes |
139
- | `lib/xmi/uml.rb` | UML model classes (UmlModel, PackagedElement, etc.) |
163
+ | `lib/xmi/uml.rb` | UML model autoload entries |
164
+ | `lib/xmi/uml/base.rb` | `Xmi::Uml::Base` — common boilerplate for UML classes |
165
+ | `lib/xmi/uml_di.rb` | UML Diagram Interchange autoload entries |
166
+ | `lib/xmi/uml_di/base.rb` | `Xmi::UmlDi::Base` — common boilerplate for UMLDI classes |
167
+ | `lib/xmi/uml/packaged_element.rb` | `PackagedElement` + `PACKAGED_ELEMENT_POLYMORPHIC_MAP` |
168
+ | `lib/xmi/uml/value_specification.rb` | `ValueSpecification` abstract base + `VALUE_SPECIFICATION_POLYMORPHIC_MAP` |
140
169
  | `lib/xmi/ea_root.rb` | Dynamic extension loading from MDG XML |
141
170
  | `lib/xmi/type.rb` | Custom types with namespace declarations (XmiId, XmiType, etc.) |
142
171
  | `lib/xmi/namespace/omg.rb` | OMG namespace classes (XMI, UML, UmlDi, UmlDc) |
data/lib/xmi/add.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "difference"
4
- require_relative "extension"
5
-
6
3
  module Xmi
7
4
  class Add < Lutaml::Model::Serializable
8
5
  skip_reference_registration
data/lib/xmi/delete.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "difference"
4
- require_relative "extension"
5
-
6
3
  module Xmi
7
4
  class Delete < Lutaml::Model::Serializable
8
5
  skip_reference_registration
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "extension"
4
-
5
3
  module Xmi
6
4
  class Difference < Lutaml::Model::Serializable
7
5
  skip_reference_registration
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "extension"
4
-
5
3
  module Xmi
6
4
  class Documentation < Lutaml::Model::Serializable
7
5
  skip_reference_registration
data/lib/xmi/ea_root.rb CHANGED
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "nokogiri"
4
- require_relative "ea_root/xml_parsing"
5
- require_relative "ea_root/code_generation"
6
- require_relative "ea_root/extension_lifecycle"
7
- require_relative "ea_root/namespace_handling"
8
4
 
9
5
  module Xmi
10
6
  class EaRoot
7
+ autoload :XmlParsing, "xmi/ea_root/xml_parsing"
8
+ autoload :CodeGeneration, "xmi/ea_root/code_generation"
9
+ autoload :ExtensionLifecycle, "xmi/ea_root/extension_lifecycle"
10
+ autoload :NamespaceHandling, "xmi/ea_root/namespace_handling"
11
+
11
12
  extend XmlParsing
12
13
  extend CodeGeneration
13
14
  extend ExtensionLifecycle
data/lib/xmi/namespace.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Xmi
4
4
  module Namespace
5
+ autoload :Omg, "xmi/namespace/omg"
6
+ autoload :Sparx, "xmi/namespace/sparx"
7
+ autoload :Dynamic, "xmi/namespace/dynamic"
5
8
  end
6
9
  end
7
-
8
- require_relative "namespace/omg"
9
- require_relative "namespace/sparx"
data/lib/xmi/replace.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "difference"
4
- require_relative "extension"
5
-
6
3
  module Xmi
7
4
  class Replace < Lutaml::Model::Serializable
8
5
  skip_reference_registration
data/lib/xmi/root.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "documentation"
4
- require_relative "uml"
5
-
6
3
  module Xmi
7
4
  class Root < Lutaml::Model::Serializable
8
5
  skip_reference_registration
data/lib/xmi/type.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "namespace"
4
-
5
3
  module Xmi
6
4
  module Type
7
5
  class XmiIdRef < Lutaml::Model::Type::String
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:Association">`. Binary
6
+ # link between two types, carrying ownedEnd / memberEnd children.
7
+ class Association < PackagedElement
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:AssociationClass">`. An
6
+ # association that is also a class (UML 2.5 §11.4).
7
+ #
8
+ # Phase A of TODO.next/01: subclass is a type tag on
9
+ # PackagedElement. The union-bag attribute set is inherited
10
+ # unchanged so existing consumers keep working. Phase B
11
+ # (narrowing attrs to the subclass) is future work.
12
+ class AssociationClass < PackagedElement
13
+ end
14
+ end
15
+ end
@@ -2,18 +2,11 @@
2
2
 
3
3
  module Xmi
4
4
  module Uml
5
- class AssociationGeneralization < Lutaml::Model::Serializable
6
- skip_reference_registration
7
- attribute :type, ::Xmi::Type::XmiType
8
- attribute :id, ::Xmi::Type::XmiId
5
+ class AssociationGeneralization < Base
9
6
  attribute :general, :string
10
7
 
11
8
  xml do
12
9
  root "generalization"
13
- namespace ::Xmi::Namespace::Omg::Uml
14
-
15
- map_attribute "type", to: :type
16
- map_attribute "id", to: :id
17
10
  map_attribute "general", to: :general
18
11
  end
19
12
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # Common base for concrete UML element classes.
6
+ #
7
+ # Each concrete UML class redeclares the same `xmi:type` discriminator,
8
+ # `xmi:id`, and UML namespace boilerplate. Inheriting from `Base`
9
+ # removes that duplication — subclasses declare only their unique
10
+ # attributes and `root` element name.
11
+ #
12
+ # Verified via spike: lutaml-model inherits attribute declarations,
13
+ # namespace, and map_attribute lines from the parent's `xml do` block.
14
+ # Subclasses override `root` and add their own attributes/mappings.
15
+ #
16
+ # Classes that don't fit this pattern (reference holders like
17
+ # AnnotatedElement/MemberEnd/Type, or UmlDi-namespaced elements like
18
+ # Bounds/Waypoint/Diagram) stay direct from Serializable.
19
+ class Base < Lutaml::Model::Serializable
20
+ skip_reference_registration
21
+ attribute :type, ::Xmi::Type::XmiType
22
+ attribute :id, ::Xmi::Type::XmiId
23
+
24
+ xml do
25
+ namespace ::Xmi::Namespace::Omg::Uml
26
+
27
+ map_attribute "type", to: :type
28
+ map_attribute "id", to: :id
29
+ end
30
+ end
31
+ end
32
+ end
@@ -2,10 +2,8 @@
2
2
 
3
3
  module Xmi
4
4
  module Uml
5
- class Bounds < Lutaml::Model::Serializable
6
- skip_reference_registration
7
- attribute :type, ::Xmi::Type::XmiType
8
- attribute :id, ::Xmi::Type::XmiId
5
+ # UMLDI `<bounds>` element — a rectangle in diagram coordinates.
6
+ class Bounds < ::Xmi::UmlDi::Base
9
7
  attribute :x, :integer
10
8
  attribute :y, :integer
11
9
  attribute :height, :integer
@@ -13,32 +11,11 @@ module Xmi
13
11
 
14
12
  xml do
15
13
  root "bounds"
16
- namespace ::Xmi::Namespace::Omg::UmlDi
17
-
18
- map_attribute "type", to: :type
19
- map_attribute "id", to: :id
20
14
  map_attribute "x", to: :x
21
15
  map_attribute "y", to: :y
22
16
  map_attribute "height", to: :height
23
17
  map_attribute "width", to: :width
24
18
  end
25
19
  end
26
-
27
- class Waypoint < Lutaml::Model::Serializable
28
- attribute :type, ::Xmi::Type::XmiType
29
- attribute :id, ::Xmi::Type::XmiId
30
- attribute :x, :integer
31
- attribute :y, :integer
32
-
33
- xml do
34
- root "waypoint"
35
- namespace ::Xmi::Namespace::Omg::UmlDi
36
-
37
- map_attribute "type", to: :type
38
- map_attribute "id", to: :id
39
- map_attribute "x", to: :x
40
- map_attribute "y", to: :y
41
- end
42
- end
43
20
  end
44
21
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:DataType">`. Classifier
6
+ # for type definitions (e.g. record shapes).
7
+ class DataType < PackagedElement
8
+ end
9
+ end
10
+ end
@@ -2,44 +2,15 @@
2
2
 
3
3
  module Xmi
4
4
  module Uml
5
- class DefaultValue < Lutaml::Model::Serializable
6
- skip_reference_registration
7
- attribute :type, ::Xmi::Type::XmiType
8
- attribute :id, ::Xmi::Type::XmiId
5
+ # Default value wrapper. Semantically a ValueSpecification
6
+ # (UML 2.5 §9.8) — kept as a concrete subclass for backwards
7
+ # compatibility with code that constructs DefaultValue directly
8
+ # (e.g. the lutaml/ea transformer).
9
+ class DefaultValue < ValueSpecification
9
10
  attribute :value, :string
10
11
 
11
12
  xml do
12
13
  root "defaultValue"
13
- namespace ::Xmi::Namespace::Omg::Uml
14
-
15
- map_attribute "type", to: :type
16
- map_attribute "id", to: :id
17
- map_attribute "value", to: :value
18
- end
19
- end
20
-
21
- class UpperValue < DefaultValue
22
- skip_reference_registration
23
-
24
- xml do
25
- root "upperValue"
26
- namespace ::Xmi::Namespace::Omg::Uml
27
-
28
- map_attribute "type", to: :type
29
- map_attribute "id", to: :id
30
- map_attribute "value", to: :value
31
- end
32
- end
33
-
34
- class LowerValue < DefaultValue
35
- skip_reference_registration
36
-
37
- xml do
38
- root "lowerValue"
39
- namespace ::Xmi::Namespace::Omg::Uml
40
-
41
- map_attribute "type", to: :type
42
- map_attribute "id", to: :id
43
14
  map_attribute "value", to: :value
44
15
  end
45
16
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:Dependency">`. A relationship
6
+ # between a client and supplier packageable element.
7
+ #
8
+ # Phase A of TODO.next/01: subclass is a type tag on
9
+ # PackagedElement. The union-bag attribute set is inherited
10
+ # unchanged so existing consumers keep working. Phase B
11
+ # (narrowing attrs to the subclass) is future work.
12
+ class Dependency < PackagedElement
13
+ end
14
+ end
15
+ end
@@ -2,20 +2,14 @@
2
2
 
3
3
  module Xmi
4
4
  module Uml
5
- class Diagram < Lutaml::Model::Serializable
6
- skip_reference_registration
7
- attribute :type, ::Xmi::Type::XmiType
8
- attribute :id, ::Xmi::Type::XmiId
5
+ # UMLDI `<Diagram>` element — root of a diagram's interchange view.
6
+ class Diagram < ::Xmi::UmlDi::Base
9
7
  attribute :is_frame, :boolean
10
8
  attribute :model_element, :string
11
9
  attribute :owned_element, OwnedElement, collection: true
12
10
 
13
11
  xml do
14
12
  root "Diagram"
15
- namespace ::Xmi::Namespace::Omg::UmlDi
16
-
17
- map_attribute "type", to: :type
18
- map_attribute "id", to: :id
19
13
  map_attribute "isFrame", to: :is_frame
20
14
  map_attribute "modelElement", to: :model_element
21
15
 
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:Enumeration">`. Named
6
+ # set of enumeration literals.
7
+ class Enumeration < PackagedElement
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:Extension">`. An extension
6
+ # associates a stereotype with a metaclass to make the stereotype
7
+ # applicable to instances of that metaclass (UML 2.5 §22.3).
8
+ #
9
+ # Phase A of TODO.next/01: subclass is a type tag on
10
+ # PackagedElement. The union-bag attribute set is inherited
11
+ # unchanged so existing consumers keep working. Phase B
12
+ # (narrowing attrs to the subclass) is future work.
13
+ class Extension < PackagedElement
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ class ImportedPackage < Lutaml::Model::Serializable
6
+ skip_reference_registration
7
+ attribute :href, :string
8
+
9
+ xml do
10
+ root "importedPackage"
11
+ namespace ::Xmi::Namespace::Omg::Uml
12
+
13
+ map_attribute "href", to: :href
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<packagedElement xmi:type="uml:InstanceSpecification">`.
6
+ # A named instance of a classifier, carrying slot children that
7
+ # hold the instance's values for each defining feature.
8
+ class InstanceSpecification < PackagedElement
9
+ end
10
+ end
11
+ end