Skip to content

ElkEngine: in-process diagram layout; SVG conformance gate - #54

Merged
ronaldtse merged 2 commits into
mainfrom
feat/elk-engine
Oct 7, 2026
Merged

ronaldtse merged 2 commits into
mainfrom
feat/elk-engine

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Closes #51. Closes #52.

#51 ElkEngine — in-process diagram layout via elkrb (pure-Ruby ELK):

  • Formatter::Elk builds an Elkrb::Graph from the document (a node per classifier labelled with name/definition/members; edges for associations and class parents), lays it out through Elkrb::LayoutEngine (layered) and renders standalone SVG — nodes as rounded rects with text labels, edges as polylines with per-member_end_type arrow markers
  • lutaml generate --layout elk selects it; graphviz remains the default — zero behavior change for existing users
  • elkrb is a soft dependency (Gemfile-only): Formatter::Elk raises with installation guidance without it. Whether to promote it into the gemspec is a separate decision — noted for review
  • marker vocabulary isolated in ElkSvgMarkers; the SVG emitter is the piece elkrb itself lacks

#52 conformance gate — every full-document RS 3001 corpus fixture renders through the ELK engine and validates against svg_conform's base profile in CI; nokogiri joins the Gemfile as svg_conform's adapter requirement. Skips cleanly where the gem is absent.

685→713 examples (5 ELK + 25 gates), 0 failures; lint clean on all new files; matrix runs with dot absent exercised the in-process path.

Formatter::Elk builds an Elkrb::Graph from the document (a node per
classifier labelled with name, definition and members; edges for
associations and class parents), lays it out in-process through
Elkrb::LayoutEngine (pure-Ruby ELK, layered algorithm) and renders
standalone SVG (nodes as rounded rects with text labels, edges as
polylines with per-type arrow markers). No external tools.

The `lutaml generate --layout elk` CLI option selects it; graphviz
remains the default. elkrb is a soft dependency (Gemfile-only for now):
without it, Formatter::Elk raises with installation guidance — whether
to promote it to a gemspec dependency is a separate decision.

The marker vocabulary lives in ElkSvgMarkers; the renderer emits
conformance-shaped SVG (well-formed XML, escaped text, marker defs).
…#52)

Every full-document RS 3001 corpus fixture renders through the ELK
engine and validates against svg_conform's base profile in CI, so
engine or platform regressions surface as spec failures. Runs wherever
the svg_conform gem is present (skipped otherwise); nokogiri joins the
Gemfile as svg_conform's lutaml-model XML adapter requirement.

Also: the graph builder scopes entity collection defensively
(packages lack `primitives`).
@ronaldtse
ronaldtse merged commit 17cd081 into main Oct 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conformance-gate generated diagrams (svg_conform + png_conform in CI) ElkEngine: in-process diagram layout via elkrb (drop the hard dot dependency)

1 participant