Skip to content

Notations and views

Audience: everyone who edits models · ~10 min read · Prerequisites: Editor basics

The same state machine shown as text

What it is

A model is a tree. The tree never changes shape when you look at it differently. A notation is one way of drawing that tree. The default notation of most concepts is plain structured text, but a concept can also draw its content as a table, a diagram, two-dimensional maths, or a decision table. A few notations are only views: switching between them never edits your model and is never saved in the file. Separately, the Surface and FullForm panes show the whole model as text, in two different spellings. (See the glossary for concept, node and slot.)

When you'd use it

  • A concept offers a second view, for example a table of its rows or a diagram of its steps, and you want to read or edit the data that way.
  • You want to see the real text that is stored on disk (Surface), or the canonical form used for copy and import (FullForm).
  • You want to paste a program from outside, or copy one out, as text.

The five kinds of notation

Kind What you see Example in the bundled samples
Structured text Keywords and cells in lines, indented for blocks Almost every model, for example Guess the number
Table Rows and columns of cells; each cell is a normal editable cell The table view in Notation switching demo
Diagram Boxes joined by arrows, laid out automatically Flow diagram, CI/CD pipeline (big diagram), Build pipeline dashboard
Maths Fractions, powers, roots, sums, matrices in textbook layout (drawn with MathML) Math Notation (2D formula demo)
Decision table A table of conditions and results with an "otherwise" row Decision table

Which concepts offer which notation is decided by the language, not by the editor. Whether a node can be shown another way depends on its concept.

Switching the notation of a node

A line that holds a node with alternative notations has a faint dotted underline under its line number; point at the number and the tooltip names the notations ("Notations: table, diagram"). There is no button on the node itself.

  1. Put the cursor in the node (or inside it) and press Alt+Enter: the list offers Show as table, Show as diagram, Show default and so on, and marks the one you are in.
  2. Or press Ctrl+Alt+V (Cmd+Alt+V on a Mac). This cycles to the next notation; after the last one it returns to the default. It acts on the nearest node around the cursor that has alternatives; if nothing happens, none does.
  3. Or right-click the node and choose Switch Notation. The submenu lists Default and each notation by name. The active one has a filled dot. Pick one to jump straight to it.

The Switch Notation submenu in the editor's context menu

A notation choice is a view setting

The choice is remembered only while the model stays open in that editor. It is not written to the model file, not shared with collaborators, and it is not an undoable edit. Edits you make inside any notation are real edits and can be undone.

A few notations only apply to certain file grammars. For example, Core's comment offers a /* … */ block form only in models stored with the JavaScript grammar. If a notation does not fit the model's grammar it is not offered.

Tables

A state machine drawn as a table

A table notation lays one list of child nodes out as rows. Each column is one slot of the row's concept. All cells are ordinary editable cells, so typing, completion and Tab work as everywhere else.

  • If the table is filterable, a Filter… box sits under each column header. Typing in it hides rows that do not match. While a filter is active you cannot shift-click to select a range of rows.
  • If the table has a footer button, + Add row appends a new empty row. Without that button you add rows with Enter inside a cell, as in the text notation.
  • A × button on a row (tooltip Delete row) removes it.

Diagrams

The same state machine as a diagram, with the diagram toolbar

A diagram draws a list of nodes as boxes and the references between them as arrows. Small diagrams fit the editor. Diagrams bigger than about 830 by 545 pixels switch to a pannable, zoomable canvas with a minimap.

Mouse and keyboard on the canvas:

Action What it does
Click a box Selects it
Drag a box Moves it. The position is saved in the model if the concept has x and y slots; otherwise the diagram lays itself out
Drag the background Pans a large diagram
Shift+drag the background Draws a selection rectangle around several boxes
Delete or Backspace Deletes the selected box or boxes
Arrow keys Pan a large diagram (not while you are typing in a box's label)
Ctrl+K / Cmd+K Opens the diagram's own action list, with a search box
A language's shortcut key (for example N for Add step in the Flow diagram) Runs that action while the diagram has the focus
Esc Closes the open menu (the right-click menu, ⋯, Layout or Change Shape), leaves fullscreen, or clears a multi-selection. Pressing anywhere outside an open menu closes it too
Right-click a box Add Step After, Move Left/Right/Up/Down, Shape: ... (Rectangle, Ellipse, Diamond or Hexagon: every shape the box does not have now), Delete. Edit Label and Connect to… are on the bar above the selected box.

The header above the diagram has two zones. On the left, in a tinted zone named after the language element (for example FlowDiagram), are the buttons that language adds for its own diagrams, such as Add step. On the right are the controls every diagram has. Tooltips show the names, and the header fades while the pointer is elsewhere. The Tab key stops once on the header, the arrow keys move between its buttons, and Esc returns to the diagram.

Control What it does
− / percentage / + Zoom out, reset zoom (the percentage is the current zoom; on a large diagram it is "Reset pan/zoom (fit to screen)"), zoom in
Layout, and the arrow beside it Arranges the boxes automatically. The arrow opens the direction (top to bottom or left to right) and the engine (built-in or ELK). The choice is used by the next Layout
Fullscreen Fills the editor area. The header becomes a column of buttons on the left, and the step numbers appear on the boxes, because the line numbers are covered. Exit with Esc
⋯ Opens all actions, grouped, with a search box (also Ctrl+K). Press P on an action, or click its pin, to put it on the header. Pins are remembered for all diagrams

The ⋯ list holds the rest: Open in New Window (on the same model even if you have opened another project since), Right-Angle Edges (switches the arrows between right-angled and straight routing, not saved), Span Full Editor Width (lets a tall diagram grow to the width of the editor instead of shrinking to fit its height; remembered for all diagrams), Export SVG, Collapse All Groups and Expand All Groups, and the actions for the selected box. A toggle shows a check mark, and the same button on the header shows as pressed. In a read-only model the actions that change the model are left out.

A language can also mark its own actions as secondary. Those are only in the ⋯ list, under the language's heading, until you pin them.

Where a step can go is drawn on the canvas, for languages that can add a step (the Flow diagram can):

  • A dashed + Add step under the last step adds a step at the end of the flow.
  • Hover an arrow and a dashed + appears on it. It puts a new step between the two steps the arrow joined.
  • Select a box and a + appears beside it. It adds a step after that box and draws the arrow.

A small bar appears above the selected box with Edit Label, Change Shape (a list of the four shapes with the current one checked, each with a line on what the shape means: a task, a start or an end, a decision, a split or a join), Connect to… (then click the box to connect to, or press [ / ] and Enter; clicking the same box or the empty canvas cancels), Add Step After and Delete Step. It is a toolbar of its own: Tab reaches it and the arrow keys move along it.

A box can have one of four shapes. Pick it with Change Shape on the bar above the selected box, Shape: ... from the right-click menu, or the ⋯ list.

Shape Use it for
Rectangle A task. This is the default
Ellipse A start or an end
Diamond A decision. Give each arrow leaving it a label, such as edge(approved, "yes")
Hexagon A parallel split (several paths leave it at once) or a join (all of them must arrive before it goes on)

In a diagram that has a diamond, every box is a little taller so the labels fit.

Maths notation

Formulas drawn as 2D maths

The Math Notation (2D formula demo) sample shows expressions the way a textbook draws them: a fraction has the numerator over the denominator, a sum has its limits above and below, a matrix is a grid. The editor uses the browser's MathML engine for this. You still edit with the keyboard: Tab and the arrow keys move between the parts of a formula, and typing fills cells as usual. Parentheses grow to the height of what they contain.

Decision tables

A first-match decision table

A decision table is a table of conditions and results that stands where an expression would. The editor reads the rows from top to bottom and uses the result of the first row whose condition is true. If no row matches, the otherwise row is used. Consecutive rows with the same literal result are merged into one tall cell. A row group nests more rows under one shared condition. See the Decision table sample for four worked tables (grades, tax brackets, shipping, HTTP status).

The Surface and FullForm panes

These two panes show the whole open root as text, and they update while you edit the model.

The Surface pane next to the editor

Pane Open it with What it shows
Surface View > Tool Windows > Surface, or Toggle Surface (Ctrl/Cmd+K, V, S) The model as ordinary source text. For Core this is Python. This is the text stored in the .model.py file
FullForm View > Tool Windows > FullForm, or Toggle FullForm (Ctrl/Cmd+K, V, F) The canonical text form (KDL) with every node written out, with completion for concept and slot names

The FullForm pane

Both live together in one tool with two tabs, Surface and Full form. Each has buttons at the bottom: Load Surface or Load FullForm, and Copy (the whole pane text to the clipboard); the Surface tab also has Auto-detect & import, which loads the text as FullForm or surface text, whichever it looks like. You can edit the text in the pane and press the button to replace the model with what you typed. Load Surface replaces the whole open root. The text parser recovers from mistakes by silently leaving out any code it does not understand, and the button does not warn you. Load FullForm reports a "KDL parse error" in the Messages panel instead. Copy the original text somewhere safe before you load edited text.

Copying, exporting and pasting as text

Command Menu What it does
Copy as Surface Text Edit > Copy > Copy Surface Puts the focused node as source text on the clipboard (Ctrl/Cmd+K, E, S)
Copy as FullForm Edit > Copy > Copy FullForm The same as FullForm (Ctrl/Cmd+K, E, F)
Copy as JSON Edit > Copy > Copy as JSON The same as JSON (Ctrl/Cmd+K, E, J)
Copy Node ID Edit > Copy > Copy Node ID Copies the node's number (Ctrl/Cmd+K, E, N)
Paste Edit > Paste Reads the clipboard as Surface or FullForm, whichever it looks like
Export Model as LionWeb…, Export Language as LionWeb… File > Export Saves the model, or its language, as a LionWeb chunk for other language workbenches. The language needs a namespace. The node ids of a model export are kept in the model's model.json (lionweb.ids), so exporting again after edits keeps the ids of nodes that did not move. strukts lionweb export reads the same ids
Import from LionWeb… File > Import Reads a LionWeb chunk. A model chunk adds its roots to the open model, read in that model's own language (a chunk in another language is refused); things the language cannot hold are left out and counted in the message, and when the model had no roots the chunk's node ids are kept in model.json, so exporting again gives the nodes the ids they came with. A language chunk installs its languages with your own languages, except any whose namespace or name is already installed, which are never replaced
Push Model to LionWeb Server…, Pull from LionWeb Server… File > Export, File > Import Sends the open model to a LionWeb repository (it asks for the address, the repository and, if the server wants one, a token, which is kept only until you close the app), or adds a partition of the repository to the open model. Nodes get their ids from the server and the ids are kept in model.json, so pushing again updates the same nodes. A partition that is already there is written over only after you confirm, unless this model put it there
Start Live Sync with LionWeb Server…, Stop Live Sync with LionWeb Server File > Export Keeps the open model equal to its partition on the repository while you and others edit: your edits are sent as you make them, the others' edits appear in your editor. The model must have been pushed first and have one root. If your model and the server's differ when you start, you choose which wins. Two people changing the same node at the same moment end with whichever the server saw last; if two people change the same list of children at the same moment, one change may be refused, and then your editor shows the server's version and says so. The server's own token does not protect this live connection; use it only on a server you trust
Export as JSON, Export Surface…, Export FullForm… File > Export (menu labels Export as JSON, Export as Surface Form, Export as Full Form) Writes the whole model out. The JSON export holds only the tree (each node's concept name and children), nothing else, and reads back with the same structure. Export as Model Surface Text (Ctrl/Cmd+K, F, M) is also in the command palette

Command labels for the text commands

Palette command names (press F1): Copy as Surface Text, Copy as FullForm, Copy as JSON, Copy Whole Program (Surface), Copy Whole Program (FullForm), Export Surface…, Export FullForm…, Export Model as LionWeb…, Export Language as LionWeb…, Import from LionWeb…, Push Model to LionWeb Server…, Pull from LionWeb Server…, Start Live Sync with LionWeb Server…, Stop Live Sync with LionWeb Server, Export as JSON, Toggle Surface, Toggle FullForm.

Every control

# Button/Option What it does Shortcut Gotcha
1 Cycle Notation (keyboard) Cycles to the next notation of the node around the cursor Ctrl/Cmd+Alt+V with the cursor in the node Does nothing if no node around the cursor has alternatives. The choice is not saved
2 Switch Notation (context menu) Jumps to a named notation, or Default Right-click Hidden if the node has no alternatives
3 Filter… box (table) Hides rows that do not match None Only on filterable tables. Blocks shift-click row ranges while active
4 + Add row (table) Adds an empty row None Not every table has it
5 × (table row) Deletes the row None Tooltip Delete row
6 Zoom −, percentage, + (diagram) Zooms the diagram or fits it to the screen None On large diagrams the middle button is a fit-to-screen button
7 Fullscreen (diagram) Fills the editor area. The header becomes a left column and step numbers appear on the boxes Esc leaves
8 Layout (diagram), with the direction and engine arrow Auto-arranges the boxes with the chosen direction and engine None Overwrites box positions the concept stores
9 Export SVG (diagram) Saves the diagram as an SVG image None
10 ⋯ (diagram) Searchable list of all diagram commands Ctrl/Cmd+K Only while the diagram has focus
11 Toggle Surface Shows or hides the Surface tab Ctrl/⌘+K, V, S In a browser some Ctrl+Shift combinations can be taken by the browser; use the menu
12 Toggle FullForm Shows or hides the FullForm tab Ctrl/⌘+K, V, F The standalone web page uses this key for Search Everywhere instead
13 Load Surface / Load FullForm Replaces the model with the pane's text None Replaces content. Surface loading silently drops code it cannot parse; FullForm loading reports an error
13b Auto-detect & import / Copy (pane buttons) Load the text as FullForm or surface, whichever it looks like; copy the whole pane text None Auto-detect replaces the open root, like Load Surface
14 Copy Surface and the other Copy submenu items Put the focused node on the clipboard as text See the table above Copy acts on the focused node, not the whole file
15 File > Export items Write the whole model to a file See the table above