FROM Clause0
SYNTAX:
from_clause = from_head .
from_head = FROM '(' from_decl { ',' from_decl } ')' .
from_decl = [ SUBTYPE ] extended_entity_ref [ ORDER_BY [ ( ASC | DESC ) ] attribute_id ]
Conceptually, the FROM clause defines an iteration over a set of instances. The set of instances is defined by the extended_entity_ref in the FROM clause. This iteration produces every combination of instances of the types listed in the FROM clause. When the optional keyword SUBTYPE is specified before an extended entity reference, it specifies that all instances that is a subtype of the type defined by the actual extended entity reference should be added to the set of instances to iterate over. Instances from the source model as well as the target model are legal in any FROM clause.
Optionally the FROM head can contain the keyword ORDER_BY to specify that the instances of the actual type should be sorted, i.e. retrieved in an order according to the value of the attribute specified by the attribute_id. One of the keywords ASC or DESC can optionally be used to specify ascending or descending order. If none of the keywords ASC or DESC are specified after the ORDER_BY keyword, the order will be ascending.
Example:
FROM (s:sm::part, SUBTYPE ss:sm::assembly)
WHEN ( ... );
The iterations created by the above example can be illustrated by the following pseudo code:
FOR each instance of type s:sm::part DO
s := current_instance_of_typesbm::part;
FOR each instance of type ss:sm::assembly and subtype of
ss:sm::assembly DO
ss := current_instance_of_type_or_subtype_of_sm::assembly
evaluate WHEN clause
. . .
END_FOR
END_FOR
FROM (sa:sm::EntityA, ss:sm::EntityB, t1:tm::Entity1)
WHEN (TRUE);
The iterations created by this last example can be illustrated by the following pseudo code:
FOR each instance of type sa:sm::EntityA DO
sa := current_instanceOf_type_sm::EntityA;
FOR each instance of type ss:sm::EntityB DO
ss := current_instance_of_type_sm::EntityB;
FOR each instance of type t1:tm::Entity1 DO
t1 := current_instance_of_type_tm::Entity1;
evaluate WHEN clause
. . .
END_FOR
END_FOR
END_FOR