Module: Xmi::Uml

Defined in:
lib/xmi/uml.rb,
lib/xmi/uml/base.rb,
lib/xmi/uml/slot.rb,
lib/xmi/uml/type.rb,
lib/xmi/uml/usage.rb,
lib/xmi/uml/bounds.rb,
lib/xmi/uml/signal.rb,
lib/xmi/uml/diagram.rb,
lib/xmi/uml/package.rb,
lib/xmi/uml/profile.rb,
lib/xmi/uml/waypoint.rb,
lib/xmi/uml/component.rb,
lib/xmi/uml/data_type.rb,
lib/xmi/uml/extension.rb,
lib/xmi/uml/interface.rb,
lib/xmi/uml/owned_end.rb,
lib/xmi/uml/uml_class.rb,
lib/xmi/uml/uml_model.rb,
lib/xmi/uml/dependency.rb,
lib/xmi/uml/member_end.rb,
lib/xmi/uml/stereotype.rb,
lib/xmi/uml/association.rb,
lib/xmi/uml/enumeration.rb,
lib/xmi/uml/lower_value.rb,
lib/xmi/uml/realization.rb,
lib/xmi/uml/upper_value.rb,
lib/xmi/uml/literal_null.rb,
lib/xmi/uml/precondition.rb,
lib/xmi/uml/default_value.rb,
lib/xmi/uml/owned_comment.rb,
lib/xmi/uml/owned_element.rb,
lib/xmi/uml/owned_literal.rb,
lib/xmi/uml/specification.rb,
lib/xmi/uml/literal_string.rb,
lib/xmi/uml/package_import.rb,
lib/xmi/uml/primitive_type.rb,
lib/xmi/uml/literal_boolean.rb,
lib/xmi/uml/literal_integer.rb,
lib/xmi/uml/owned_attribute.rb,
lib/xmi/uml/owned_operation.rb,
lib/xmi/uml/owned_parameter.rb,
lib/xmi/uml/imported_package.rb,
lib/xmi/uml/packaged_element.rb,
lib/xmi/uml/annotated_element.rb,
lib/xmi/uml/association_class.rb,
lib/xmi/uml/opaque_expression.rb,
lib/xmi/uml/profile_application.rb,
lib/xmi/uml/value_specification.rb,
lib/xmi/uml/interface_realization.rb,
lib/xmi/uml/instance_specification.rb,
lib/xmi/uml/literal_unlimited_natural.rb,
lib/xmi/uml/association_generalization.rb,
lib/xmi/uml/profile_application_applied_profile.rb

Defined Under Namespace

Classes: AnnotatedElement, Association, AssociationClass, AssociationGeneralization, Base, Bounds, Component, DataType, DefaultValue, Dependency, Diagram, Enumeration, Extension, ImportedPackage, InstanceSpecification, Interface, InterfaceRealization, LiteralBoolean, LiteralInteger, LiteralNull, LiteralString, LiteralUnlimitedNatural, LowerValue, MemberEnd, OpaqueExpression, OwnedAttribute, OwnedComment, OwnedElement, OwnedEnd, OwnedLiteral, OwnedOperation, OwnedParameter, Package, PackageImport, PackagedElement, Precondition, PrimitiveType, Profile, ProfileApplication, ProfileApplicationAppliedProfile, Realization, Signal, Slot, Specification, Stereotype, Type, UmlClass, UmlModel, UpperValue, Usage, ValueSpecification, Waypoint

Constant Summary collapse

PACKAGED_ELEMENT_POLYMORPHIC_MAP =

Shared polymorphic dispatch map for any attribute whose value is a PackagedElement dispatched on xmi:type. Used by the packaged_element recursion on PackagedElement itself, and by UmlModel.packaged_element.

Fallback contract: an unknown xmi:type resolves to Xmi::Uml::PackagedElement (the union-bag base) via the class_map's Hash default value. This avoids the lutaml-model Object.const_get(nil) TypeError when a Sparx XMI emits a type we haven't modelled yet, at the cost of treating the element as generic. polymorphic_map_contract_spec and polymorphic_robustness_spec lock in the graceful-fallback behavior.

Two paths land at the base:

  1. Missing discriminator — lutaml-model's polymorphic_map_defined? (lib/lutaml/model/attribute.rb) short-circuits and returns the declared attribute type (PackagedElement). The class_map default is not consulted.
  2. Unknown discriminator — polymorphic_map_defined? is true, the class_map lookup hits a missing key, and the Hash default value supplies the fallback class name.
{
  attribute: "xmi:type",
  class_map: Hash.new("Xmi::Uml::PackagedElement").merge!(
    "uml:Class" => "Xmi::Uml::UmlClass",
    "uml:Association" => "Xmi::Uml::Association",
    "uml:AssociationClass" => "Xmi::Uml::AssociationClass",
    "uml:Interface" => "Xmi::Uml::Interface",
    "uml:InstanceSpecification" => "Xmi::Uml::InstanceSpecification",
    "uml:DataType" => "Xmi::Uml::DataType",
    "uml:PrimitiveType" => "Xmi::Uml::PrimitiveType",
    "uml:Enumeration" => "Xmi::Uml::Enumeration",
    "uml:Package" => "Xmi::Uml::Package",
    "uml:Realization" => "Xmi::Uml::Realization",
    "uml:Dependency" => "Xmi::Uml::Dependency",
    "uml:Signal" => "Xmi::Uml::Signal",
    "uml:Extension" => "Xmi::Uml::Extension",
    "uml:Stereotype" => "Xmi::Uml::Stereotype",
    "uml:Usage" => "Xmi::Uml::Usage",
    "uml:Component" => "Xmi::Uml::Component",
  ).freeze,
}.freeze
VALUE_SPECIFICATION_POLYMORPHIC_MAP =

Shared polymorphic dispatch map for any attribute whose value is a ValueSpecification dispatched on xmi:type. Consumers: Slot#value, OwnedAttribute#upper_value/#lower_value/#default_value, OwnedEnd#upper_value/#lower_value/#default_value, OwnedParameter#upper_value/#lower_value/#default_value.

The literal class names are string form because lutaml-model's resolve_polymorphic_class calls Object.const_get on the value.

Fallback contract: an unknown xmi:type resolves to Xmi::Uml::ValueSpecification (the abstract base) via the class_map's Hash default value. polymorphic_map_contract_spec and polymorphic_robustness_spec lock in the graceful-fallback behavior.

Two paths land at the base (see PACKAGED_ELEMENT_POLYMORPHIC_MAP for the full rationale): missing discriminator short-circuits via lutaml-model's polymorphic_map_defined?; unknown discriminator hits the Hash default value.

{
  attribute: "xmi:type",
  class_map: Hash.new("Xmi::Uml::ValueSpecification").merge!(
    "uml:OpaqueExpression" => "Xmi::Uml::OpaqueExpression",
    "uml:LiteralString" => "Xmi::Uml::LiteralString",
    "uml:LiteralInteger" => "Xmi::Uml::LiteralInteger",
    "uml:LiteralBoolean" => "Xmi::Uml::LiteralBoolean",
    "uml:LiteralUnlimitedNatural" => "Xmi::Uml::LiteralUnlimitedNatural",
    "uml:LiteralNull" => "Xmi::Uml::LiteralNull",
  ).freeze,
}.freeze