package

Syntax

package packageName;

where:

Description

The package directive defines the namespace of rulesets and of scripts. Related rulesets are grouped into packages to be easier to find and use, to avoid naming conflicts, and to control access. A package may contain text templates, rulesets, scripts and Java types.

The qualified name of the package must match the folders in which the file is defined: a com.mycompany.example package declaration may be used in the folder com/mycompany/example.

This is the first statement that must appear in a MQL file. Any other statement is defined after this one.

Examples

A ruleset example:

package com.mycompany.example;

public ruleset myRuleSet() {

    public rule myRule() {
    }
}

A script example:

package com.mycompany.example;

metatype uml21.Class;

public script myScript() : String {
    return self.name;
}