Page 268 - DCAP310_INTRODUCTION_TO_ARTIFICIAL_INTELLIGENCE_AND_EXPERT_SYSTEMS
P. 268
Introduction to Artificial Intelligence & Expert Systems
Notes In contrast to generalization, specialization means creating new subclasses from an existing class.
If it turns out that certain attributes, associations, or methods only apply to some of the objects
of the class, a subclass can be created. The most inclusive class in a generalization/specialization
is called the superclass and is generally located at the top of the diagram. The more specific
classes are called subclasses and are generally placed below the superclass. In figure,
the class Freight (1) has the attribute Degree of Hazardousness (2), which is needed only for cargo,
but not for passenger luggage. Additionally, only passenger luggage has a connection to a
coupon. Obviously, here two similar but different domain concepts are combined into one class.
Through specialization the two special cases of freights are formed: Piece of Cargo (3) and Piece of
Luggage (4). The attribute Degree of Hazardousness (5) is placed where it belongs—in Piece of Cargo.
The attributes of the class Freight (1) also apply to the two subclasses Piece of Cargo (3) and Piece of
Luggage (4):
Figure 14.5: Example of Specialization
So much for the mechanism, however, the domain meaning of the relationship between superclass
and subclass is much more important. These rules apply to this relationship: All statements that
are made about a superclass also apply to all subclasses. We say that subclasses “inherit” attributes,
associations, and operations from the superclass. For example, if the superclass Freight has an
attribute Weight, then the subclass piece of luggage also has an attribute Weight, even though
this attribute is not listed in the subclass Piece of Luggage. Anything that can be done with an
object of the superclass can also be done with an object of the subclass. For example, if freight can
be loaded, pieces of luggage can also be loaded. In the terminology of the system that is being
modeled, a subclass has to be a special form of the superclass. For example, a piece of luggage is
a special case of freight. The counter-example to this is: A flight is not a special case of a flight
number.
Self Assessment
State whether the following statements are true or false:
11. Specialisation is the process of extracting shared characteristics from two or more classes,
and combining them into a generalized superclass.
12. The shared attributes are not listed in the superclass.
262 LOVELY PROFESSIONAL UNIVERSITY