xmi 0.5.10 → 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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +102 -6
  3. data/Gemfile +0 -1
  4. data/TODO.next/01-packaged-element-typed-subclasses.md +94 -0
  5. data/TODO.next/03-real-sparx-instancespec-fixture.md +56 -0
  6. data/TODO.next/README.md +17 -0
  7. data/lib/xmi/namespace/omg.rb +6 -0
  8. data/lib/xmi/root.rb +2 -2
  9. data/lib/xmi/sparx/connector/appearance.rb +1 -0
  10. data/lib/xmi/sparx/connector/connector.rb +2 -0
  11. data/lib/xmi/sparx/connector/end_base.rb +2 -0
  12. data/lib/xmi/sparx/connector/end_constraint.rb +2 -0
  13. data/lib/xmi/sparx/connector/end_modifiers.rb +1 -0
  14. data/lib/xmi/sparx/connector/end_role.rb +1 -0
  15. data/lib/xmi/sparx/connector/end_style.rb +1 -0
  16. data/lib/xmi/sparx/connector/end_type.rb +1 -0
  17. data/lib/xmi/sparx/connector/labels.rb +1 -0
  18. data/lib/xmi/sparx/connector/properties.rb +1 -0
  19. data/lib/xmi/sparx/diagram.rb +5 -0
  20. data/lib/xmi/sparx/element/association.rb +4 -0
  21. data/lib/xmi/sparx/element/attribute.rb +2 -0
  22. data/lib/xmi/sparx/element/bounds.rb +1 -0
  23. data/lib/xmi/sparx/element/code.rb +1 -0
  24. data/lib/xmi/sparx/element/containment.rb +1 -0
  25. data/lib/xmi/sparx/element/coords.rb +1 -0
  26. data/lib/xmi/sparx/element/documentation.rb +1 -0
  27. data/lib/xmi/sparx/element/element.rb +2 -0
  28. data/lib/xmi/sparx/element/extended_properties.rb +1 -0
  29. data/lib/xmi/sparx/element/flags.rb +1 -0
  30. data/lib/xmi/sparx/element/links.rb +1 -0
  31. data/lib/xmi/sparx/element/model.rb +1 -1
  32. data/lib/xmi/sparx/element/package_properties.rb +1 -0
  33. data/lib/xmi/sparx/element/paths.rb +1 -0
  34. data/lib/xmi/sparx/element/project.rb +1 -0
  35. data/lib/xmi/sparx/element/properties.rb +1 -0
  36. data/lib/xmi/sparx/element/stereotype.rb +1 -0
  37. data/lib/xmi/sparx/element/style.rb +1 -0
  38. data/lib/xmi/sparx/element/styleex.rb +1 -0
  39. data/lib/xmi/sparx/element/tag.rb +2 -0
  40. data/lib/xmi/sparx/element/times.rb +1 -0
  41. data/lib/xmi/sparx/element/xrefs.rb +1 -0
  42. data/lib/xmi/sparx/mappings/base_mapping.rb +1 -1
  43. data/lib/xmi/sparx/primitive_type.rb +1 -0
  44. data/lib/xmi/uml/association.rb +12 -0
  45. data/lib/xmi/uml/association_class.rb +17 -0
  46. data/lib/xmi/uml/association_generalization.rb +1 -8
  47. data/lib/xmi/uml/base.rb +32 -0
  48. data/lib/xmi/uml/bounds.rb +1 -18
  49. data/lib/xmi/uml/data_type.rb +12 -0
  50. data/lib/xmi/uml/default_value.rb +7 -34
  51. data/lib/xmi/uml/dependency.rb +17 -0
  52. data/lib/xmi/uml/enumeration.rb +12 -0
  53. data/lib/xmi/uml/extension.rb +18 -0
  54. data/lib/xmi/uml/imported_package.rb +17 -0
  55. data/lib/xmi/uml/instance_specification.rb +13 -0
  56. data/lib/xmi/uml/interface.rb +12 -0
  57. data/lib/xmi/uml/interface_realization.rb +26 -0
  58. data/lib/xmi/uml/literal_boolean.rb +15 -0
  59. data/lib/xmi/uml/literal_integer.rb +15 -0
  60. data/lib/xmi/uml/literal_null.rb +14 -0
  61. data/lib/xmi/uml/literal_string.rb +15 -0
  62. data/lib/xmi/uml/literal_unlimited_natural.rb +16 -0
  63. data/lib/xmi/uml/lower_value.rb +13 -0
  64. data/lib/xmi/uml/opaque_expression.rb +31 -0
  65. data/lib/xmi/uml/owned_attribute.rb +28 -13
  66. data/lib/xmi/uml/owned_comment.rb +1 -8
  67. data/lib/xmi/uml/owned_element.rb +1 -1
  68. data/lib/xmi/uml/owned_end.rb +15 -14
  69. data/lib/xmi/uml/owned_literal.rb +1 -9
  70. data/lib/xmi/uml/owned_operation.rb +11 -4
  71. data/lib/xmi/uml/owned_parameter.rb +18 -12
  72. data/lib/xmi/uml/package.rb +12 -0
  73. data/lib/xmi/uml/package_import.rb +2 -12
  74. data/lib/xmi/uml/packaged_element.rb +50 -10
  75. data/lib/xmi/uml/precondition.rb +1 -8
  76. data/lib/xmi/uml/primitive_type.rb +12 -0
  77. data/lib/xmi/uml/profile.rb +2 -17
  78. data/lib/xmi/uml/profile_application.rb +2 -14
  79. data/lib/xmi/uml/profile_application_applied_profile.rb +21 -0
  80. data/lib/xmi/uml/profile_attributes.rb +20 -0
  81. data/lib/xmi/uml/realization.rb +14 -0
  82. data/lib/xmi/uml/signal.rb +18 -0
  83. data/lib/xmi/uml/slot.rb +18 -0
  84. data/lib/xmi/uml/specification.rb +3 -8
  85. data/lib/xmi/uml/stereotype.rb +18 -0
  86. data/lib/xmi/uml/uml_class.rb +17 -0
  87. data/lib/xmi/uml/uml_model.rb +7 -11
  88. data/lib/xmi/uml/upper_value.rb +13 -0
  89. data/lib/xmi/uml/usage.rb +18 -0
  90. data/lib/xmi/uml/value_specification.rb +46 -0
  91. data/lib/xmi/uml/waypoint.rb +23 -0
  92. data/lib/xmi/uml.rb +32 -6
  93. data/lib/xmi/version.rb +1 -1
  94. data/lib/xmi.rb +17 -3
  95. data/xmi.gemspec +1 -1
  96. metadata +38 -4
@@ -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/default_value"
10
- autoload :LowerValue, "xmi/uml/default_value"
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/bounds"
47
+ autoload :Waypoint, "xmi/uml/waypoint"
23
48
  autoload :OwnedElement, "xmi/uml/owned_element"
24
49
  autoload :Diagram, "xmi/uml/diagram"
25
- autoload :ProfileApplicationAppliedProfile, "xmi/uml/profile_application"
50
+ autoload :ProfileApplicationAppliedProfile,
51
+ "xmi/uml/profile_application_applied_profile"
26
52
  autoload :ProfileApplication, "xmi/uml/profile_application"
27
- autoload :ImportedPackage, "xmi/uml/package_import"
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/profile"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xmi
4
- VERSION = "0.5.10"
4
+ VERSION = "0.5.12"
5
5
  end
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
- # Used to handle nil, empty, and omitted values consistently
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: :empty, empty: :empty, omitted: :empty },
48
+ to: { nil: :omitted, empty: :omitted, omitted: :omitted },
35
49
  }.freeze
36
50
  end
37
51
 
data/xmi.gemspec CHANGED
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.required_ruby_version = ">= 3.0.0"
34
34
 
35
- spec.add_dependency "lutaml-model", "~> 0.8.0"
35
+ spec.add_dependency "lutaml-model", "~> 0.8.17"
36
36
  spec.add_dependency "nokogiri"
37
37
  end
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.10
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-05-20 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.0
19
+ version: 0.8.17
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.0
26
+ version: 0.8.17
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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