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
@@ -11,6 +11,7 @@ module Xmi
11
11
 
12
12
  xml do
13
13
  root "extendedProperties"
14
+ namespace ::Xmi::Namespace::Omg::Xmi
14
15
 
15
16
  map_attribute "tagged", to: :tagged
16
17
  map_attribute "package_name", to: :package_name
@@ -15,6 +15,7 @@ module Xmi
15
15
 
16
16
  xml do
17
17
  root "flags"
18
+ namespace ::Xmi::Namespace::Omg::Xmi
18
19
 
19
20
  map_attribute "iscontrolled", to: :is_controlled
20
21
  map_attribute "isprotected", to: :is_protected
@@ -11,6 +11,7 @@ module Xmi
11
11
 
12
12
  xml do
13
13
  root "links"
14
+ namespace ::Xmi::Namespace::Omg::Xmi
14
15
 
15
16
  map_element "Association", to: :association, value_map: VALUE_MAP
16
17
  map_element "Generalization", to: :generalization,
@@ -13,7 +13,7 @@ module Xmi
13
13
 
14
14
  xml do
15
15
  root "model"
16
- namespace ::Xmi::Namespace::Omg::Uml
16
+ namespace ::Xmi::Namespace::Omg::Xmi
17
17
 
18
18
  map_attribute "package", to: :package
19
19
  map_attribute "package2", to: :package2
@@ -11,6 +11,7 @@ module Xmi
11
11
 
12
12
  xml do
13
13
  root "packagedproperties"
14
+ namespace ::Xmi::Namespace::Omg::Xmi
14
15
 
15
16
  map_attribute "version", to: :version
16
17
  map_attribute "xmiver", to: :xmiver
@@ -9,6 +9,7 @@ module Xmi
9
9
 
10
10
  xml do
11
11
  root "paths"
12
+ namespace ::Xmi::Namespace::Omg::Xmi
12
13
 
13
14
  map_attribute "xmlpath", to: :xmlpath
14
15
  end
@@ -15,6 +15,7 @@ module Xmi
15
15
 
16
16
  xml do
17
17
  root "project"
18
+ namespace ::Xmi::Namespace::Omg::Xmi
18
19
 
19
20
  map_attribute "author", to: :author
20
21
  map_attribute "version", to: :version
@@ -21,6 +21,7 @@ module Xmi
21
21
 
22
22
  xml do
23
23
  root "properties"
24
+ namespace ::Xmi::Namespace::Omg::Xmi
24
25
 
25
26
  map_attribute "name", to: :name
26
27
  map_attribute "type", to: :type
@@ -9,6 +9,7 @@ module Xmi
9
9
 
10
10
  xml do
11
11
  root "stereotype"
12
+ namespace ::Xmi::Namespace::Omg::Xmi
12
13
 
13
14
  map_attribute "stereotype", to: :stereotype
14
15
  end
@@ -9,6 +9,7 @@ module Xmi
9
9
 
10
10
  xml do
11
11
  root "style"
12
+ namespace ::Xmi::Namespace::Omg::Xmi
12
13
 
13
14
  map_attribute "appearance", to: :appearance
14
15
  end
@@ -9,6 +9,7 @@ module Xmi
9
9
 
10
10
  xml do
11
11
  root "styleex"
12
+ namespace ::Xmi::Namespace::Omg::Xmi
12
13
 
13
14
  map_attribute "value", to: :value
14
15
  end
@@ -12,6 +12,7 @@ module Xmi
12
12
 
13
13
  xml do
14
14
  root "tag"
15
+ namespace ::Xmi::Namespace::Omg::Xmi
15
16
 
16
17
  map_attribute "id", to: :id
17
18
  map_attribute "name", to: :name
@@ -25,6 +26,7 @@ module Xmi
25
26
 
26
27
  xml do
27
28
  root "tags"
29
+ namespace ::Xmi::Namespace::Omg::Xmi
28
30
  map_element "tag", to: :tags, value_map: VALUE_MAP
29
31
  end
30
32
  end
@@ -12,6 +12,7 @@ module Xmi
12
12
 
13
13
  xml do
14
14
  root "times"
15
+ namespace ::Xmi::Namespace::Omg::Xmi
15
16
 
16
17
  map_attribute "created", to: :created
17
18
  map_attribute "modified", to: :modified
@@ -9,6 +9,7 @@ module Xmi
9
9
 
10
10
  xml do
11
11
  root "xrefs"
12
+ namespace ::Xmi::Namespace::Omg::Xmi
12
13
 
13
14
  map_attribute "value", to: :value
14
15
  end
@@ -33,7 +33,7 @@ module Xmi
33
33
  VM = ::Xmi::VALUE_MAP
34
34
 
35
35
  # Extension element containing Sparx EA-specific metadata
36
- map_element "Extension", to: :extension
36
+ map_element "Extension", to: :extension, form: :qualified
37
37
 
38
38
  # Modelica parameter elements (SysPhS profile)
39
39
  map_element "ModelicaParameter", to: :modelica_parameter
@@ -9,6 +9,7 @@ module Xmi
9
9
 
10
10
  xml do
11
11
  root "primitivetypes"
12
+ namespace ::Xmi::Namespace::Omg::Xmi
12
13
 
13
14
  map_element "packagedElement", to: :packaged_element,
14
15
  value_map: VALUE_MAP
@@ -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
@@ -13,7 +13,7 @@ module Xmi
13
13
 
14
14
  xml do
15
15
  root "bounds"
16
- namespace ::Xmi::Namespace::Omg::Uml
16
+ namespace ::Xmi::Namespace::Omg::UmlDi
17
17
 
18
18
  map_attribute "type", to: :type
19
19
  map_attribute "id", to: :id
@@ -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::Uml
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
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML 2.5 §9.8.2.4 — a literal null value specification. Carries
6
+ # no `value` attribute; presence of a LiteralNull child indicates
7
+ # the slot is explicitly null (vs. absent).
8
+ class LiteralNull < ValueSpecification
9
+ xml do
10
+ root "literalNull"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML 2.5 §9.8.2.5 — a literal string value specification.
6
+ class LiteralString < ValueSpecification
7
+ attribute :value, :string
8
+
9
+ xml do
10
+ root "literalString"
11
+ map_attribute "value", to: :value
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML 2.5 §9.8.2.8 — a literal unlimited-natural value
6
+ # specification. `value` is "*" for unbounded.
7
+ class LiteralUnlimitedNatural < ValueSpecification
8
+ attribute :value, :string
9
+
10
+ xml do
11
+ root "literalUnlimitedNatural"
12
+ map_attribute "value", to: :value
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "default_value"
4
+
5
+ module Xmi
6
+ module Uml
7
+ class LowerValue < DefaultValue
8
+ xml do
9
+ root "lowerValue"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xmi
4
+ module Uml
5
+ # UML `<opaqueExpression>` element — used as the body of a Slot's
6
+ # `<value>` element and as the language-bodied body of behavioral
7
+ # features. Sparx EA serialises instance-specification values as
8
+ # OpaqueExpression with a `body` attribute carrying the literal
9
+ # expression text.
10
+ #
11
+ # Per UML 2.5 §8.3, `body` and `language` are parallel arrays
12
+ # (`String [*]`): `body[i]` is written in `language[i]`. Most
13
+ # Sparx output carries a single pair; we model the collection
14
+ # form so multi-language expressions round-trip without loss.
15
+ class OpaqueExpression < ValueSpecification
16
+ attribute :body, :string, collection: true
17
+ attribute :language, :string, collection: true
18
+ attribute :body_attribute, :string
19
+ attribute :language_attribute, :string
20
+
21
+ xml do
22
+ root "opaqueExpression"
23
+ map_attribute "body", to: :body_attribute
24
+ map_attribute "language", to: :language_attribute
25
+
26
+ map_element "body", to: :body
27
+ map_element "language", to: :language
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,30 +2,45 @@
2
2
 
3
3
  module Xmi
4
4
  module Uml
5
- class OwnedAttribute < Lutaml::Model::Serializable
6
- skip_reference_registration
7
- attribute :type, ::Xmi::Type::XmiType
8
- attribute :id, ::Xmi::Type::XmiId
5
+ class OwnedAttribute < Base
9
6
  attribute :association, :string
10
7
  attribute :name, :string
11
- attribute :is_derived, :string
8
+ attribute :visibility, :string
9
+ attribute :is_derived, :boolean
10
+ attribute :is_id, :boolean
11
+ attribute :is_ordered, :boolean
12
+ attribute :is_unique, :boolean
13
+ attribute :is_read_only, :boolean
14
+ # `default` is the XMI attribute form (string shortcut);
15
+ # `default_value` below is the child <defaultValue> element
16
+ # (ValueSpecification). UML 2.5 Property carries both shapes.
17
+ attribute :default, :string
18
+ attribute :aggregation, :string
12
19
  attribute :uml_type, Uml::Type
13
- attribute :upper_value, UpperValue
14
- attribute :lower_value, LowerValue
20
+ attribute :upper_value, ValueSpecification, polymorphic: true
21
+ attribute :lower_value, ValueSpecification, polymorphic: true
22
+ attribute :default_value, ValueSpecification, polymorphic: true
15
23
 
16
24
  xml do
17
25
  root "ownedAttribute"
18
- namespace ::Xmi::Namespace::Omg::Uml
19
-
20
- map_attribute "type", to: :type
21
- map_attribute "id", to: :id
22
26
  map_attribute "association", to: :association
23
27
  map_attribute "name", to: :name
28
+ map_attribute "visibility", to: :visibility
24
29
  map_attribute "isDerived", to: :is_derived
30
+ map_attribute "isID", to: :is_id
31
+ map_attribute "isOrdered", to: :is_ordered
32
+ map_attribute "isUnique", to: :is_unique
33
+ map_attribute "isReadOnly", to: :is_read_only
34
+ map_attribute "default", to: :default
35
+ map_attribute "aggregation", to: :aggregation
25
36
 
26
37
  map_element "type", to: :uml_type
27
- map_element "upperValue", to: :upper_value
28
- map_element "lowerValue", to: :lower_value
38
+ map_element "upperValue", to: :upper_value,
39
+ polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
40
+ map_element "lowerValue", to: :lower_value,
41
+ polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
42
+ map_element "defaultValue", to: :default_value,
43
+ polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
29
44
  end
30
45
  end
31
46
  end