whenever rule to detect that two items have become related irrespective of the relation involved. The grammar is:
whenever item becomes related to item
whenever any plane P becomes related to any runway R
then start check-takeoff-or-landing (P, R)
whenever rule that detects a relation event fires every time any relation is made. Thus if two items become related by one relation, and then by another, a becomes related to rule fires twice, once for each relation established.
whenever rule to detect that two items have ceased to be related irrespective of the relation involved. The grammar is:
whenever item ceases to be related to item
whenever any plane P ceases to be related to departure-schedule
then conclude that the departure of P is complete
whenever rules checking for a ceases to be related to event, because the item no longer exists.
conclude action, G2 detects this event as part of processing, which causes forward chaining to rules. You test when one or more relations is created by using this syntax in the antecedent of a rule:
becomes relation-name item
if rule on the left concludes a new a-member-of relation, if N is connected to R. When G2 detects the creation of this relation, G2 invokes the generic whenever rule on the right.
![]() |
Invoking Rules when a Relation is Deleted
When you delete a relation by using a conclude action with the word not, G2 also detects this event during processing, which also causes forward chaining to rules.
ceases to be relation-name item
if rule on the left deletes the relation named a-member--of, which invokes the generic whenever rule on the right.
![]() |
Note: Deleting a relation by deleting an item that is participating in the relation does not cause forward chaining to rules.
For a description of whenever rules and the events they can detect, see Whenever Rules.
Invoking Rules that Test whether a Relation Exists
You can test whether a relation exists, in the antecedent of a rule. When G2 detects the creation or deletion of the relation, G2 invokes this rule via forward chaining. true or false:
if item is [not] relation-name item
if rule on the left concludes a new a-member-of relation, if N is connected to R. The rule on the right tests for the existence of this relation. G2 invokes this rule when the relation is created.
![]() |
To test whether
N is not related to the parent-network of R, you would use:
if N is not a-member-of the parent-network of R
You refer generically to a class of items that are related to one or more items by using this syntax in the antecedent of a rule:
for any class-name [local-name] that is relation-name item
a-member-of relation, which triggers the rule on the right that refers generically to any node that is a-member-of the parent network of the router.
![]() |
Invoking Rules that Refer to Variables with Relations
You can use an expression in the antecedent of a rule to refer generically to a variable that participates in a relation. When the variable receives a value or an expiration time, G2 invokes this rule via forward chaining.
For example, the rule on the left concludes a value for the variable
N. router via the relation named a-member-of, where NODE is a subclass of the system-defined symbolic variable class. When the relation is created, the rule concludes a value for the variable, which invokes the rule on the right that refers generically to the variable that is participating in the relation.
![]() |