Subclasses

A subclass in ACEDB is a filtered version of a class. That is, a subclass of class "X" consists of the objects which remain after X is subjected to (filtered through) a query. Subclasses are not defined in models.wrm but rather in subclasses.wrm in the wspec directory.

Subclasses are most useful for offering convenient access to a data subset. For example, consider a class with the model

?TShirt Color UNIQUE Green
                     Red
                     Grey
                     Beige
One possible subclass might consist of all brightly colored t-shirts. It could be defined in subclasses.wrm as follows:

Class Festive
Visible
Is_a_subclass_of TShirt
Filter "Green OR Red"
The next example is used to set aside prolific authors:

Class Prolific_author
Visible
Is_a_subclass_of Author
Filter "COUNT Published > 6"
This subclass assumes

?Author Published ?Publication
This example tests for a particular value in a field:

Class "UK_People"
Visible
Is_a_subclass_of "Person"
Filter "Country = UK"
The corresponding model would be

?Person Country Text
The "Visible" attribute makes the subclass appear in the ACEDB main window. "Filter" must be followed by a valid query which results in objects of the appropriate class. Subclasses can be used in queries but you cannot reference them in the models or enter data using them.