Slot Value Inheritance and Defaults (original) (raw)

next up previous contents index
Next: The number of values Up: A Reference Model of Previous: Classes and instances

Recall that a slot is a mapping from a particular frame to a set of values. But for modularity and other reasons FRSs allow one to describe a set of such mappings for all instances of a class. Such descriptions are called slot value inheritance. To describe inheritance we need to first define the notion of a template slot.

A template slot is a description of a slot that is associated with a class Frame, but that applies to all instances of that class. In many FRSs template slots are presented as if they were literally slots. But they are actually a way of specifying, in one place, slots for all the instances. For example, if we wanted to say that all instances of the class female-person have a slot called gender with the value female, we could define a template slot called gender for the female-person frame and give it value female. Then if we created an instance offemale-person called mary, and we asked for the value of the slot gender on mary, we would be told that her gender is female.

What would we get if we asked for the gender slot of female-person? The question is ambiguous, because we could mean the template slot on the frame female-person viewed as a class, or the slot on the frame viewed as an instance (e.g., of a class of classes). To disambiguate these senses we make a clear distinction in the protocol between template slots and own slots, which are the normal slots on an instance. We know from common sense that thegender could not be an own slot on the female-personframe, because that would be specifying the gender of a class! Instead, we say that gender is a template slot on female-person with the template slot value female. Formary, an instance of female-person, the value female is an inherited value for the own slot gender. We say that the value is known by monotonic inheritance from the female-person class, to distinguish it from nonmonotonic inheritance described in the next section.

An own slot value of an instance can be inherited from a template slot of any class that is a type for the instance, not only direct types of the instance. If mary were a direct instance of single-working-mother, which is a subclass of single-mother, which in turn is a subclass of female-person, then the value of the gender slot for mary would still be inherited from the class female-person.

The distinction between own and template slots is captured within the Generic Frame Protocol by the notion of the slot-type of a particular slot. Because some FRSs allow frames to have both own and template slots of the same name, the protocol must allow the user to distinguish between each of these cases. However, by far the most common case is for there to be no ambiguity in the slot type of the slot in question. Because of this, the protocol allows the slot-type to default to the special value :auto, which will allow the frame system to "do the right thing," selecting the own slot when there is any ambiguity.


next up previous contents index
Next: The number of values Up: A Reference Model of Previous: Classes and instances