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.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.rubocop_todo.yml +102 -7
- data/CLAUDE.md +43 -14
- data/lib/xmi/add.rb +0 -3
- data/lib/xmi/delete.rb +0 -3
- data/lib/xmi/difference.rb +0 -2
- data/lib/xmi/documentation.rb +0 -2
- data/lib/xmi/ea_root.rb +5 -4
- data/lib/xmi/namespace.rb +3 -3
- data/lib/xmi/replace.rb +0 -3
- data/lib/xmi/root.rb +0 -3
- data/lib/xmi/type.rb +0 -2
- data/lib/xmi/uml/association.rb +10 -0
- data/lib/xmi/uml/association_class.rb +15 -0
- data/lib/xmi/uml/association_generalization.rb +1 -8
- data/lib/xmi/uml/base.rb +32 -0
- data/lib/xmi/uml/bounds.rb +2 -25
- data/lib/xmi/uml/data_type.rb +10 -0
- data/lib/xmi/uml/default_value.rb +5 -34
- data/lib/xmi/uml/dependency.rb +15 -0
- data/lib/xmi/uml/diagram.rb +2 -8
- data/lib/xmi/uml/enumeration.rb +10 -0
- data/lib/xmi/uml/extension.rb +16 -0
- data/lib/xmi/uml/imported_package.rb +17 -0
- data/lib/xmi/uml/instance_specification.rb +11 -0
- data/lib/xmi/uml/interface.rb +10 -0
- data/lib/xmi/uml/interface_realization.rb +26 -0
- data/lib/xmi/uml/literal_boolean.rb +15 -0
- data/lib/xmi/uml/literal_integer.rb +15 -0
- data/lib/xmi/uml/literal_null.rb +14 -0
- data/lib/xmi/uml/literal_string.rb +15 -0
- data/lib/xmi/uml/literal_unlimited_natural.rb +16 -0
- data/lib/xmi/uml/lower_value.rb +11 -0
- data/lib/xmi/uml/opaque_expression.rb +31 -0
- data/lib/xmi/uml/owned_attribute.rb +28 -13
- data/lib/xmi/uml/owned_comment.rb +1 -8
- data/lib/xmi/uml/owned_element.rb +4 -8
- data/lib/xmi/uml/owned_end.rb +15 -12
- data/lib/xmi/uml/owned_literal.rb +1 -9
- data/lib/xmi/uml/owned_operation.rb +11 -4
- data/lib/xmi/uml/owned_parameter.rb +18 -12
- data/lib/xmi/uml/package.rb +10 -0
- data/lib/xmi/uml/package_import.rb +0 -12
- data/lib/xmi/uml/packaged_element.rb +50 -10
- data/lib/xmi/uml/precondition.rb +1 -8
- data/lib/xmi/uml/primitive_type.rb +10 -0
- data/lib/xmi/uml/profile.rb +11 -25
- data/lib/xmi/uml/profile_application.rb +4 -22
- data/lib/xmi/uml/profile_application_applied_profile.rb +21 -0
- data/lib/xmi/uml/realization.rb +12 -0
- data/lib/xmi/uml/signal.rb +16 -0
- data/lib/xmi/uml/slot.rb +18 -0
- data/lib/xmi/uml/specification.rb +3 -8
- data/lib/xmi/uml/stereotype.rb +16 -0
- data/lib/xmi/uml/uml_class.rb +15 -0
- data/lib/xmi/uml/uml_model.rb +4 -10
- data/lib/xmi/uml/upper_value.rb +11 -0
- data/lib/xmi/uml/usage.rb +16 -0
- data/lib/xmi/uml/value_specification.rb +46 -0
- data/lib/xmi/uml/waypoint.rb +17 -0
- data/lib/xmi/uml.rb +31 -6
- data/lib/xmi/uml_di/base.rb +22 -0
- data/lib/xmi/uml_di.rb +10 -0
- data/lib/xmi/version.rb +1 -1
- data/lib/xmi.rb +38 -27
- metadata +34 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db371f76bfe7fa3b6f16392f150e7bdd4a70b390053317de58ae11ea4d469fa8
|
|
4
|
+
data.tar.gz: b5d0ac779b25967ba94abaa37ec726414a296680c313d451dbc7f3ec230ab4f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6caff8c35f558fb0394b45cea65f04094ffc546b69844f2a7d8ce1fa946a1e961ece15e5569ae170a82e33b57dd007ea313e0f3d6c966251ef18d4dcefe8d94b
|
|
7
|
+
data.tar.gz: e3f580a640f314257ecd3a0c8d387dbb4e2136c7845b17dbaa99e79ab3b3bda00eb4291c77dcb3e9089bdb3bafdd8396a501b64c5b1faab291eb0f703bc1aa46
|
data/.gitignore
CHANGED
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-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
|
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
data/lib/xmi/delete.rb
CHANGED
data/lib/xmi/difference.rb
CHANGED
data/lib/xmi/documentation.rb
CHANGED
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
data/lib/xmi/replace.rb
CHANGED
data/lib/xmi/root.rb
CHANGED
data/lib/xmi/type.rb
CHANGED
|
@@ -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 <
|
|
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
|
data/lib/xmi/uml/base.rb
ADDED
|
@@ -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
|
data/lib/xmi/uml/bounds.rb
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
@@ -2,44 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
data/lib/xmi/uml/diagram.rb
CHANGED
|
@@ -2,20 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
|
|
6
|
-
|
|
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,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
|