Skip to content

QEA→XMI export does not match EA's output #32

Description

@ronaldtse

Problem

bundle exec ea export xmi model.qea does not produce the same output as Sparx EA's XMI export. The task is to make it match — every element, every attribute, every value that EA emits must also appear in our output.

"Whatever we don't have means we are wrong."

How to measure

Element-by-element comparison by xmi:id against EA's reference exports in examples/exports/*/model.xml. Two outputs are equivalent when:

  1. Every xmi:id in EA's reference appears in ours (no missing elements).
  2. Every xmi:id in ours appears in EA's reference (no spurious elements).
  3. For each common xmi:id, the element name and all attribute values match (attribute order irrelevant).

Tag-count parity is meaningless — <connector> appearing 72 times in both means nothing if the 72 IDs don't match.

Current defects

Comparison on examples/qea/basic.qea vs examples/exports/basic/model.xml:

Metric Value
IDs only in ours 421
IDs only in EA's 368
Common IDs with mismatched attributes 237 / 409

Defect 1: Wrong synthesized ID numbering

Elements like <lowerValue>, <upperValue>, <slot>, <value> get IDs in the form EAID_LI000001__{parent_guid_tail}. The format is right, but the counter assignment is wrong — our LI000001 maps to a different attribute than EA's LI000001 because we walk the model tree in a different order.

To fix: Reverse-engineer EA's exact walk order (sort by tpos? by Object_ID? depth-first with what sibling ordering?) and match it. Verify by checking that every EAID_LI* ID in EA's reference resolves to the same owning element in ours.

Defect 2: Missing elements on complex models

Element coverage collapses for models that use MDG stereotypes:

Model packagedElement (ours / EA) Missing
test.qea 12 / 80 68 missing
simple.qea 11 / 38 27 missing
ArcGISWorkspace_template.qea 8 / 84 76 missing
UmlModel_template.qea 1 / 2 1 missing

To fix: Diff our output against EA's reference for each model. For every element in EA's output that we don't produce, determine where the data comes from in the QEA database (or the registered MDG) and emit it. Likely sources: nested MDG profile content, stereotype application elements, cross-package references.

Defect 3: visibility="private" not emitted on some attributes

Some <ownedAttribute> elements in EA's output carry visibility="private" where ours emits no visibility attribute. We currently omit visibility when t_attribute.scope is blank, but EA marks these Private. Either EA derives scope from a different column (t_attribute.flags? t_object.scope?), or Private is the implicit default for attributes and we should emit it when scope is blank.

To fix: Pick an attribute where EA says Private and ours says nothing. Read every column of that attribute's row in the QEA. Find where "Private" is encoded. Emit it.

Defect 4: <xrefs> blocks are empty

EA emits populated <xrefs> blocks inside <element> and <attribute> entries in the <xmi:Extension> section, carrying cross-reference metadata (stereotype applications, traceability, custom properties). We emit empty <xrefs/> placeholders.

To fix: Walk t_xref for each element. Parse the @STEREO, @PROP, @CUSTOM mini-language blocks. Emit each as an <xref> entry matching EA's shape.

Defect 5: Diagram placement metadata is incomplete

Our <element subject="..." geometry="..."/> inside <diagram><elements> is missing attributes EA emits: sequence, instancesize, styleex, listorder, visibility flags.

To fix: For each row in t_diagramobjects, emit every column that EA includes on the placed <element> — not just subject and geometry.

Defect 6: Round-trip is unverified

We have not verified that EA can re-import our XMI without data loss. This is the ultimate acceptance test.

To fix: Add a CI step that imports our output back into a fresh EA instance (or a scripted EA CLI), re-exports, and diffs against the original reference. Any divergence is a defect.

Non-defects (infrastructure already correct)

These were investigated and are NOT bugs — listed so contributors don't re-investigate:

  • XMI namespace URI is http://www.omg.org/spec/XMI/20110701 (matches EA).
  • Default attribute values (visibility="public", isAbstract="false", concurrency="sequential", direction="in") are correctly omitted.
  • exporterID="1624" is present on <xmi:Documentation>.
  • aggregation on <ownedEnd> is read from sourceisaggregate/destisaggregate (correct integer column, not the string sourcecontainment).
  • MDG stereotype definitions (the <uml:Stereotype> + <uml:Extension> blocks) are emitted when an MDG is registered.

Reproducing

bundle exec ea export xmi examples/qea/basic.qea --output /tmp/ours.xmi

ruby -e '
require "nokogiri"
ours = Nokogiri::XML(File.read("/tmp/ours.xmi")).xpath("//*[@xmi:id]")
ref  = Nokogiri::XML(File.read("examples/exports/basic/model.xml")).xpath("//*[@xmi:id]")
ours_ids = ours.map { |e| e["xmi:id"] }
ref_ids  = ref.map { |e| e["xmi:id"] }
puts "Only in ours: #{(ours_ids - ref_ids).size}"
puts "Only in EA:   #{(ref_ids - ours_ids).size}"
puts "Common:       #{(ours_ids & ref_ids).size}"
'

Acceptance

For every .qea file in examples/qea/:

  • Only in ours count is 0 (or documented intentional addition).
  • Only in EA count is 0.
  • Common with mismatched attributes count is 0.
  • Round-trip through EA produces equivalent output.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions