Next: , Previous: , Up: Creating a Component   [Contents][Index]


3.3.2 Importing Models

When a component refers to other components or interfaces and their details, the declaration of these has to be known.

An import clause is available to load the declaration from separate files holding interface or component declarations.

3.3.2.1 Syntax

The keyword import is used to import interface or component definition files.

import ModelName.dzn;

Each import clause will look on the file system for a file with the required name, and include the content.

For the time being the file should be located in the same directory as the current model. So ’import Console.dzn’ expects a file ’./Console.dzn’

3.3.2.2 Examples

3.3.2.3 A component importing an interface

The component Leaf implements the ISensor interface for which the declaration is imported using the import statement.

import ISensor.dzn
component Leaf
{
  provides ISensor sensor;
    behaviour
    {
        on sensor.event(): { }
    }
}

See also: