DomainIterator extends CanBeSynced, Changeable, ContainsFunctions, ContainsOperations, ContainsValues, ContainsWires, GeneratesElements, NamedElement, ParameterEdgeDestination, ProvidesEdgeDestination, ProvidesEdgesSource, Wireable

Provides an iterable interface over instances of a particular DomainType, as selected from a particular DomainSource.

DomainIterators allow for the access, and modification, of sources of data according to a particular schema. Access is defined by evaluating a query against named parameters for the query provided through Parameters, with respect to a limit of results through the limit attribute.

A DomainIterator is composed of a set of DomainAttributeInstances, and this set is derived from the set of DomainAttributes defined by the classifier DomainType of that DomainIterator.


The query attribute of the DomainIterator specifies the parameterised query that will be used to select DomainInstances from the connected DomainSource. A DomainIterator does not permit the execution of raw SQL commands, in order to improve the security of modelled web applications. Parameters to this query may be specified through Parameters, and referenced within the query as named parameters (for example, a query of ":id = 1" will use the incoming Parameter named "id"). A variety of database-independent query functions are provided:

Function Returns
matches(a,b) Performs a case-insensitive text search of a against the query b. Every word in b is matched, usually using a SQL keyword or function LIKE, against a.
now() Returns the current date and time.

If the query is set to the value "new", then this DomainIterator will instead create new instances of the given DomainType, which will be saved within the connected DomainSource if necessary.

Containing Scope

Each DomainIterator has an associated containing scope that represents the scope that a particular instance can be accessed:

Failure Handlers

An outgoing ECARule from a particular DomainIterator with the name "fail" is defined as a failure handler for the given iterator. If a DomainIterator does not have such a handler, then the failure handler semantics of the containing Scope are used instead throughout the scope containment hierarchy.



If the autosave attribute of this DomainIterator is true, it will ensure all contained DomainAttributeInstances will automatically save the current DomainInstance (as pointed to by the cursor) whenever the attribute instance value is changed. The default value of this attribute is false.

If the query of this DomainIterator is set to "new", and the autosave attribute is set to true, then a new DomainInstance will be created in the DomainSource immediately. If autosave is set to false, then a new DomainInstance will only be created in the DomainSource once the save Operation is called.


The new Operation of a DomainIterator forces a new result DomainInstance to be created, regardless of the current state of the contained DomainInstance. If the DomainInstance has not been saved, then the changes will be lost.


By default, a DomainIterator will select at most one matching result to the given query. If the limit of a DomainIterator is specified to a non-negative positive integer, then a DomainIterator will select at most that many results. If the limit of a DomainIterator is specified to zero, then the DomainIterator will select all possible results.


The orderBy reference of a DomainIterator describes the order in which multiple instances will be returned with respect to a single DomainAttribute. If this reference is not set, then instances may be returned in any order. The direction of this order is specified by the orderAscending attribute of the DomainIterator.



The reload Operation of a DomainIterator reloads the current DomainInstance from the specified DomainSource. When the reload operation is called upon a given DomainIterator runtime instance, all current DomainAttributeInstance values are cleared, and reloaded from the specified DomainSource. If the DomainSource can no longer provide the requested instance information, an error will occur.

When a DomainIterator is accessed for the first time, or the current instance pointer is changed (for example, through calling the next, previous or reset BuiltinOperations), the reload operation is also executed.


The save Operation of a DomainIterator forces the current DomainInstance to be saved to the specified DomainSource of that iterator. Saving the current DomainInstance will not modify the current instance pointer. If the save is unsuccessful, an exception will be thrown and handled through the associated failure handler of the iterator.


The canSave Predicate of a DomainIterator is false if the current DomainSource for the iterator is read-only (e.g. an external RSS feed), or a contained DomainAttributeInstance currently has an invalid value instance.

Role and Permission-based operations

A DomainIterator which selects instances of a Role will have four Operations defined, in oder to modify the current Roles and Permissions of the selected user instance: addRole, removeRole, addPermission, and removePermission. These are discussed in further detail as BuiltinOperations.



Implementation Notes

Inference Rules



Inherited Attributes


Inherited Children


Inherited References


Inherited Extensions