Up Previous Next Title Page Index Contents

5.3.3 General commands

This category contains the basic and often used commands other than those used to access design elements.

Report header

The report header is the name of the generator:
report 'data flow report'
The name of a generator can be used to affect the user interface shown to a modeler:
If the name begins with an underscore, ‘_’, the generator is not shown in the list of generators the modeler can run. This is useful for hiding subgenerators from modelers.
If the name begins with a double underscore ‘__’, it is not shown to modelers or as a subgenerator in the hierarchical view of the Generator Editor. This is useful for ‘utility’ subgenerators that are called from almost all generators, and which might otherwise clutter up the hierarchical view for the metamodeler. Rather than showing these subgenerators many times throughout the hierarchy, they are shown once at the top level of the hierarchy.
If the name begins with an exclamation mark, ‘!’, the generator is added as a button on the action toolbar of the Diagram Editor and other editors. The button shows the name without the exclamation mark; since there is limited space in a button, such names should be limited to a few letters. These generators are also not shown in the list of generators the modeler can run. Usually, such a generator simply calls a normal generator that will be visible in that list.
For brevity’s sake, the report header is not present in the generators used in metamodeling tools for generator identifiers, and in the Symbol Editor for text element contents and conditions.

Report end

Generators end with an endreport statement:
endreport
For brevity’s sake, this is not present in the generators used in metamodeling tools for generator identifiers, and in the Symbol Editor for text element contents and conditions.

Comments

A comment sequence is started with the /* token and terminated with the */ token.
/* This is a comment */

Line end

Each statement within the generator body (except the foreach construct) may end with an optional semicolon. Note that several statements can be written on the same line by separating them with whitespace, and optionally a semicolon after each command. Semicolons are obligatory in a few places, e.g. to mark the end of a type name that contains a space or precedes a command.

Newline

As well as being allowed as part of a string, new lines can be inserted in the generator output by the keyword newline.
newline

Strings

The strings to be generated appear as they are written inside ' single quote marks. To include a ' in a string write it twice '' (2 single quotes).
'This will appear as it is here' newline
'This will ''appear'' a little different' 
would appear like this in the generator output:
This will appear as it is here
This will 'appear' a little different
You can also apply translators to strings, e.g. to reformat special characters in them into an appropriate format for an XML or HTML output file: see “Translating strings: to translate endto” in Section 5.3.6.

Type

The name of the current element’s type can be printed to the generator output by:
type
The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

Identifier

The identifier of the current element is printed by:
id
If an element has an identifying property, the string representation of that property forms its identifier. If an element has no identifying property, e.g. if it has no properties, the name of its type forms its identifier. If an element has a generator identifier, the output of that generator forms the identifier.

The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

Unique object identifier

Each design element within the system has a unique object identifier. This can be printed by:
oid
The object identifier is of the form 12_234, where the number before the underscore refers to the repository area in which the element is located and the number after the underscore is the unique identifier for the element within that area. This object identifier is thus useful when a unique tag for an element is required, e.g. if the element has no properties, or if the identifier should remain the same even when the element’s name changes.

The separate parts of the identifier can be output by the projectId and objectId commands. Note that if the current element is not a proper design element, but just a Text or String, empty strings are output in place of the numbers, so the result is just an underscore.

The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

ProjectId

Each design element is stored in a certain project, and each project has a numerical project id, which can be printed by:
projectId
Note that if the current element is not a proper design element, but just a Text or String, an empty string is output.

The projectId number is the same as the first part of the oid. The mapping of numbers to project names is visible in the repository’s manager.ab file.

The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

ObjectId

Each design element has a numerical object id, unique within its project, which can be printed by:
objectId
Note that if the current element is not a proper design element, but just a Text or String, an empty string is output.

The objectId number is the same as the last part of the oid.

The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

Project

The name of the project where the current element is stored can be printed by:
project
Note that an empty string is output if the current element is a Text or String.

The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

MetaType

The metatype of the current element can be printed by:
metaType
which outputs ‘Object’ for objects, ‘Relationship’ for relationships, ‘Graph’ for graphs, ‘Text’ for text and ‘String’ for strings.

The command can also be used to access elements in containing loops by following the command with a semicolon and level number: see “Level number” in Section 5.3.2.

Stack

To output the current stack contents, use:
stack
which outputs the stack contents so that the current element of this loop is printed first, and the current element of the outermost loop is printed last.

You can also iterate over the stack with the do and dowhile commands: see “Iterating over the stack” in Section 5.3.4.

Decompositions

To output the decomposition graph’s name of an object, use:
decompositions
You can also iterate over the decompositions with the do and dowhile commands; as an object only has zero or one decomposition, the loop will be executed at most once each time. See “Iterating over decompositions” in Section 5.3.4

Explosions

To output the explosion graphs’ names of an object, relationship or role, use:
explosions
You can also iterate over the explosions with the do and dowhile commands: see “Iterating over explosions” in Section 5.3.4.

Up Previous Next Title Page Index Contents