Skip to content
Development · unreleased
Edition: dev
Documentation archive
MGL language reference

MGL language reference

MGL separates the meaning of a diagram from its presentation. This initial reference covers the declarations exercised by the executable field-guide examples.

Models and nodes

A model <id> { ... } block contains nodes and relations. Inside it, a node can be declared by its ID, followed by an optional bracketed label:

model system {
  api [API]
  database [Database]
}

Attributes use name: value inside a declaration’s property block. Application attributes such as role: service can be used by stylesheet selectors.

Relations

A relation connects nodes. Use -> for a directed relation, <-> for a bidirectional relation, or -- for an undirected relation. An optional prefix assigns an explicit ID:

query: api -> database [query]

Give an edge an explicit ID when you want to select that edge directly in a stylesheet. An anonymous edge can still be selected by the edge domain or its attributes.

Stylesheets

A stylesheet <id> { ... } block holds rules. Each rule pairs a selector with presentation properties. See the stylesheet guide.

Views

A view <id> { ... } block selects the model and stylesheet with explicit use statements. A module can contain multiple named views.

view overview {
  use model system
  use stylesheet blueprint
}

The CLI’s --view overview flag selects a view by name.

Complete executable example

The first diagram combines all these declarations. Module imports, containers, and additional language features will be covered as this reference expands.