Standalone Ruby gem for parsing Sparx Enterprise Architect data files
(QEA SQLite database and Sparx XMI). Pure parse, optional bridge to
lutaml-uml for cross-vendor UML output and SPA generation.
gem install ea
For SPA generation (optional):
gem install ea lutaml-uml
Or in your Gemfile:
source "https://rubygems.org" gem "ea", "~> 0.2" gem "lutaml-uml", "~> 0.5" # optional: SPA + SVG diagram rendering
require "ea"
db = Ea.parse("model.qea") #=> Ea::Qea::Database
puts "#{db.packages.size} packages, #{db.objects.size} objects"Ea::Xmi.load parses an EA XMI export into the typed Sparx model.
Whole load is the default and parses the entire file:
require "ea/xmi"
model = Ea::Xmi.load("export.xmi")Partial load parses only the reference closure of the named elements.
The wanted pairs are [package, name]; a nil package matches by name
in any package. The closure is assembled in memory by
Ea::Xmi::Slicer — the export is streamed once, no temporary files
are written, and the parse runs over the slice:
model = Ea::Xmi.load("export.xmi", partial: [["bldg", "Building"]])Partial load produces the same content as whole load for everything derived from the model’s elements: the slice keeps each wanted class with its attributes, operations, connectors, generalization parents, package ancestry, and the diagrams that reference kept elements. Use it when reading a handful of classes out of a large export — a 100 MB export parses as a few MB slice instead of a 10+ GB object graph.
Ea::Xmi.load_graph wraps the same two modes one layer up, returning
the parsed EA graph: the parser, the parsed document, and the lookup
indexes the table renders resolve through
(Ea::Xmi::Loaded).
ea spa model.qea --output browser.htmlProduces a single-file Vue IIFE HTML (~300KB for a typical model) with package hierarchy, class details, and diagram navigation.
The ea gem has two layers:
|
Returns |
|
Converts |
|
Low-level QEA loader → |
|
Low-level XMI loader → |
|
Returns |
|
|
|
|
|
Generate single-page app from QEA/XMI/LUR |
|
List model elements (auto-detects QEA or XMI) |
|
List diagrams in a QEA/XMI file |
|
Render a diagram to SVG |
|
Validate EA model |
|
Show collection counts |
|
Parse to internal model representation |
|
Convert QEA → Sparx XMI |
|
Show gem version |
-
Sparx only: QEA format and Sparx-flavored XMI only. Does not parse MagicDraw or Papyrus XMI.
-
XMI parser: Parses
<xmi:Extension>blocks for Sparx-specific diagram metadata. Generic OMG XMI is handled by thexmigem.
git clone https://github.com/lutaml/ea cd ea bundle install bundle exec rspec # run specs (2036 examples) bundle exec ea help # see CLI commands