text template call





This statement causes the referenced text template to be evaluated and the generated file to be written on disk. Note this text template must use a file directive, otherwise an error occurs.

The template may be referenced using a qualified name (dotted notation including the package name) or using a simple name. When a simple name is used, the referenced template is first searched in the caller ruleset package. If the template is not found, then it is resolved using the import directives of the caller ruleset.

The arguments must match the referenced template parameters, in the order they are defined.

This statement may be used at any level of a rule contents, as well as inside an MQL script.


This will generate a Java source file for each Class contained in a UML 2.1 model:

package com.mycompany.example;

// expects a loaded UML 2.1 model as input
public ruleset GenerateAllJavaClasses(in model : uml21) {

    public rule generate() {
        // loop on each Class of the UML 2.1 model
        foreach (class in model.getInstances("Class")) {
            // calls the text template GenerateJavaClass