Class: Ea::Transformers::UmlToXmi::Transformer

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/transformers/uml_to_xmi/transformer.rb

Overview

Orchestrates transformation of a Lutaml::Uml::Document to Sparx XMI.

Walks the UML tree (packages → classifiers → features) and emits XML via Writer. Each UML element type has its own private emitter method.

This is the LOSSY path — Sparx-specific concepts (stereotypes, multiplicities, tagged values, EA extension block) are not modeled in Lutaml::Uml and therefore not emitted. For Sparx-to-Sparx round-trip with full fidelity, use QeaToXmi.

Constant Summary collapse

MODEL_NAME =
"EA_Model"

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ Transformer

Returns a new instance of Transformer.



18
19
20
21
22
# File 'lib/ea/transformers/uml_to_xmi/transformer.rb', line 18

def initialize(document)
  @document = document
  @id_gen = IdGenerator.new
  @writer = Writer.new
end

Instance Method Details

#serializeString

Returns XMI XML document.

Returns:

  • (String)

    XMI XML document



25
26
27
28
29
30
31
32
33
34
# File 'lib/ea/transformers/uml_to_xmi/transformer.rb', line 25

def serialize
  assign_ids!
  @writer.xmi_root do
    @writer.documentation
    @writer.uml_model(@id_gen.model_id, MODEL_NAME) do
      emit_top_level
    end
  end
  @writer.to_xml
end