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.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +13 -6
- data/.gitignore +2 -1
- data/.rubocop.yml +12 -13
- data/.rubocop_todo.yml +150 -13
- data/CHANGELOG.md +55 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +10 -0
- data/README.adoc +319 -6
- data/benchmark_parse.rb +60 -0
- data/docs/migration.md +141 -0
- data/docs/versioning.md +255 -0
- data/lib/xmi/add.rb +14 -38
- data/lib/xmi/{the_custom_profile.rb → custom_profile.rb} +25 -25
- data/lib/xmi/delete.rb +14 -38
- data/lib/xmi/difference.rb +14 -38
- data/lib/xmi/documentation.rb +16 -101
- data/lib/xmi/ea_root.rb +114 -33
- data/lib/xmi/extension.rb +6 -6
- data/lib/xmi/namespace/dynamic.rb +28 -0
- data/lib/xmi/namespace/omg.rb +81 -0
- data/lib/xmi/namespace/sparx.rb +39 -0
- data/lib/xmi/namespace.rb +9 -0
- data/lib/xmi/namespace_detector.rb +138 -0
- data/lib/xmi/namespace_registry.rb +119 -0
- data/lib/xmi/parsing.rb +113 -0
- data/lib/xmi/replace.rb +14 -38
- data/lib/xmi/root.rb +49 -213
- data/lib/xmi/sparx/connector.rb +241 -0
- data/lib/xmi/sparx/custom_profile.rb +19 -0
- data/lib/xmi/sparx/diagram.rb +97 -0
- data/lib/xmi/sparx/ea_stub.rb +20 -0
- data/lib/xmi/{extensions/eauml.rb → sparx/ea_uml.rb} +3 -2
- data/lib/xmi/sparx/element.rb +453 -0
- data/lib/xmi/sparx/extension.rb +43 -0
- data/lib/xmi/{extensions → sparx}/gml.rb +9 -3
- data/lib/xmi/sparx/mappings/base_mapping.rb +182 -0
- data/lib/xmi/sparx/mappings.rb +10 -0
- data/lib/xmi/sparx/primitive_type.rb +18 -0
- data/lib/xmi/sparx/root.rb +60 -0
- data/lib/xmi/sparx/sys_ph_s.rb +18 -0
- data/lib/xmi/sparx.rb +17 -1376
- data/lib/xmi/type.rb +37 -0
- data/lib/xmi/uml.rb +191 -469
- data/lib/xmi/v20110701.rb +81 -0
- data/lib/xmi/v20131001.rb +68 -0
- data/lib/xmi/v20161101.rb +61 -0
- data/lib/xmi/version.rb +1 -1
- data/lib/xmi/version_registry.rb +164 -0
- data/lib/xmi/versioned.rb +142 -0
- data/lib/xmi.rb +83 -11
- data/scripts-xmi-profile/profile_xmi_simple.rb +213 -0
- data/xmi.gemspec +3 -9
- metadata +38 -77
data/docs/versioning.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# XMI Version Support
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
XMI files come in different versions with different namespace URIs. This gem handles version differences through namespace-bound registers that enable version-aware type resolution.
|
|
6
|
+
|
|
7
|
+
## Version-Specific Models
|
|
8
|
+
|
|
9
|
+
Some XMI elements differ between versions:
|
|
10
|
+
|
|
11
|
+
| Element | XMI 2.1 | XMI 2.5.1 | XMI 2.5.2 |
|
|
12
|
+
|---------|----------|------------|------------|
|
|
13
|
+
| Extension | v1 | v1 (reused) | v2 |
|
|
14
|
+
| Documentation | v1 | v2 | v2 (reused) |
|
|
15
|
+
| Model | v1 | v1 (reused) | v1 (reused) |
|
|
16
|
+
|
|
17
|
+
Where versions differ, the gem uses version-specific model classes through a fallback chain.
|
|
18
|
+
|
|
19
|
+
## Fallback Chain
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
xmi_20161101
|
|
23
|
+
↓ fallback
|
|
24
|
+
xmi_20131001
|
|
25
|
+
↓ fallback
|
|
26
|
+
xmi_20110701
|
|
27
|
+
↓ fallback
|
|
28
|
+
xmi_common
|
|
29
|
+
↓ fallback
|
|
30
|
+
default
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Types not found in a version register fall back to older versions.
|
|
34
|
+
|
|
35
|
+
## Using Version-Aware Parsing
|
|
36
|
+
|
|
37
|
+
### Automatic Version Detection
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
require 'xmi'
|
|
41
|
+
|
|
42
|
+
# Parse with automatic version detection
|
|
43
|
+
doc = Xmi.parse(xml_content)
|
|
44
|
+
|
|
45
|
+
# Get version information
|
|
46
|
+
info = Xmi::Parsing.detect_version(xml_content)
|
|
47
|
+
info[:xmi_version] # => "20131001"
|
|
48
|
+
info[:uml_version] # => "20131001"
|
|
49
|
+
info[:uris][:xmi] # => "http://www.omg.org/spec/XMI/20131001"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Explicit Version
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
# Parse with explicit version
|
|
56
|
+
doc = Xmi.parse_with_version(xml_content, "20131001")
|
|
57
|
+
|
|
58
|
+
# Check supported versions
|
|
59
|
+
Xmi::Parsing.supported_versions # => ["20110701", "20131001", "20161101"]
|
|
60
|
+
Xmi::Parsing.version_supported?("20131001") # => true
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Sparx EA Files
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
# For Enterprise Architect generated XMI files
|
|
67
|
+
doc = Xmi::Sparx::SparxRoot.parse_xml_with_versioning(xml_content)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Version Modules
|
|
71
|
+
|
|
72
|
+
The gem provides version-specific modules:
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
# XMI 2.1 (20110701)
|
|
76
|
+
Xmi::V20110701.register # Register for this version
|
|
77
|
+
Xmi::V20110701::Extension # Version-specific model
|
|
78
|
+
Xmi::V20110701::Documentation # Version-specific model
|
|
79
|
+
|
|
80
|
+
# XMI 2.5.1 (20131001)
|
|
81
|
+
Xmi::V20131001.register
|
|
82
|
+
Xmi::V20131001::Documentation # Different from V20110701
|
|
83
|
+
|
|
84
|
+
# XMI 2.5.2 (20161101)
|
|
85
|
+
Xmi::V20161101.register
|
|
86
|
+
Xmi::V20161101::Extension # Different from previous versions
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Register Fallback Resolution
|
|
90
|
+
|
|
91
|
+
You can resolve types through the fallback chain:
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
# Initialize versioning
|
|
95
|
+
Xmi.init_versioning!
|
|
96
|
+
|
|
97
|
+
# Get register for a version
|
|
98
|
+
register = Xmi::V20131001.register
|
|
99
|
+
|
|
100
|
+
# Resolve type with namespace awareness
|
|
101
|
+
klass = register.resolve_in_namespace(
|
|
102
|
+
:extension,
|
|
103
|
+
"http://www.omg.org/spec/XMI/20131001"
|
|
104
|
+
)
|
|
105
|
+
# Returns Xmi::V20110701::Extension (found via fallback)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Mixed namespace documents
|
|
109
|
+
|
|
110
|
+
XMI documents frequently use different namespace versions for XMI, UML, UMLDI, and
|
|
111
|
+
UMLDC. For example, an XMI 2.5.1 file may declare:
|
|
112
|
+
|
|
113
|
+
```xml
|
|
114
|
+
<xmi:XMI xmlns:xmi="http://www.omg.org/spec/XMI/20131001"
|
|
115
|
+
xmlns:uml="http://www.omg.org/spec/UML/20161101">
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The XMI namespace is version 20131001, but the UML namespace is 20161101.
|
|
119
|
+
This gem handles mixed namespace documents automatically through the
|
|
120
|
+
`Xmi::VersionRegistry.detect_register` method.
|
|
121
|
+
|
|
122
|
+
#### How mixed namespace detection works
|
|
123
|
+
|
|
124
|
+
`detect_register` performs these steps:
|
|
125
|
+
|
|
126
|
+
1. **Detect all namespace versions** from the document's namespace declarations:
|
|
127
|
+
- XMI namespace version (e.g., 20131001)
|
|
128
|
+
- UML namespace version (e.g., 20161101)
|
|
129
|
+
- UMLDI namespace version (if present)
|
|
130
|
+
- UMLDC namespace version (if present)
|
|
131
|
+
|
|
132
|
+
2. **Get the primary register** for the XMI namespace version (the primary register
|
|
133
|
+
determines the overall model tree structure).
|
|
134
|
+
|
|
135
|
+
3. **Extend the fallback chain** for additional namespace versions:
|
|
136
|
+
- Bind the additional namespace URIs to the primary register using proper
|
|
137
|
+
`Lutaml::Xml::Namespace` subclasses from the namespace registry.
|
|
138
|
+
- Add the additional register to the primary register's fallback chain, so
|
|
139
|
+
type resolution can find version-specific types.
|
|
140
|
+
|
|
141
|
+
4. **Prevent cycles**: If the additional register's fallback chain already
|
|
142
|
+
includes the primary register, no extension is made. This prevents infinite
|
|
143
|
+
loops in type resolution.
|
|
144
|
+
|
|
145
|
+
```ruby
|
|
146
|
+
# Detect mixed namespaces and get configured register
|
|
147
|
+
register = Xmi::VersionRegistry.detect_register(xml_content)
|
|
148
|
+
# The returned register:
|
|
149
|
+
# - Is bound to all namespace URIs present in the document
|
|
150
|
+
# - Has an extended fallback chain for additional version registers
|
|
151
|
+
# - Resolves types correctly regardless of which namespace they appear in
|
|
152
|
+
|
|
153
|
+
doc = ModelClass.from_xml(xml_content, register: register)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Fallback chain extension for mixed namespaces
|
|
157
|
+
|
|
158
|
+
Given a document with XMI=20131001 and UML=20161101, the register's fallback chain
|
|
159
|
+
is extended as follows:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
Primary: xmi_20131001
|
|
163
|
+
Handles: XMI 20131001, UML 20131001 namespaces
|
|
164
|
+
|
|
165
|
+
Extended fallback: xmi_20161101 (added because UML=20161101 was detected)
|
|
166
|
+
Handles: XMI 20161101, UML 20161101 namespaces
|
|
167
|
+
Own fallback: xmi_20131001 (already has XMI 20131001)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
This allows the parser to resolve:
|
|
171
|
+
|
|
172
|
+
- Types specific to the UML 20161101 version (via the extended fallback)
|
|
173
|
+
- Types from the primary XMI 20131001 version (via the primary register)
|
|
174
|
+
|
|
175
|
+
### Version-specific namespace binding
|
|
176
|
+
|
|
177
|
+
Each version register is bound to its specific namespace URIs:
|
|
178
|
+
|
|
179
|
+
```ruby
|
|
180
|
+
register = Xmi::V20131001.register
|
|
181
|
+
register.bound_namespace_uris
|
|
182
|
+
# => ["http://www.omg.org/spec/XMI/20131001",
|
|
183
|
+
# "http://www.omg.org/spec/UML/20131001",
|
|
184
|
+
# "http://www.omg.org/spec/UML/20131001/UMLDI",
|
|
185
|
+
# "http://www.omg.org/spec/UML/20131001/UMLDC"]
|
|
186
|
+
|
|
187
|
+
register.handles_namespace?("http://www.omg.org/spec/XMI/20131001")
|
|
188
|
+
# => true
|
|
189
|
+
|
|
190
|
+
register.handles_namespace?("http://www.omg.org/spec/XMI/20161101")
|
|
191
|
+
# => false (different version)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Programmatic Version Detection
|
|
195
|
+
|
|
196
|
+
```ruby
|
|
197
|
+
require 'xmi'
|
|
198
|
+
|
|
199
|
+
# Detect version from XML content
|
|
200
|
+
xml = <<~XML
|
|
201
|
+
<?xml version="1.0"?>
|
|
202
|
+
<xmi:XMI xmlns:xmi="http://www.omg.org/spec/XMI/20110701"
|
|
203
|
+
xmlns:uml="http://www.omg.org/spec/UML/20110701">
|
|
204
|
+
<xmi:Documentation>...</xmi:Documentation>
|
|
205
|
+
</xmi:XMI>
|
|
206
|
+
XML
|
|
207
|
+
|
|
208
|
+
info = Xmi::Parsing.detect_version(xml)
|
|
209
|
+
# => { versions: { xmi: "20110701", uml: "20110701", ... },
|
|
210
|
+
# uris: { xmi: "http://...", uml: "http://...", ... },
|
|
211
|
+
# xmi_version: "20110701", uml_version: "20110701" }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Error Handling
|
|
215
|
+
|
|
216
|
+
Unknown versions are handled gracefully:
|
|
217
|
+
|
|
218
|
+
```ruby
|
|
219
|
+
# Unknown version raises ArgumentError when explicitly specified
|
|
220
|
+
Xmi.parse_with_version(xml, "19990101")
|
|
221
|
+
# => ArgumentError: Unknown version: 19990101
|
|
222
|
+
|
|
223
|
+
# Unknown version falls back to default parsing when auto-detected
|
|
224
|
+
doc = Xmi.parse(unknown_version_xml)
|
|
225
|
+
# Works, but may not resolve version-specific types correctly
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## API Reference
|
|
229
|
+
|
|
230
|
+
### Module Methods
|
|
231
|
+
|
|
232
|
+
| Method | Description |
|
|
233
|
+
|--------|-------------|
|
|
234
|
+
| `Xmi.parse(xml)` | Parse with auto-detection |
|
|
235
|
+
| `Xmi.parse_with_version(xml, version)` | Parse with explicit version |
|
|
236
|
+
| `Xmi.init_versioning!` | Initialize all version registers |
|
|
237
|
+
| `Xmi.versioning_initialized?` | Check initialization status |
|
|
238
|
+
|
|
239
|
+
### Parsing Module Methods
|
|
240
|
+
|
|
241
|
+
| Method | Description |
|
|
242
|
+
|--------|-------------|
|
|
243
|
+
| `Xmi::Parsing.parse(xml, **options)` | Parse with options |
|
|
244
|
+
| `Xmi::Parsing.parse_file(path, **options)` | Parse from file |
|
|
245
|
+
| `Xmi::Parsing.detect_version(xml)` | Detect version info |
|
|
246
|
+
| `Xmi::Parsing.supported_versions` | List supported versions |
|
|
247
|
+
| `Xmi::Parsing.version_supported?(version)` | Check if version supported |
|
|
248
|
+
|
|
249
|
+
### Version Registry Methods
|
|
250
|
+
|
|
251
|
+
| Method | Description |
|
|
252
|
+
|--------|-------------|
|
|
253
|
+
| `Xmi::VersionRegistry.register_for_version(version)` | Get register for version |
|
|
254
|
+
| `Xmi::VersionRegistry.register_for_namespace(uri)` | Get register for namespace |
|
|
255
|
+
| `Xmi::VersionRegistry.detect_register(xml)` | Detect and get register |
|
data/lib/xmi/add.rb
CHANGED
|
@@ -5,12 +5,12 @@ require_relative "extension"
|
|
|
5
5
|
|
|
6
6
|
module Xmi
|
|
7
7
|
class Add < Lutaml::Model::Serializable
|
|
8
|
-
attribute :id,
|
|
9
|
-
attribute :label,
|
|
10
|
-
attribute :uuid,
|
|
8
|
+
attribute :id, ::Xmi::Type::XmiId
|
|
9
|
+
attribute :label, ::Xmi::Type::XmiLabel
|
|
10
|
+
attribute :uuid, ::Xmi::Type::XmiUuid
|
|
11
11
|
attribute :href, :string
|
|
12
|
-
attribute :idref,
|
|
13
|
-
attribute :type,
|
|
12
|
+
attribute :idref, ::Xmi::Type::XmiIdRef
|
|
13
|
+
attribute :type, ::Xmi::Type::XmiType
|
|
14
14
|
attribute :target, :string
|
|
15
15
|
attribute :container, :string
|
|
16
16
|
attribute :position, :integer
|
|
@@ -18,46 +18,22 @@ module Xmi
|
|
|
18
18
|
attribute :difference, Difference, collection: true
|
|
19
19
|
attribute :extension, Extension, collection: true
|
|
20
20
|
|
|
21
|
-
xml do
|
|
21
|
+
xml do
|
|
22
22
|
root "Add"
|
|
23
|
-
namespace
|
|
23
|
+
namespace ::Xmi::Namespace::Omg::Xmi
|
|
24
24
|
|
|
25
|
-
map_attribute "id", to: :id
|
|
26
|
-
map_attribute "label", to: :label
|
|
27
|
-
map_attribute "uuid", to: :uuid
|
|
25
|
+
map_attribute "id", to: :id
|
|
26
|
+
map_attribute "label", to: :label
|
|
27
|
+
map_attribute "uuid", to: :uuid
|
|
28
28
|
map_attribute "href", to: :href
|
|
29
|
-
map_attribute "idref", to: :idref
|
|
30
|
-
map_attribute "type", to: :type
|
|
29
|
+
map_attribute "idref", to: :idref
|
|
30
|
+
map_attribute "type", to: :type
|
|
31
31
|
map_attribute "target", to: :target
|
|
32
32
|
map_attribute "container", to: :container
|
|
33
33
|
map_attribute "position", to: :position
|
|
34
34
|
map_attribute "addition", to: :addition
|
|
35
|
-
map_element "difference", to: :difference,
|
|
36
|
-
|
|
37
|
-
from: {
|
|
38
|
-
nil: :empty,
|
|
39
|
-
empty: :empty,
|
|
40
|
-
omitted: :empty
|
|
41
|
-
},
|
|
42
|
-
to: {
|
|
43
|
-
nil: :empty,
|
|
44
|
-
empty: :empty,
|
|
45
|
-
omitted: :empty
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
map_element "Extension", to: :extension,
|
|
49
|
-
value_map: {
|
|
50
|
-
from: {
|
|
51
|
-
nil: :empty,
|
|
52
|
-
empty: :empty,
|
|
53
|
-
omitted: :empty
|
|
54
|
-
},
|
|
55
|
-
to: {
|
|
56
|
-
nil: :empty,
|
|
57
|
-
empty: :empty,
|
|
58
|
-
omitted: :empty
|
|
59
|
-
}
|
|
60
|
-
}
|
|
35
|
+
map_element "difference", to: :difference, value_map: VALUE_MAP
|
|
36
|
+
map_element "Extension", to: :extension, value_map: VALUE_MAP
|
|
61
37
|
end
|
|
62
38
|
end
|
|
63
39
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
|
-
module
|
|
4
|
+
module CustomProfile
|
|
5
5
|
class Bibliography < Lutaml::Model::Serializable
|
|
6
6
|
attribute :base_class, :string
|
|
7
7
|
|
|
8
8
|
xml do
|
|
9
|
-
|
|
10
|
-
namespace
|
|
9
|
+
element "Bibliography"
|
|
10
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
11
11
|
|
|
12
12
|
map_attribute "base_Class", to: :base_class
|
|
13
13
|
end
|
|
@@ -17,8 +17,8 @@ module Xmi
|
|
|
17
17
|
attribute :base_class, :string
|
|
18
18
|
|
|
19
19
|
xml do
|
|
20
|
-
|
|
21
|
-
namespace
|
|
20
|
+
element "BasicDoc"
|
|
21
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
22
22
|
|
|
23
23
|
map_attribute "base_Class", to: :base_class
|
|
24
24
|
end
|
|
@@ -28,8 +28,8 @@ module Xmi
|
|
|
28
28
|
attribute :base_enumeration, :string
|
|
29
29
|
|
|
30
30
|
xml do
|
|
31
|
-
|
|
32
|
-
namespace
|
|
31
|
+
element "enumeration"
|
|
32
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
33
33
|
|
|
34
34
|
map_attribute "base_Enumeration", to: :base_enumeration
|
|
35
35
|
end
|
|
@@ -39,8 +39,8 @@ module Xmi
|
|
|
39
39
|
attribute :base_constraint, :string
|
|
40
40
|
|
|
41
41
|
xml do
|
|
42
|
-
|
|
43
|
-
namespace
|
|
42
|
+
element "OCL"
|
|
43
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
44
44
|
|
|
45
45
|
map_attribute "base_Constraint", to: :base_constraint
|
|
46
46
|
end
|
|
@@ -50,8 +50,8 @@ module Xmi
|
|
|
50
50
|
attribute :base_constraint, :string
|
|
51
51
|
|
|
52
52
|
xml do
|
|
53
|
-
|
|
54
|
-
namespace
|
|
53
|
+
element "invariant"
|
|
54
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
55
55
|
|
|
56
56
|
map_attribute "base_Constraint", to: :base_constraint
|
|
57
57
|
end
|
|
@@ -62,8 +62,8 @@ module Xmi
|
|
|
62
62
|
attribute :publication_date, :string
|
|
63
63
|
|
|
64
64
|
xml do
|
|
65
|
-
|
|
66
|
-
namespace
|
|
65
|
+
element "publicationDate"
|
|
66
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
67
67
|
|
|
68
68
|
map_attribute "base_Package", to: :base_package
|
|
69
69
|
map_attribute "publicationDate", to: :publication_date
|
|
@@ -75,8 +75,8 @@ module Xmi
|
|
|
75
75
|
attribute :edition, :string
|
|
76
76
|
|
|
77
77
|
xml do
|
|
78
|
-
|
|
79
|
-
namespace
|
|
78
|
+
element "edition"
|
|
79
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
80
80
|
|
|
81
81
|
map_attribute "base_Package", to: :base_package
|
|
82
82
|
map_attribute "edition", to: :edition
|
|
@@ -88,8 +88,8 @@ module Xmi
|
|
|
88
88
|
attribute :number, :string
|
|
89
89
|
|
|
90
90
|
xml do
|
|
91
|
-
|
|
92
|
-
namespace
|
|
91
|
+
element "number"
|
|
92
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
93
93
|
|
|
94
94
|
map_attribute "base_Package", to: :base_package
|
|
95
95
|
map_attribute "number", to: :number
|
|
@@ -101,8 +101,8 @@ module Xmi
|
|
|
101
101
|
attribute :year_version, :string
|
|
102
102
|
|
|
103
103
|
xml do
|
|
104
|
-
|
|
105
|
-
namespace
|
|
104
|
+
element "yearVersion"
|
|
105
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
106
106
|
|
|
107
107
|
map_attribute "base_Package", to: :base_package
|
|
108
108
|
map_attribute "yearVersion", to: :year_version
|
|
@@ -113,8 +113,8 @@ module Xmi
|
|
|
113
113
|
attribute :base_package, :string
|
|
114
114
|
|
|
115
115
|
xml do
|
|
116
|
-
|
|
117
|
-
namespace
|
|
116
|
+
element "informative"
|
|
117
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
118
118
|
|
|
119
119
|
map_attribute "base_Package", to: :base_package
|
|
120
120
|
end
|
|
@@ -126,8 +126,8 @@ module Xmi
|
|
|
126
126
|
attribute :persistence, :string
|
|
127
127
|
|
|
128
128
|
xml do
|
|
129
|
-
|
|
130
|
-
namespace
|
|
129
|
+
element "persistence"
|
|
130
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
131
131
|
|
|
132
132
|
map_attribute "base_Class", to: :base_class
|
|
133
133
|
map_attribute "base_Enumeration", to: :base_enumeration
|
|
@@ -139,8 +139,8 @@ module Xmi
|
|
|
139
139
|
attribute :base_class, :string
|
|
140
140
|
|
|
141
141
|
xml do
|
|
142
|
-
|
|
143
|
-
namespace
|
|
142
|
+
element "Abstract"
|
|
143
|
+
namespace ::Xmi::Namespace::Sparx::CustomProfile
|
|
144
144
|
|
|
145
145
|
map_attribute "base_Class", to: :base_class
|
|
146
146
|
end
|
data/lib/xmi/delete.rb
CHANGED
|
@@ -5,55 +5,31 @@ require_relative "extension"
|
|
|
5
5
|
|
|
6
6
|
module Xmi
|
|
7
7
|
class Delete < Lutaml::Model::Serializable
|
|
8
|
-
attribute :id,
|
|
9
|
-
attribute :label,
|
|
10
|
-
attribute :uuid,
|
|
8
|
+
attribute :id, ::Xmi::Type::XmiId
|
|
9
|
+
attribute :label, ::Xmi::Type::XmiLabel
|
|
10
|
+
attribute :uuid, ::Xmi::Type::XmiUuid
|
|
11
11
|
attribute :href, :string
|
|
12
|
-
attribute :idref,
|
|
13
|
-
attribute :type,
|
|
12
|
+
attribute :idref, ::Xmi::Type::XmiIdRef
|
|
13
|
+
attribute :type, ::Xmi::Type::XmiType
|
|
14
14
|
attribute :target, :string
|
|
15
15
|
attribute :container, :string
|
|
16
16
|
attribute :difference, Difference, collection: true
|
|
17
17
|
attribute :extension, Extension, collection: true
|
|
18
18
|
|
|
19
|
-
xml do
|
|
19
|
+
xml do
|
|
20
20
|
root "Delete"
|
|
21
|
-
namespace
|
|
21
|
+
namespace ::Xmi::Namespace::Omg::Xmi
|
|
22
22
|
|
|
23
|
-
map_attribute "id", to: :id
|
|
24
|
-
map_attribute "label", to: :label
|
|
25
|
-
map_attribute "uuid", to: :uuid
|
|
23
|
+
map_attribute "id", to: :id
|
|
24
|
+
map_attribute "label", to: :label
|
|
25
|
+
map_attribute "uuid", to: :uuid
|
|
26
26
|
map_attribute "href", to: :href
|
|
27
|
-
map_attribute "idref", to: :idref
|
|
28
|
-
map_attribute "type", to: :type
|
|
27
|
+
map_attribute "idref", to: :idref
|
|
28
|
+
map_attribute "type", to: :type
|
|
29
29
|
map_attribute "target", to: :target
|
|
30
30
|
map_attribute "container", to: :container
|
|
31
|
-
map_element "difference", to: :difference,
|
|
32
|
-
|
|
33
|
-
from: {
|
|
34
|
-
nil: :empty,
|
|
35
|
-
empty: :empty,
|
|
36
|
-
omitted: :empty
|
|
37
|
-
},
|
|
38
|
-
to: {
|
|
39
|
-
nil: :empty,
|
|
40
|
-
empty: :empty,
|
|
41
|
-
omitted: :empty
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
map_element "Extension", to: :extension,
|
|
45
|
-
value_map: {
|
|
46
|
-
from: {
|
|
47
|
-
nil: :empty,
|
|
48
|
-
empty: :empty,
|
|
49
|
-
omitted: :empty
|
|
50
|
-
},
|
|
51
|
-
to: {
|
|
52
|
-
nil: :empty,
|
|
53
|
-
empty: :empty,
|
|
54
|
-
omitted: :empty
|
|
55
|
-
}
|
|
56
|
-
}
|
|
31
|
+
map_element "difference", to: :difference, value_map: VALUE_MAP
|
|
32
|
+
map_element "Extension", to: :extension, value_map: VALUE_MAP
|
|
57
33
|
end
|
|
58
34
|
end
|
|
59
35
|
end
|
data/lib/xmi/difference.rb
CHANGED
|
@@ -4,55 +4,31 @@ require_relative "extension"
|
|
|
4
4
|
|
|
5
5
|
module Xmi
|
|
6
6
|
class Difference < Lutaml::Model::Serializable
|
|
7
|
-
attribute :id,
|
|
8
|
-
attribute :label,
|
|
9
|
-
attribute :uuid,
|
|
7
|
+
attribute :id, ::Xmi::Type::XmiId
|
|
8
|
+
attribute :label, ::Xmi::Type::XmiLabel
|
|
9
|
+
attribute :uuid, ::Xmi::Type::XmiUuid
|
|
10
10
|
attribute :href, :string
|
|
11
|
-
attribute :idref,
|
|
12
|
-
attribute :type,
|
|
11
|
+
attribute :idref, ::Xmi::Type::XmiIdRef
|
|
12
|
+
attribute :type, ::Xmi::Type::XmiType
|
|
13
13
|
attribute :target, :string
|
|
14
14
|
attribute :container, :string
|
|
15
15
|
attribute :difference, Difference, collection: true
|
|
16
16
|
attribute :extension, Extension, collection: true
|
|
17
17
|
|
|
18
|
-
xml do
|
|
18
|
+
xml do
|
|
19
19
|
root "Difference"
|
|
20
|
-
namespace
|
|
20
|
+
namespace ::Xmi::Namespace::Omg::Xmi
|
|
21
21
|
|
|
22
|
-
map_attribute "id", to: :id
|
|
23
|
-
map_attribute "label", to: :label
|
|
24
|
-
map_attribute "uuid", to: :uuid
|
|
22
|
+
map_attribute "id", to: :id
|
|
23
|
+
map_attribute "label", to: :label
|
|
24
|
+
map_attribute "uuid", to: :uuid
|
|
25
25
|
map_attribute "href", to: :href
|
|
26
|
-
map_attribute "idref", to: :idref
|
|
27
|
-
map_attribute "type", to: :type
|
|
26
|
+
map_attribute "idref", to: :idref
|
|
27
|
+
map_attribute "type", to: :type
|
|
28
28
|
map_attribute "target", to: :target
|
|
29
29
|
map_attribute "container", to: :container
|
|
30
|
-
map_element "difference", to: :difference,
|
|
31
|
-
|
|
32
|
-
from: {
|
|
33
|
-
nil: :empty,
|
|
34
|
-
empty: :empty,
|
|
35
|
-
omitted: :empty
|
|
36
|
-
},
|
|
37
|
-
to: {
|
|
38
|
-
nil: :empty,
|
|
39
|
-
empty: :empty,
|
|
40
|
-
omitted: :empty
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
map_element "Extension", to: :extension,
|
|
44
|
-
value_map: {
|
|
45
|
-
from: {
|
|
46
|
-
nil: :empty,
|
|
47
|
-
empty: :empty,
|
|
48
|
-
omitted: :empty
|
|
49
|
-
},
|
|
50
|
-
to: {
|
|
51
|
-
nil: :empty,
|
|
52
|
-
empty: :empty,
|
|
53
|
-
omitted: :empty
|
|
54
|
-
}
|
|
55
|
-
}
|
|
30
|
+
map_element "difference", to: :difference, value_map: VALUE_MAP
|
|
31
|
+
map_element "Extension", to: :extension, value_map: VALUE_MAP
|
|
56
32
|
end
|
|
57
33
|
end
|
|
58
34
|
end
|