TextUML Toolkit Documentation - Back to main page
It is a little known fact that TextUML also comprises a full-blown action language for UML. The TextUML Toolkit supports the TextUML action language since release 1.2.
You will find some examples of the TextUML action language if you follow our blog’s action language category.
You can find the EBNF grammar for the TextUML notation, which includes both the structural and behavioural aspects of the notation, here.
This complements the documentation for structural aspects of the TextUML notation.
In order to use the TextUML Action Language, the following properties must be enabled in the mdd.properties file:
Just attach a begin/end block to it.
operation reject(reason : Memo);
begin
self.rejectionReason := reason;
self.approver := System#user();
end;
Local variables must be declared before used.
static operation newExpense(description : String, amount : Double, date : Date, category : Category, employee : Employee) : Expense;
begin
var newExpense : Expense;
newExpense := new Expense;
...
end;
self
new <class-name>
Example:
newCustomer := new Customer;
<object-expression>.<attribute-name>
Example:
aName := customer.name;
Note that object-expression is not optional, so for accessing an object’s own attributes, always use self.
<object-expression>.<operation-name>(<argument-list)
Example:
account.withdraw(200)
Again, object-expression is not optional, so for invoking an object’s own operation, always use self.
<class-name>#<operation-name>(<argument-list)
Example:
Client#create("John Doe")
<source-object-expression> -> <association-name> -> <target-role-name>
or (if the target role is owned by the source class):
<source-object-expression> -> <target-role-name>
Examples:
anEmployee := anExpense->ExployeeExpense->employee
or
anEmployee := anExpense->employee
<class-name> extent
Example:
Customer extent
Statements are ended by a semicolon (optional for single-statement blocks). Note that expressions can also be used as statements.
<variable-name> := <expression>;
Example:
aName := "John Doe";
<object-expression>.<attribute-name> := <expression>;
Example:
employee.name := "John Doe";
link <association-identifier> (
<role-identifier-1> := <object-expression-1>,
<role-identifier-2> := <object-expression-2>
);
Example:
link EmployeeExpenses (employee := anEmployee, expense := anExpense);
unlink <association-identifier> (
<role-identifier-1> := <object-expression-1>,
<role-identifier-2> := <object-expression-2>
);
Example:
/* anEmployee and anExpense are currently linked, disconnect them */
unlink EmployeeExpenses (employee := anEmployee, expense := anExpense);
destroy <object-reference>;
Example:
destroy itemOrder;
return [<expression>];
Example:
return self.balance > 0;
raise <expression>;
Example:
raise new InsufficientFunds;
try
<protected body>
catch (<exception-declaration)
<handler body>
end;
Example:
try
account.withdraw(100);
catch (e : InsufficientFunds)
/* handle exception */
end;
send <signal-name>(
[<attribute-1> := <value-expression-1>
[, ... <attribute-n> := <value-expression-n>]]
) to <object-expression>;
Example:
send ExpenseApproved(
employeeName := "John Nader",
amount := 205.05,
description := "Trip to LA"
) to paymentApprover;
<object-expression> as <target-classifier>
Example:
(c as Customer)
See: mdd_collections.tuml
(<parameter-list>) [: <return-type>] { <statement-list> }
Example:
begin
var comparator : {(:Integer,:Integer) : Boolean}
comparator := (p1 : Integer, p2 : Integer) : Boolean { return p1 > p2 };
...
end;