next up previous

9.7.3 Query Definition

A query is a user-defined boolean expression applied to an instance-set to determine if the instance-set meets further user-defined restrictions. If the evaluation of this expression for an instance-set is anything but the symbol FALSE, the instance-set is said to satisfy the query.

Syntax

<query> ::= <boolean-expression>

Example

Continuing the previous example, one query might be that the two instances in an ordered pair have the same age.

(= (send ?man-or-boy get-age) (send ?woman-or-girl get-age))

Within a query, slots of instance-set members can be ly read with a shorthand notation similar to that used in messagehandlers (see section 9.4.2). If message-passing is not explicitly required for reading a slot (i.e. there are no accessor daemons for reads), then this second method of slot access should be used, for it gives a significant performance benefit.

Syntax

<instance-set-member-variable>:<slot-name>

Example

The previous example could be rewritten as:

(= ?man-or-boy:age ?woman-or-girl:age)

Since only instance-sets which satisfy a query are of interest, and the query is evaluated for all possible instance-sets, the query should not have any side-effects.


next up previous