Skip to main content

The expression console

This document was generated using AI assistance

Content may include inaccuracies, outdated information, or technical errors. Users are advised to cross-check critical information before implementation.

An expression answers a question about a model: does this element have a name, which processes does this component realize. Two of the five languages also change the model.

The console runs expressions on the selected object and saves nothing.

Expression mode

  1. Open the Assistant panel.
  2. Open the language switch under the input field. The first entry is Chat; below it are Acceleo Query Language (AQL), Object Constraint Language (OCL), Epsilon Object Language (EOL), Common Expression Language (CEL) and SPARQL.
  3. Pick AQL.

The input field highlights the syntax and the send button becomes a run button. The choice of language is kept for the next query.

A query

Select an ArchiMate application component in the model explorer and run:

self.outgoingRelationships
->select(r | r.oclIsKindOf(archimate::RealizationRelationship))
->collect(r | r.target)

self is the object selected in the model explorer at the moment you run the query, or the root of the current model when nothing is selected. Every expression has it, whatever the language; in SPARQL it is called ?self.

The answer streams into the conversation, one element per line. A model object appears as a label with its type - Label (BusinessProcess) - and it is a link: click it and the object is revealed and selected.

The console with an AQL query and its result: the elements the selected component realizes

KeyWhat it does
EnterRun the query, or accept the selected suggestion
Shift+EnterInsert a line break
Up, DownRecall the previous or next query

Completion is available in AQL, OCL and SPARQL. Errors are underlined as you type and the first one is written out under the field; while the query holds an error, the run button is disabled.

Choosing a language

LanguageWhat it is written forReadsChangesCompletionChecked before running
AQLNavigating the model, expression fields of a metamodelYesNoYesYes, statically typed
OCLInvariants in validation rulesYesNoYesYes, statically typed
EOLQuick fixes and other changes to a modelYesYesNoSyntax
CELCompact checks with C-like operatorsYesNoNoSyntax and result type
SPARQLQueries over the model as RDF, and updatesYesYesYesSyntax, and ASK where a boolean is required

Only EOL and SPARQL Update change the model, so quick fixes are written in them.

A reading body differs from a changing one by its own shape, not only by the language. An EOL body with the statement separator ; is a program that changes the model; without the separator it is a single expression evaluated for its value. In SPARQL, SELECT, ASK, CONSTRUCT and DESCRIBE read, and UPDATE writes.

Changing the model

Pick EOL and write a body that changes the model. A checkbox Apply changes appears next to the language switch, and running the query starts a task named Model modification.

  • Cleared - preview first: the run pauses and lists the changes without writing anything.
  • Checked - the changes are applied straight away.

The preview has one row per change, starting with its kind: CREATE, DELETE, SET (feature: old → new), ADD, REMOVE, MOVE. Every row is selected at first; clear the ones you do not want, then click Execute. Cancel discards the whole set.

Changes are written in one transaction: a failure anywhere rolls back the whole set. A preview is held for ten minutes, after which the expression has to be run again. Changes that no longer fit the model are skipped, and the task reports how many.

Quick fixes work through the same machinery, so a fix offered for a group of notices can be applied to a part of it.

Other places expressions are written

  • Validation rules and quick fixes have four fields: Precondition Language, Precondition, Implementation Language, Implementation. A rule may check in AQL and fix in EOL. The implementation of a rule returns a boolean - true means the invariant holds. The implementation of a quick fix has to change the model; a reading body is rejected by the editor.
  • The metamodel builder works in AQL only: Predicate on an entity class, Display Expression on a label, Allowed Values on a reference.
  • Documents use one language for the whole document, set in Expression Language on the document form. Expressions in a document only read the model.