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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +102 -7
- data/TODO.next/01-packaged-element-typed-subclasses.md +94 -0
- data/TODO.next/03-real-sparx-instancespec-fixture.md +56 -0
- data/TODO.next/README.md +17 -0
- data/lib/xmi/uml/association.rb +12 -0
- data/lib/xmi/uml/association_class.rb +17 -0
- data/lib/xmi/uml/association_generalization.rb +1 -8
- data/lib/xmi/uml/base.rb +32 -0
- data/lib/xmi/uml/bounds.rb +0 -17
- data/lib/xmi/uml/data_type.rb +12 -0
- data/lib/xmi/uml/default_value.rb +7 -34
- data/lib/xmi/uml/dependency.rb +17 -0
- data/lib/xmi/uml/enumeration.rb +12 -0
- data/lib/xmi/uml/extension.rb +18 -0
- data/lib/xmi/uml/imported_package.rb +17 -0
- data/lib/xmi/uml/instance_specification.rb +13 -0
- data/lib/xmi/uml/interface.rb +12 -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 +13 -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_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 +12 -0
- data/lib/xmi/uml/package_import.rb +2 -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 +12 -0
- data/lib/xmi/uml/profile.rb +2 -17
- data/lib/xmi/uml/profile_application.rb +2 -14
- data/lib/xmi/uml/profile_application_applied_profile.rb +21 -0
- data/lib/xmi/uml/profile_attributes.rb +20 -0
- data/lib/xmi/uml/realization.rb +14 -0
- data/lib/xmi/uml/signal.rb +18 -0
- data/lib/xmi/uml/slot.rb +18 -0
- data/lib/xmi/uml/specification.rb +3 -8
- data/lib/xmi/uml/stereotype.rb +18 -0
- data/lib/xmi/uml/uml_class.rb +17 -0
- data/lib/xmi/uml/uml_model.rb +6 -10
- data/lib/xmi/uml/upper_value.rb +13 -0
- data/lib/xmi/uml/usage.rb +18 -0
- data/lib/xmi/uml/value_specification.rb +46 -0
- data/lib/xmi/uml/waypoint.rb +23 -0
- data/lib/xmi/uml.rb +32 -6
- data/lib/xmi/version.rb +1 -1
- data/lib/xmi.rb +17 -3
- metadata +36 -2
|
@@ -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:Stereotype">. A stereotype
|
|
8
|
+
# is a kind of class defined to extend the UML metamodel
|
|
9
|
+
# (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 Stereotype < PackagedElement
|
|
16
|
+
end
|
|
17
|
+
end
|
|
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:Class">`. Classifier with
|
|
8
|
+
# attributes, operations, and structural relationships.
|
|
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 UmlClass < PackagedElement
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/xmi/uml/uml_model.rb
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "packaged_element"
|
|
4
|
+
|
|
3
5
|
module Xmi
|
|
4
6
|
module Uml
|
|
5
|
-
class UmlModel <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
8
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
7
|
+
class UmlModel < Base
|
|
9
8
|
attribute :name, :string
|
|
10
9
|
attribute :profile_application, ProfileApplication, collection: true
|
|
11
|
-
attribute :packaged_element, PackagedElement, collection: true
|
|
10
|
+
attribute :packaged_element, PackagedElement, collection: true,
|
|
11
|
+
polymorphic: true
|
|
12
12
|
attribute :package_import, PackageImport, collection: true
|
|
13
13
|
attribute :diagram, Diagram
|
|
14
14
|
|
|
15
15
|
xml do
|
|
16
16
|
root "Model"
|
|
17
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
18
|
-
|
|
19
|
-
map_attribute "id", to: :id
|
|
20
|
-
map_attribute "type", to: :type
|
|
21
17
|
map_attribute "name", to: :name
|
|
22
18
|
|
|
23
19
|
map_element "packageImport", to: :package_import, value_map: VALUE_MAP
|
|
24
20
|
map_element "packagedElement", to: :packaged_element,
|
|
25
|
-
|
|
21
|
+
polymorphic: PACKAGED_ELEMENT_POLYMORPHIC_MAP
|
|
26
22
|
map_element "Diagram", to: :diagram, form: :qualified
|
|
27
23
|
map_element "profileApplication", to: :profile_application,
|
|
28
24
|
value_map: VALUE_MAP
|
|
@@ -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:Usage">. A Dependency
|
|
8
|
+
# subtype indicating that a client requires a supplier for its
|
|
9
|
+
# proper functioning (UML 2.5 §19.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 Usage < PackagedElement
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Xmi
|
|
4
|
+
module Uml
|
|
5
|
+
# Abstract UML ValueSpecification. UML 2.5 §9.8 — the abstract
|
|
6
|
+
# parent of OpaqueExpression, LiteralString, LiteralInteger,
|
|
7
|
+
# LiteralBoolean, LiteralUnlimitedNatural, LiteralNull, etc.
|
|
8
|
+
#
|
|
9
|
+
# Used as the type of `Slot#value` and other polymorphic value
|
|
10
|
+
# attributes so the parser can dispatch on `xmi:type` to the
|
|
11
|
+
# right concrete subclass.
|
|
12
|
+
#
|
|
13
|
+
# Concrete subclasses live in their own files (literal_string.rb,
|
|
14
|
+
# opaque_expression.rb, etc.). Add new literals as a new file plus
|
|
15
|
+
# an entry in POLYMORPHIC_MAP below — OCP-friendly, no edits to
|
|
16
|
+
# callers.
|
|
17
|
+
class ValueSpecification < Base
|
|
18
|
+
attribute :type, ::Xmi::Type::XmiType, polymorphic_class: true
|
|
19
|
+
|
|
20
|
+
xml do
|
|
21
|
+
root "valueSpecification"
|
|
22
|
+
map_attribute "type", to: :type
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Shared polymorphic dispatch map for any attribute whose value
|
|
27
|
+
# is a ValueSpecification dispatched on `xmi:type`. Consumers:
|
|
28
|
+
# Slot#value, OwnedAttribute#upper_value/#lower_value/#default_value,
|
|
29
|
+
# OwnedEnd#upper_value/#lower_value/#default_value,
|
|
30
|
+
# OwnedParameter#upper_value/#lower_value/#default_value.
|
|
31
|
+
#
|
|
32
|
+
# The literal class names are string form because lutaml-model's
|
|
33
|
+
# resolve_polymorphic_class calls Object.const_get on the value.
|
|
34
|
+
VALUE_SPECIFICATION_POLYMORPHIC_MAP = {
|
|
35
|
+
attribute: "xmi:type",
|
|
36
|
+
class_map: {
|
|
37
|
+
"uml:OpaqueExpression" => "Xmi::Uml::OpaqueExpression",
|
|
38
|
+
"uml:LiteralString" => "Xmi::Uml::LiteralString",
|
|
39
|
+
"uml:LiteralInteger" => "Xmi::Uml::LiteralInteger",
|
|
40
|
+
"uml:LiteralBoolean" => "Xmi::Uml::LiteralBoolean",
|
|
41
|
+
"uml:LiteralUnlimitedNatural" => "Xmi::Uml::LiteralUnlimitedNatural",
|
|
42
|
+
"uml:LiteralNull" => "Xmi::Uml::LiteralNull",
|
|
43
|
+
},
|
|
44
|
+
}.freeze
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Xmi
|
|
4
|
+
module Uml
|
|
5
|
+
class Waypoint < Lutaml::Model::Serializable
|
|
6
|
+
skip_reference_registration
|
|
7
|
+
attribute :type, ::Xmi::Type::XmiType
|
|
8
|
+
attribute :id, ::Xmi::Type::XmiId
|
|
9
|
+
attribute :x, :integer
|
|
10
|
+
attribute :y, :integer
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
root "waypoint"
|
|
14
|
+
namespace ::Xmi::Namespace::Omg::UmlDi
|
|
15
|
+
|
|
16
|
+
map_attribute "type", to: :type
|
|
17
|
+
map_attribute "id", to: :id
|
|
18
|
+
map_attribute "x", to: :x
|
|
19
|
+
map_attribute "y", to: :y
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/xmi/uml.rb
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
+
autoload :Base, "xmi/uml/base"
|
|
5
6
|
autoload :AnnotatedElement, "xmi/uml/annotated_element"
|
|
6
7
|
autoload :Type, "xmi/uml/type"
|
|
7
8
|
autoload :MemberEnd, "xmi/uml/member_end"
|
|
8
9
|
autoload :DefaultValue, "xmi/uml/default_value"
|
|
9
|
-
autoload :UpperValue, "xmi/uml/
|
|
10
|
-
autoload :LowerValue, "xmi/uml/
|
|
10
|
+
autoload :UpperValue, "xmi/uml/upper_value"
|
|
11
|
+
autoload :LowerValue, "xmi/uml/lower_value"
|
|
12
|
+
autoload :ValueSpecification, "xmi/uml/value_specification"
|
|
13
|
+
autoload :LiteralString, "xmi/uml/literal_string"
|
|
14
|
+
autoload :LiteralInteger, "xmi/uml/literal_integer"
|
|
15
|
+
autoload :LiteralBoolean, "xmi/uml/literal_boolean"
|
|
16
|
+
autoload :LiteralUnlimitedNatural, "xmi/uml/literal_unlimited_natural"
|
|
17
|
+
autoload :LiteralNull, "xmi/uml/literal_null"
|
|
18
|
+
autoload :OpaqueExpression, "xmi/uml/opaque_expression"
|
|
19
|
+
autoload :Slot, "xmi/uml/slot"
|
|
20
|
+
autoload :InterfaceRealization, "xmi/uml/interface_realization"
|
|
11
21
|
autoload :OwnedEnd, "xmi/uml/owned_end"
|
|
12
22
|
autoload :OwnedLiteral, "xmi/uml/owned_literal"
|
|
13
23
|
autoload :OwnedAttribute, "xmi/uml/owned_attribute"
|
|
@@ -18,16 +28,32 @@ module Xmi
|
|
|
18
28
|
autoload :OwnedComment, "xmi/uml/owned_comment"
|
|
19
29
|
autoload :AssociationGeneralization, "xmi/uml/association_generalization"
|
|
20
30
|
autoload :PackagedElement, "xmi/uml/packaged_element"
|
|
31
|
+
autoload :UmlClass, "xmi/uml/uml_class"
|
|
32
|
+
autoload :Association, "xmi/uml/association"
|
|
33
|
+
autoload :Interface, "xmi/uml/interface"
|
|
34
|
+
autoload :InstanceSpecification, "xmi/uml/instance_specification"
|
|
35
|
+
autoload :DataType, "xmi/uml/data_type"
|
|
36
|
+
autoload :PrimitiveType, "xmi/uml/primitive_type"
|
|
37
|
+
autoload :Enumeration, "xmi/uml/enumeration"
|
|
38
|
+
autoload :Package, "xmi/uml/package"
|
|
39
|
+
autoload :Realization, "xmi/uml/realization"
|
|
40
|
+
autoload :Dependency, "xmi/uml/dependency"
|
|
41
|
+
autoload :Signal, "xmi/uml/signal"
|
|
42
|
+
autoload :AssociationClass, "xmi/uml/association_class"
|
|
43
|
+
autoload :Extension, "xmi/uml/extension"
|
|
44
|
+
autoload :Stereotype, "xmi/uml/stereotype"
|
|
45
|
+
autoload :Usage, "xmi/uml/usage"
|
|
21
46
|
autoload :Bounds, "xmi/uml/bounds"
|
|
22
|
-
autoload :Waypoint, "xmi/uml/
|
|
47
|
+
autoload :Waypoint, "xmi/uml/waypoint"
|
|
23
48
|
autoload :OwnedElement, "xmi/uml/owned_element"
|
|
24
49
|
autoload :Diagram, "xmi/uml/diagram"
|
|
25
|
-
autoload :ProfileApplicationAppliedProfile,
|
|
50
|
+
autoload :ProfileApplicationAppliedProfile,
|
|
51
|
+
"xmi/uml/profile_application_applied_profile"
|
|
26
52
|
autoload :ProfileApplication, "xmi/uml/profile_application"
|
|
27
|
-
autoload :ImportedPackage, "xmi/uml/
|
|
53
|
+
autoload :ImportedPackage, "xmi/uml/imported_package"
|
|
28
54
|
autoload :PackageImport, "xmi/uml/package_import"
|
|
29
55
|
autoload :UmlModel, "xmi/uml/uml_model"
|
|
30
|
-
autoload :ProfileAttributes, "xmi/uml/
|
|
56
|
+
autoload :ProfileAttributes, "xmi/uml/profile_attributes"
|
|
31
57
|
autoload :Profile, "xmi/uml/profile"
|
|
32
58
|
end
|
|
33
59
|
end
|
data/lib/xmi/version.rb
CHANGED
data/lib/xmi.rb
CHANGED
|
@@ -27,11 +27,25 @@ require_relative "xmi/xmi_identity"
|
|
|
27
27
|
module Xmi
|
|
28
28
|
class Error < StandardError; end
|
|
29
29
|
|
|
30
|
-
# Shared value_map for XMI elements
|
|
31
|
-
#
|
|
30
|
+
# Shared value_map for XMI elements.
|
|
31
|
+
#
|
|
32
|
+
# Parsing (`from:`) stays flexible: nil / empty / omitted all map
|
|
33
|
+
# to the symbol `:empty`, which the parser uses to materialise an
|
|
34
|
+
# empty model on the attribute. This preserves absence-vs-empty
|
|
35
|
+
# distinctions on the way IN.
|
|
36
|
+
#
|
|
37
|
+
# Serialization (`to:`) is generation-friendly: nil / empty /
|
|
38
|
+
# omitted all map to `:omitted`, which means "do not emit the
|
|
39
|
+
# element". This eliminates the post-processing step the ea gem
|
|
40
|
+
# previously needed (XmlSanitizer) to strip truly-empty elements
|
|
41
|
+
# that real Sparx XMI never carries.
|
|
42
|
+
#
|
|
43
|
+
# This is a breaking change from the previous symmetric VALUE_MAP
|
|
44
|
+
# (which emitted `<child/>` for empty collections). Consumers that
|
|
45
|
+
# relied on empty-element round-trip must update.
|
|
32
46
|
VALUE_MAP = {
|
|
33
47
|
from: { nil: :empty, empty: :empty, omitted: :empty },
|
|
34
|
-
to: { nil: :
|
|
48
|
+
to: { nil: :omitted, empty: :omitted, omitted: :omitted },
|
|
35
49
|
}.freeze
|
|
36
50
|
end
|
|
37
51
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xmi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
@@ -57,6 +57,9 @@ files:
|
|
|
57
57
|
- Gemfile
|
|
58
58
|
- README.adoc
|
|
59
59
|
- Rakefile
|
|
60
|
+
- TODO.next/01-packaged-element-typed-subclasses.md
|
|
61
|
+
- TODO.next/03-real-sparx-instancespec-fixture.md
|
|
62
|
+
- TODO.next/README.md
|
|
60
63
|
- bin/console
|
|
61
64
|
- bin/setup
|
|
62
65
|
- docs/migration.md
|
|
@@ -159,11 +162,29 @@ files:
|
|
|
159
162
|
- lib/xmi/type.rb
|
|
160
163
|
- lib/xmi/uml.rb
|
|
161
164
|
- lib/xmi/uml/annotated_element.rb
|
|
165
|
+
- lib/xmi/uml/association.rb
|
|
166
|
+
- lib/xmi/uml/association_class.rb
|
|
162
167
|
- lib/xmi/uml/association_generalization.rb
|
|
168
|
+
- lib/xmi/uml/base.rb
|
|
163
169
|
- lib/xmi/uml/bounds.rb
|
|
170
|
+
- lib/xmi/uml/data_type.rb
|
|
164
171
|
- lib/xmi/uml/default_value.rb
|
|
172
|
+
- lib/xmi/uml/dependency.rb
|
|
165
173
|
- lib/xmi/uml/diagram.rb
|
|
174
|
+
- lib/xmi/uml/enumeration.rb
|
|
175
|
+
- lib/xmi/uml/extension.rb
|
|
176
|
+
- lib/xmi/uml/imported_package.rb
|
|
177
|
+
- lib/xmi/uml/instance_specification.rb
|
|
178
|
+
- lib/xmi/uml/interface.rb
|
|
179
|
+
- lib/xmi/uml/interface_realization.rb
|
|
180
|
+
- lib/xmi/uml/literal_boolean.rb
|
|
181
|
+
- lib/xmi/uml/literal_integer.rb
|
|
182
|
+
- lib/xmi/uml/literal_null.rb
|
|
183
|
+
- lib/xmi/uml/literal_string.rb
|
|
184
|
+
- lib/xmi/uml/literal_unlimited_natural.rb
|
|
185
|
+
- lib/xmi/uml/lower_value.rb
|
|
166
186
|
- lib/xmi/uml/member_end.rb
|
|
187
|
+
- lib/xmi/uml/opaque_expression.rb
|
|
167
188
|
- lib/xmi/uml/owned_attribute.rb
|
|
168
189
|
- lib/xmi/uml/owned_comment.rb
|
|
169
190
|
- lib/xmi/uml/owned_element.rb
|
|
@@ -171,14 +192,27 @@ files:
|
|
|
171
192
|
- lib/xmi/uml/owned_literal.rb
|
|
172
193
|
- lib/xmi/uml/owned_operation.rb
|
|
173
194
|
- lib/xmi/uml/owned_parameter.rb
|
|
195
|
+
- lib/xmi/uml/package.rb
|
|
174
196
|
- lib/xmi/uml/package_import.rb
|
|
175
197
|
- lib/xmi/uml/packaged_element.rb
|
|
176
198
|
- lib/xmi/uml/precondition.rb
|
|
199
|
+
- lib/xmi/uml/primitive_type.rb
|
|
177
200
|
- lib/xmi/uml/profile.rb
|
|
178
201
|
- lib/xmi/uml/profile_application.rb
|
|
202
|
+
- lib/xmi/uml/profile_application_applied_profile.rb
|
|
203
|
+
- lib/xmi/uml/profile_attributes.rb
|
|
204
|
+
- lib/xmi/uml/realization.rb
|
|
205
|
+
- lib/xmi/uml/signal.rb
|
|
206
|
+
- lib/xmi/uml/slot.rb
|
|
179
207
|
- lib/xmi/uml/specification.rb
|
|
208
|
+
- lib/xmi/uml/stereotype.rb
|
|
180
209
|
- lib/xmi/uml/type.rb
|
|
210
|
+
- lib/xmi/uml/uml_class.rb
|
|
181
211
|
- lib/xmi/uml/uml_model.rb
|
|
212
|
+
- lib/xmi/uml/upper_value.rb
|
|
213
|
+
- lib/xmi/uml/usage.rb
|
|
214
|
+
- lib/xmi/uml/value_specification.rb
|
|
215
|
+
- lib/xmi/uml/waypoint.rb
|
|
182
216
|
- lib/xmi/v20110701.rb
|
|
183
217
|
- lib/xmi/v20131001.rb
|
|
184
218
|
- lib/xmi/v20161101.rb
|