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
|
@@ -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,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 <
|
|
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 :
|
|
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,
|
|
14
|
-
attribute :lower_value,
|
|
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
|
-
|
|
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
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
class OwnedComment <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
8
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
5
|
+
class OwnedComment < Base
|
|
9
6
|
attribute :name, :string
|
|
10
7
|
attribute :body_element, :string
|
|
11
8
|
attribute :body_attribute, :string
|
|
@@ -14,10 +11,6 @@ module Xmi
|
|
|
14
11
|
|
|
15
12
|
xml do
|
|
16
13
|
root "ownedComment"
|
|
17
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
18
|
-
|
|
19
|
-
map_attribute "type", to: :type
|
|
20
|
-
map_attribute "id", to: :id
|
|
21
14
|
map_attribute "name", to: :name
|
|
22
15
|
map_attribute "body", to: :body_attribute
|
|
23
16
|
map_attribute "annotatedElement", to: :annotated_attribute
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
# UMLDI `<ownedElement>` — a diagram element (shape, label, etc.).
|
|
6
|
+
# Carries text, optional nested ownedElement children, bounds,
|
|
7
|
+
# and source/target/waypoint for connectors.
|
|
8
|
+
class OwnedElement < ::Xmi::UmlDi::Base
|
|
9
9
|
attribute :text, :string
|
|
10
10
|
attribute :model_element, :string
|
|
11
11
|
attribute :owned_element, OwnedElement, collection: true
|
|
@@ -16,10 +16,6 @@ module Xmi
|
|
|
16
16
|
|
|
17
17
|
xml do
|
|
18
18
|
root "ownedElement"
|
|
19
|
-
namespace ::Xmi::Namespace::Omg::UmlDi
|
|
20
|
-
|
|
21
|
-
map_attribute "type", to: :type
|
|
22
|
-
map_attribute "id", to: :id
|
|
23
19
|
map_attribute "text", to: :text
|
|
24
20
|
map_attribute "modelElement", to: :model_element
|
|
25
21
|
|
data/lib/xmi/uml/owned_end.rb
CHANGED
|
@@ -2,31 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
class OwnedEnd <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
8
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
5
|
+
class OwnedEnd < Base
|
|
9
6
|
attribute :association, :string
|
|
10
7
|
attribute :name, :string
|
|
8
|
+
attribute :visibility, :string
|
|
9
|
+
attribute :aggregation, :string
|
|
11
10
|
attribute :uml_type, Uml::Type
|
|
12
11
|
attribute :member_end, :string
|
|
13
|
-
attribute :
|
|
14
|
-
attribute :
|
|
12
|
+
attribute :upper_value, ValueSpecification, polymorphic: true
|
|
13
|
+
attribute :lower_value, ValueSpecification, polymorphic: true
|
|
14
|
+
attribute :default_value, ValueSpecification, polymorphic: true
|
|
15
15
|
attribute :is_composite, :boolean
|
|
16
16
|
|
|
17
17
|
xml do
|
|
18
18
|
root "ownedEnd"
|
|
19
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
20
|
-
|
|
21
|
-
map_attribute "type", to: :type
|
|
22
|
-
map_attribute "id", to: :id
|
|
23
19
|
map_attribute "association", to: :association
|
|
24
20
|
map_attribute "name", to: :name
|
|
21
|
+
map_attribute "visibility", to: :visibility
|
|
22
|
+
map_attribute "aggregation", to: :aggregation
|
|
25
23
|
map_attribute "memberEnd", to: :member_end
|
|
26
|
-
map_attribute "lower", to: :lower
|
|
27
|
-
map_attribute "upper", to: :upper
|
|
28
24
|
map_attribute "isComposite", to: :is_composite
|
|
25
|
+
|
|
29
26
|
map_element "type", to: :uml_type
|
|
27
|
+
map_element "upperValue", to: :upper_value,
|
|
28
|
+
polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
|
|
29
|
+
map_element "lowerValue", to: :lower_value,
|
|
30
|
+
polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
|
|
31
|
+
map_element "defaultValue", to: :default_value,
|
|
32
|
+
polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
|
|
30
33
|
end
|
|
31
34
|
end
|
|
32
35
|
end
|
|
@@ -2,21 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
class OwnedLiteral <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
8
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
5
|
+
class OwnedLiteral < Base
|
|
9
6
|
attribute :name, :string
|
|
10
7
|
attribute :uml_type, Uml::Type
|
|
11
8
|
|
|
12
9
|
xml do
|
|
13
10
|
root "ownedLiteral"
|
|
14
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
15
|
-
|
|
16
|
-
map_attribute "type", to: :type
|
|
17
|
-
map_attribute "id", to: :id
|
|
18
11
|
map_attribute "name", to: :name
|
|
19
|
-
|
|
20
12
|
map_element "type", to: :uml_type
|
|
21
13
|
end
|
|
22
14
|
end
|
|
@@ -2,18 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
class OwnedOperation <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
5
|
+
class OwnedOperation < Base
|
|
8
6
|
attribute :name, :string
|
|
7
|
+
attribute :visibility, :string
|
|
8
|
+
attribute :is_static, :boolean
|
|
9
|
+
attribute :is_abstract, :boolean
|
|
10
|
+
attribute :is_query, :boolean
|
|
11
|
+
attribute :concurrency, :string
|
|
9
12
|
attribute :owned_parameter, OwnedParameter, collection: true
|
|
10
13
|
attribute :precondition, Precondition
|
|
11
14
|
attribute :uml_type, Uml::Type, collection: true
|
|
12
15
|
|
|
13
16
|
xml do
|
|
14
17
|
root "ownedOperation"
|
|
15
|
-
map_attribute "id", to: :id
|
|
16
18
|
map_attribute "name", to: :name
|
|
19
|
+
map_attribute "visibility", to: :visibility
|
|
20
|
+
map_attribute "isStatic", to: :is_static
|
|
21
|
+
map_attribute "isAbstract", to: :is_abstract
|
|
22
|
+
map_attribute "isQuery", to: :is_query
|
|
23
|
+
map_attribute "concurrency", to: :concurrency
|
|
17
24
|
map_element "ownedParameter", to: :owned_parameter, value_map: VALUE_MAP
|
|
18
25
|
map_element "precondition", to: :precondition
|
|
19
26
|
map_element "type", to: :uml_type, value_map: VALUE_MAP
|
|
@@ -2,28 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
class OwnedParameter <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
5
|
+
class OwnedParameter < Base
|
|
8
6
|
attribute :name, :string
|
|
9
7
|
attribute :type, ::Xmi::Type::XmiType
|
|
10
8
|
attribute :direction, :string
|
|
11
|
-
attribute :
|
|
12
|
-
attribute :
|
|
13
|
-
attribute :
|
|
9
|
+
attribute :visibility, :string
|
|
10
|
+
attribute :is_ordered, :boolean
|
|
11
|
+
attribute :is_unique, :boolean
|
|
12
|
+
attribute :effect, :string
|
|
13
|
+
attribute :upper_value, ValueSpecification, polymorphic: true
|
|
14
|
+
attribute :lower_value, ValueSpecification, polymorphic: true
|
|
15
|
+
attribute :default_value, ValueSpecification, polymorphic: true
|
|
14
16
|
|
|
15
17
|
xml do
|
|
16
18
|
root "ownedParameter"
|
|
17
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
18
|
-
|
|
19
|
-
map_attribute "id", to: :id
|
|
20
19
|
map_attribute "name", to: :name
|
|
21
20
|
map_attribute "type", to: :type
|
|
22
21
|
map_attribute "direction", to: :direction
|
|
22
|
+
map_attribute "visibility", to: :visibility
|
|
23
|
+
map_attribute "isOrdered", to: :is_ordered
|
|
24
|
+
map_attribute "isUnique", to: :is_unique
|
|
25
|
+
map_attribute "effect", to: :effect
|
|
23
26
|
|
|
24
|
-
map_element "upperValue", to: :upper_value
|
|
25
|
-
|
|
26
|
-
map_element "
|
|
27
|
+
map_element "upperValue", to: :upper_value,
|
|
28
|
+
polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
|
|
29
|
+
map_element "lowerValue", to: :lower_value,
|
|
30
|
+
polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
|
|
31
|
+
map_element "defaultValue", to: :default_value,
|
|
32
|
+
polymorphic: VALUE_SPECIFICATION_POLYMORPHIC_MAP
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|
|
@@ -2,18 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
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
|
-
|
|
17
5
|
class PackageImport < Lutaml::Model::Serializable
|
|
18
6
|
attribute :id, ::Xmi::Type::XmiId
|
|
19
7
|
attribute :imported_package, ImportedPackage
|
|
@@ -2,11 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
# Shared polymorphic dispatch map for any attribute whose value
|
|
6
|
+
# is a PackagedElement dispatched on `xmi:type`. Used by the
|
|
7
|
+
# packaged_element recursion on PackagedElement itself, and by
|
|
8
|
+
# UmlModel.packaged_element.
|
|
9
|
+
#
|
|
10
|
+
# Phase A of TODO.next/01: subclasses are type tags on
|
|
11
|
+
# PackagedElement (no attrs narrowed). Phase B will narrow each
|
|
12
|
+
# subclass's attrs to its UML-2.5-conformant subset.
|
|
13
|
+
PACKAGED_ELEMENT_POLYMORPHIC_MAP = {
|
|
14
|
+
attribute: "xmi:type",
|
|
15
|
+
class_map: {
|
|
16
|
+
"uml:Class" => "Xmi::Uml::UmlClass",
|
|
17
|
+
"uml:Association" => "Xmi::Uml::Association",
|
|
18
|
+
"uml:AssociationClass" => "Xmi::Uml::AssociationClass",
|
|
19
|
+
"uml:Interface" => "Xmi::Uml::Interface",
|
|
20
|
+
"uml:InstanceSpecification" => "Xmi::Uml::InstanceSpecification",
|
|
21
|
+
"uml:DataType" => "Xmi::Uml::DataType",
|
|
22
|
+
"uml:PrimitiveType" => "Xmi::Uml::PrimitiveType",
|
|
23
|
+
"uml:Enumeration" => "Xmi::Uml::Enumeration",
|
|
24
|
+
"uml:Package" => "Xmi::Uml::Package",
|
|
25
|
+
"uml:Realization" => "Xmi::Uml::Realization",
|
|
26
|
+
"uml:Dependency" => "Xmi::Uml::Dependency",
|
|
27
|
+
"uml:Signal" => "Xmi::Uml::Signal",
|
|
28
|
+
"uml:Extension" => "Xmi::Uml::Extension",
|
|
29
|
+
"uml:Stereotype" => "Xmi::Uml::Stereotype",
|
|
30
|
+
"uml:Usage" => "Xmi::Uml::Usage",
|
|
31
|
+
},
|
|
32
|
+
}.freeze
|
|
33
|
+
|
|
34
|
+
class PackagedElement < Base
|
|
9
35
|
attribute :name, :string
|
|
36
|
+
attribute :visibility, :string
|
|
37
|
+
attribute :is_abstract, :boolean
|
|
38
|
+
attribute :is_leaf, :boolean
|
|
39
|
+
attribute :is_active, :boolean
|
|
40
|
+
attribute :classifier, :string
|
|
10
41
|
attribute :member_end, :string
|
|
11
42
|
attribute :member_ends, MemberEnd, collection: true
|
|
12
43
|
attribute :owned_literal, OwnedLiteral, collection: true
|
|
@@ -16,19 +47,24 @@ module Xmi
|
|
|
16
47
|
attribute :supplier, :string
|
|
17
48
|
attribute :client, :string
|
|
18
49
|
|
|
19
|
-
attribute :packaged_element, PackagedElement, collection: true
|
|
50
|
+
attribute :packaged_element, PackagedElement, collection: true,
|
|
51
|
+
polymorphic: true
|
|
20
52
|
attribute :owned_end, OwnedEnd, collection: true
|
|
21
53
|
attribute :owned_attribute, OwnedAttribute, collection: true
|
|
22
54
|
attribute :owned_comment, OwnedComment, collection: true
|
|
23
55
|
attribute :generalization, AssociationGeneralization, collection: true
|
|
56
|
+
attribute :interface_realization, InterfaceRealization, collection: true
|
|
57
|
+
attribute :slot, Slot, collection: true
|
|
58
|
+
attribute :specification, Specification
|
|
24
59
|
|
|
25
60
|
xml do
|
|
26
61
|
root "packagedElement"
|
|
27
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
28
|
-
|
|
29
|
-
map_attribute "type", to: :type
|
|
30
|
-
map_attribute "id", to: :id
|
|
31
62
|
map_attribute "name", to: :name
|
|
63
|
+
map_attribute "visibility", to: :visibility
|
|
64
|
+
map_attribute "isAbstract", to: :is_abstract
|
|
65
|
+
map_attribute "isLeaf", to: :is_leaf
|
|
66
|
+
map_attribute "isActive", to: :is_active
|
|
67
|
+
map_attribute "classifier", to: :classifier
|
|
32
68
|
map_attribute "memberEnd", to: :member_end
|
|
33
69
|
|
|
34
70
|
# EA specific
|
|
@@ -36,14 +72,18 @@ module Xmi
|
|
|
36
72
|
map_attribute "client", to: :client
|
|
37
73
|
|
|
38
74
|
map_element "generalization", to: :generalization, value_map: VALUE_MAP
|
|
75
|
+
map_element "interfaceRealization", to: :interface_realization,
|
|
76
|
+
value_map: VALUE_MAP
|
|
39
77
|
map_element "ownedComment", to: :owned_comment, value_map: VALUE_MAP
|
|
40
78
|
map_element "ownedEnd", to: :owned_end, value_map: VALUE_MAP
|
|
41
79
|
map_element "ownedLiteral", to: :owned_literal, value_map: VALUE_MAP
|
|
42
80
|
map_element "ownedAttribute", to: :owned_attribute, value_map: VALUE_MAP
|
|
43
81
|
map_element "ownedOperation", to: :owned_operation, value_map: VALUE_MAP
|
|
44
82
|
map_element "packagedElement", to: :packaged_element,
|
|
45
|
-
|
|
83
|
+
polymorphic: PACKAGED_ELEMENT_POLYMORPHIC_MAP
|
|
46
84
|
map_element "memberEnd", to: :member_ends, value_map: VALUE_MAP
|
|
85
|
+
map_element "slot", to: :slot, value_map: VALUE_MAP
|
|
86
|
+
map_element "specification", to: :specification
|
|
47
87
|
end
|
|
48
88
|
end
|
|
49
89
|
end
|
data/lib/xmi/uml/precondition.rb
CHANGED
|
@@ -2,20 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
class Precondition <
|
|
6
|
-
skip_reference_registration
|
|
7
|
-
attribute :id, ::Xmi::Type::XmiId
|
|
5
|
+
class Precondition < Base
|
|
8
6
|
attribute :name, :string
|
|
9
|
-
attribute :type, ::Xmi::Type::XmiType
|
|
10
7
|
attribute :specification, Specification
|
|
11
8
|
|
|
12
9
|
xml do
|
|
13
10
|
root "precondition"
|
|
14
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
15
|
-
|
|
16
|
-
map_attribute "id", to: :id
|
|
17
11
|
map_attribute "name", to: :name
|
|
18
|
-
map_attribute "type", to: :type
|
|
19
12
|
map_element "specification", to: :specification
|
|
20
13
|
end
|
|
21
14
|
end
|
data/lib/xmi/uml/profile.rb
CHANGED
|
@@ -2,37 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
module Xmi
|
|
4
4
|
module Uml
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Is this an EA thing?
|
|
17
|
-
attribute :metamodel_reference, :string
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
class Profile < Lutaml::Model::Serializable
|
|
23
|
-
skip_reference_registration
|
|
24
|
-
include ProfileAttributes
|
|
25
|
-
|
|
5
|
+
# UML `<Profile>` element (UML 2.5 §22.3). A stereotyped package
|
|
6
|
+
# that extends the UML metamodel. Carries owned comments, package
|
|
7
|
+
# imports, nested packaged elements, and profile-specific metadata
|
|
8
|
+
# (nsPrefix, metamodelReference).
|
|
9
|
+
class Profile < Base
|
|
10
|
+
attribute :name, :string
|
|
11
|
+
attribute :ns_prefix, :string
|
|
12
|
+
attribute :metamodel_reference, :string
|
|
13
|
+
attribute :packaged_element, PackagedElement, collection: true
|
|
14
|
+
attribute :package_import, PackageImport, collection: true
|
|
26
15
|
attribute :owned_comment, OwnedComment, collection: true
|
|
27
16
|
|
|
28
17
|
xml do
|
|
29
18
|
root "Profile"
|
|
30
|
-
namespace ::Xmi::Namespace::Omg::Uml
|
|
31
|
-
|
|
32
|
-
map_attribute "id", to: :id
|
|
33
19
|
map_attribute "name", to: :name
|
|
34
|
-
map_attribute "metamodelReference", to: :metamodel_reference
|
|
35
20
|
map_attribute "nsPrefix", to: :ns_prefix
|
|
21
|
+
map_attribute "metamodelReference", to: :metamodel_reference
|
|
36
22
|
|
|
37
23
|
map_element "ownedComment", to: :owned_comment, value_map: VALUE_MAP
|
|
38
24
|
map_element "packageImport", to: :package_import, value_map: VALUE_MAP
|