xmi 0.5.11 → 0.5.12

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +102 -7
  3. data/TODO.next/01-packaged-element-typed-subclasses.md +94 -0
  4. data/TODO.next/03-real-sparx-instancespec-fixture.md +56 -0
  5. data/TODO.next/README.md +17 -0
  6. data/lib/xmi/uml/association.rb +12 -0
  7. data/lib/xmi/uml/association_class.rb +17 -0
  8. data/lib/xmi/uml/association_generalization.rb +1 -8
  9. data/lib/xmi/uml/base.rb +32 -0
  10. data/lib/xmi/uml/bounds.rb +0 -17
  11. data/lib/xmi/uml/data_type.rb +12 -0
  12. data/lib/xmi/uml/default_value.rb +7 -34
  13. data/lib/xmi/uml/dependency.rb +17 -0
  14. data/lib/xmi/uml/enumeration.rb +12 -0
  15. data/lib/xmi/uml/extension.rb +18 -0
  16. data/lib/xmi/uml/imported_package.rb +17 -0
  17. data/lib/xmi/uml/instance_specification.rb +13 -0
  18. data/lib/xmi/uml/interface.rb +12 -0
  19. data/lib/xmi/uml/interface_realization.rb +26 -0
  20. data/lib/xmi/uml/literal_boolean.rb +15 -0
  21. data/lib/xmi/uml/literal_integer.rb +15 -0
  22. data/lib/xmi/uml/literal_null.rb +14 -0
  23. data/lib/xmi/uml/literal_string.rb +15 -0
  24. data/lib/xmi/uml/literal_unlimited_natural.rb +16 -0
  25. data/lib/xmi/uml/lower_value.rb +13 -0
  26. data/lib/xmi/uml/opaque_expression.rb +31 -0
  27. data/lib/xmi/uml/owned_attribute.rb +28 -13
  28. data/lib/xmi/uml/owned_comment.rb +1 -8
  29. data/lib/xmi/uml/owned_end.rb +15 -12
  30. data/lib/xmi/uml/owned_literal.rb +1 -9
  31. data/lib/xmi/uml/owned_operation.rb +11 -4
  32. data/lib/xmi/uml/owned_parameter.rb +18 -12
  33. data/lib/xmi/uml/package.rb +12 -0
  34. data/lib/xmi/uml/package_import.rb +2 -12
  35. data/lib/xmi/uml/packaged_element.rb +50 -10
  36. data/lib/xmi/uml/precondition.rb +1 -8
  37. data/lib/xmi/uml/primitive_type.rb +12 -0
  38. data/lib/xmi/uml/profile.rb +2 -17
  39. data/lib/xmi/uml/profile_application.rb +2 -14
  40. data/lib/xmi/uml/profile_application_applied_profile.rb +21 -0
  41. data/lib/xmi/uml/profile_attributes.rb +20 -0
  42. data/lib/xmi/uml/realization.rb +14 -0
  43. data/lib/xmi/uml/signal.rb +18 -0
  44. data/lib/xmi/uml/slot.rb +18 -0
  45. data/lib/xmi/uml/specification.rb +3 -8
  46. data/lib/xmi/uml/stereotype.rb +18 -0
  47. data/lib/xmi/uml/uml_class.rb +17 -0
  48. data/lib/xmi/uml/uml_model.rb +6 -10
  49. data/lib/xmi/uml/upper_value.rb +13 -0
  50. data/lib/xmi/uml/usage.rb +18 -0
  51. data/lib/xmi/uml/value_specification.rb +46 -0
  52. data/lib/xmi/uml/waypoint.rb +23 -0
  53. data/lib/xmi/uml.rb +32 -6
  54. data/lib/xmi/version.rb +1 -1
  55. data/lib/xmi.rb +17 -3
  56. metadata +36 -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: 4268a73b32cabe65fa9a63dc4e87588941df98e4480697e704e19d33be0d4d2f
4
+ data.tar.gz: b92789685eee2191f08b81537f1a4c6740ae5bdba96a48060992174ee7a2b58a
5
5
  SHA512:
6
- metadata.gz: 2f20f758fbbfd769b8ed45e8b808e0b6b621a2bfef67eca6d6063cd9749c5e05ea22e870d0dae4d04d1e06dc95e29413f1231c22b201c5ccd42fe0cb6ba678c5
7
- data.tar.gz: 8551b6d715330eb214bf6d58135007656cc34f9057b0e8497ba139d07d84e568594a5cc886d9beaf4352694ea1ce92c8757adac79013c387426abb13837f1abd
6
+ metadata.gz: abcee32a264c8519d7e7a5110cc89e6327e20dce2ded8999266aa928c67e59daf0f993f3b8577d6c628137345b10367e9fbb23b8d832c1d49bafbbeda83ec43d
7
+ data.tar.gz: 2d46d5677820d183a9d33418ead0ff9cf4ffe8d887aa16e629c27d782e282baa4a94ca08d8bc1cb531728e781d4613e09f371e7454b3fc94bb306271807ddadf
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:
@@ -0,0 +1,94 @@
1
+ # 01 — PackagedElement typed subclasses (Phase B remaining)
2
+
3
+ **Status: PARTIAL — Phase A landed (2026-07-03); Phase B (narrowing
4
+ attrs to subclasses) deferred.**
5
+
6
+ ## What landed (Phase A)
7
+
8
+ Polymorphic dispatch on `PackagedElement.packaged_element` and
9
+ `UmlModel.packaged_element`. Each `<packagedElement xmi:type="uml:X">`
10
+ now parses to a corresponding `Xmi::Uml::X` subclass:
11
+
12
+ | xmi:type | Ruby class |
13
+ |---|---|
14
+ | uml:Class | `Xmi::Uml::UmlClass` |
15
+ | uml:Association | `Xmi::Uml::Association` |
16
+ | uml:Interface | `Xmi::Uml::Interface` |
17
+ | uml:InstanceSpecification | `Xmi::Uml::InstanceSpecification` |
18
+ | uml:DataType | `Xmi::Uml::DataType` |
19
+ | uml:PrimitiveType | `Xmi::Uml::PrimitiveType` |
20
+ | uml:Enumeration | `Xmi::Uml::Enumeration` |
21
+ | uml:Package | `Xmi::Uml::Package` |
22
+ | uml:Realization | `Xmi::Uml::Realization` |
23
+
24
+ Dispatch map: `Xmi::Uml::PACKAGED_ELEMENT_POLYMORPHIC_MAP` in
25
+ `lib/xmi/uml/packaged_element.rb`. Spec coverage:
26
+ `spec/xmi/uml/packaged_element_dispatch_spec.rb` (17 examples).
27
+
28
+ Subclasses currently inherit the **full union-bag attribute set**
29
+ from `PackagedElement`. Consumers can dispatch on `is_a?(Xmi::Uml::X)`
30
+ for type-specific behavior, but accessing the wrong attr on the wrong
31
+ type still returns nil/empty rather than raising.
32
+
33
+ ## What's deferred (Phase B)
34
+
35
+ Narrow each subclass's attribute set to its UML-2.5-conformant subset.
36
+ Examples:
37
+
38
+ | Class | Valid attrs (today, all inherited) |
39
+ |---|---|
40
+ | UmlClass | owned_attribute, owned_operation, owned_comment, generalization, interface_realization, nested packaged_element |
41
+ | Association | owned_end, member_end, member_ends |
42
+ | InstanceSpecification | classifier, slot, specification |
43
+ | Interface | owned_operation, generalization |
44
+ | Enumeration | owned_literal |
45
+ | DataType | owned_attribute, owned_operation |
46
+ | PrimitiveType | (none) |
47
+ | Realization | supplier, client |
48
+ | Package | nested packaged_element |
49
+
50
+ After Phase B, `instance.owned_attribute` raises NoMethodError on an
51
+ InstanceSpecification — the type system catches the misuse at runtime.
52
+
53
+ ## Why Phase B is deferred
54
+
55
+ - **Breaking change.** Every consumer that accesses attrs via the
56
+ base `PackagedElement` type breaks. The `lutaml/ea` transformer
57
+ walks packaged_element generically; it would need type-specific
58
+ dispatch added.
59
+ - **Test churn.** Every Sparx fixture regression test that accesses
60
+ `pe.owned_attribute` (etc.) on a generic PackagedElement needs
61
+ updating.
62
+ - **Limited semantic gain.** Phase A already gives consumers the
63
+ type tag. Phase B catches programming errors but doesn't enable
64
+ new functionality.
65
+ - The original TODO.next/01 design doc proposed Phase A as
66
+ "risk-free" and Phase B as the "breaking change." That framing
67
+ holds.
68
+
69
+ ## Rollout strategy for Phase B
70
+
71
+ 1. Survey every consumer of `PackagedElement` attrs in `lutaml/ea`,
72
+ `lutaml/lutaml-uml`, and downstream.
73
+ 2. For each consumer, change to type-specific dispatch:
74
+ ```ruby
75
+ case pe
76
+ when Xmi::Uml::UmlClass then pe.owned_attribute ...
77
+ when Xmi::Uml::Association then pe.owned_end ...
78
+ end
79
+ ```
80
+ 3. Once consumers are type-aware, narrow subclass attrs.
81
+ 4. Remove the narrowed attrs from `PackagedElement`.
82
+
83
+ This is a multi-PR change. Each step should land separately so
84
+ bisect works.
85
+
86
+ ## Open questions
87
+
88
+ - Should `Generalization` move from `packagedElement` to its own
89
+ child element shape to match OMG XMI? Sparx uses both. Defer.
90
+ - How to handle EA's `uml:ExtensionEnd` and other Sparx-isms? Treat
91
+ as subclasses of the closest OMG type.
92
+ - The polymorphic dispatch failure mode (unknown xmi:type raises
93
+ TypeError) is locked in by `polymorphic_robustness_spec.rb`. Phase B
94
+ doesn't fix this; it's a separate concern.
@@ -0,0 +1,56 @@
1
+ # 03 — Real Sparx InstanceSpecification fixture (FUTURE)
2
+
3
+ **Status: FUTURE — requires Sparx EA access to acquire the fixture.
4
+ Migrated from `TODO.refactor/16` (2026-07-02).**
5
+
6
+ ## Problem
7
+
8
+ The fixture added in TODO.refactor/08
9
+ (`spec/fixtures/sparx-instance-specification.xmi`) is hand-authored
10
+ to match Sparx EA's mixed-prefix style. It is structurally faithful
11
+ but not byte-identical to real EA output.
12
+
13
+ Several details can drift between synthetic and real:
14
+
15
+ - Whitespace and indentation (tabs vs spaces, blank lines).
16
+ - Attribute ordering within an element.
17
+ - Presence of EA-specific boilerplate (`xmi:Documentation exporter="Enterprise Architect" exporterVersion="..."`).
18
+ - Sparx's `EAID_` GUID format (uppercase hex with underscores, vs.
19
+ the synthetic lowercase).
20
+ - Inclusion of `<xrefs>` elements on slot values (Sparx adds
21
+ cross-references for tracked links).
22
+ - The `<extensions>` element with EA-specific `<elements>` and
23
+ `<connectors>` sections.
24
+
25
+ ## Goal
26
+
27
+ Acquire a real Sparx EA export that contains at least one:
28
+
29
+ - `<packagedElement xmi:type="uml:InstanceSpecification">` with
30
+ `<slot>` children carrying `<value>` of various `xmi:type`.
31
+ - `<interfaceRealization>` (strict OMG form, even though current
32
+ Sparx collapses to `uml:Realization`).
33
+
34
+ Replace `sparx-instance-specification.xmi` with the real fixture,
35
+ or add it as a sibling file. Update parity specs to use the real
36
+ fixture.
37
+
38
+ ## Acquisition
39
+
40
+ Requires Sparx EA access. Suggested steps:
41
+
42
+ 1. In EA, create a small model with one Class, one
43
+ InstanceSpecification, and one InterfaceRealization.
44
+ 2. Publish to XMI (EA's "Publish to File" or "Export to XMI").
45
+ 3. Trim sensitive content if any.
46
+ 4. Commit the fixture with a `<!-- Exported from Sparx EA vX.Y on
47
+ YYYY-MM-DD, trimmed for the lutaml/xmi test suite. -->` header.
48
+
49
+ ## Verification
50
+
51
+ - Real fixture parses without error.
52
+ - All existing parity specs continue to pass (or are updated to
53
+ match real content).
54
+ - Coverage of `<value>` `xmi:type` variants matches what real EA
55
+ emits (OpaqueExpression is the common case; LiteralString for
56
+ default values).
@@ -0,0 +1,17 @@
1
+ # TODO.next — xmi gem follow-ups
2
+
3
+ Open design items after the OwnedEnd schema migration and
4
+ ValueSpecification polymorphic dispatch landed. Each file has a
5
+ Status header:
6
+
7
+ - **DONE** — completed; kept for context
8
+ - **DESIGN-ONLY** — design document, not implemented; awaiting user direction
9
+ - **FUTURE** — needs resources (real Sparx EA access, etc.) to unblock
10
+ - **PARTIAL** — some paths landed, others deferred; see file for breakdown
11
+
12
+ ## Index
13
+
14
+ | # | Title | Status |
15
+ |---|---|---|
16
+ | 01 | [PackagedElement typed subclasses](01-packaged-element-typed-subclasses.md) | PARTIAL (Phase A done, Phase B deferred) |
17
+ | 03 | [Real Sparx InstanceSpecification fixture](03-real-sparx-instancespec-fixture.md) | FUTURE |
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:Association">`. Binary
8
+ # link between two types, carrying ownedEnd / memberEnd children.
9
+ class Association < PackagedElement
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:AssociationClass">`. An
8
+ # association that is also a class (UML 2.5 §11.4).
9
+ #
10
+ # Phase A of TODO.next/01: subclass is a type tag on
11
+ # PackagedElement. The union-bag attribute set is inherited
12
+ # unchanged so existing consumers keep working. Phase B
13
+ # (narrowing attrs to the subclass) is future work.
14
+ class AssociationClass < PackagedElement
15
+ end
16
+ end
17
+ 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
@@ -23,22 +23,5 @@ module Xmi
23
23
  map_attribute "width", to: :width
24
24
  end
25
25
  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
26
  end
44
27
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:DataType">`. Classifier
8
+ # for type definitions (e.g. record shapes).
9
+ class DataType < PackagedElement
10
+ end
11
+ end
12
+ end
@@ -1,45 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "value_specification"
4
+
3
5
  module Xmi
4
6
  module Uml
5
- class DefaultValue < Lutaml::Model::Serializable
6
- skip_reference_registration
7
- attribute :type, ::Xmi::Type::XmiType
8
- attribute :id, ::Xmi::Type::XmiId
7
+ # Default value wrapper. Semantically a ValueSpecification
8
+ # (UML 2.5 §9.8) — kept as a concrete subclass for backwards
9
+ # compatibility with code that constructs DefaultValue directly
10
+ # (e.g. the lutaml/ea transformer).
11
+ class DefaultValue < ValueSpecification
9
12
  attribute :value, :string
10
13
 
11
14
  xml do
12
15
  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
16
  map_attribute "value", to: :value
44
17
  end
45
18
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:Dependency">`. A relationship
8
+ # between a client and supplier packageable element.
9
+ #
10
+ # Phase A of TODO.next/01: subclass is a type tag on
11
+ # PackagedElement. The union-bag attribute set is inherited
12
+ # unchanged so existing consumers keep working. Phase B
13
+ # (narrowing attrs to the subclass) is future work.
14
+ class Dependency < PackagedElement
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:Enumeration">`. Named
8
+ # set of enumeration literals.
9
+ class Enumeration < PackagedElement
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:Extension">`. An extension
8
+ # associates a stereotype with a metaclass to make the stereotype
9
+ # applicable to instances of that metaclass (UML 2.5 §22.3).
10
+ #
11
+ # Phase A of TODO.next/01: subclass is a type tag on
12
+ # PackagedElement. The union-bag attribute set is inherited
13
+ # unchanged so existing consumers keep working. Phase B
14
+ # (narrowing attrs to the subclass) is future work.
15
+ class Extension < PackagedElement
16
+ end
17
+ end
18
+ 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,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:InstanceSpecification">`.
8
+ # A named instance of a classifier, carrying slot children that
9
+ # hold the instance's values for each defining feature.
10
+ class InstanceSpecification < PackagedElement
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "packaged_element"
4
+
5
+ module Xmi
6
+ module Uml
7
+ # UML `<packagedElement xmi:type="uml:Interface">`. Contract
8
+ # declaration carrying owned_operation children.
9
+ class Interface < PackagedElement
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<interfaceRealization>` element — a typed relationship
6
+ # between a Class and an Interface it implements. Distinct from
7
+ # the generic Realization element in Sparx XMI; using the typed
8
+ # element preserves the implementing-class ↔ Interface contract
9
+ # information that would otherwise be collapsed into a generic
10
+ # `packagedElement type="uml:Realization"`.
11
+ class InterfaceRealization < Base
12
+ attribute :name, :string
13
+ attribute :client, :string
14
+ attribute :supplier, :string
15
+ attribute :contract, :string
16
+
17
+ xml do
18
+ root "interfaceRealization"
19
+ map_attribute "name", to: :name
20
+ map_attribute "client", to: :client
21
+ map_attribute "supplier", to: :supplier
22
+ map_attribute "contract", to: :contract
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML 2.5 §9.8.2.7 — a literal boolean value specification.
6
+ class LiteralBoolean < ValueSpecification
7
+ attribute :value, :boolean
8
+
9
+ xml do
10
+ root "literalBoolean"
11
+ map_attribute "value", to: :value
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML 2.5 §9.8.2.6 — a literal integer value specification.
6
+ class LiteralInteger < ValueSpecification
7
+ attribute :value, :integer
8
+
9
+ xml do
10
+ root "literalInteger"
11
+ map_attribute "value", to: :value
12
+ end
13
+ end
14
+ end
15
+ end