| University of Wisconsin - Madison | CS 540 Lecture Notes | C. R. Dyer |
?- is_integer(X).
is_integer(X).
/|\
/ |-\
X=0 | X is Y+1
|
is_integer(Y)
/|\
/ |-\
Y=0 | Y is Y'+1
|
is_integer(Y')
/|\
/ |-\
Y'=0 | Y'is Y''+1
|
is_integer(Y'')
:
:
?- is_integer(3). is_integer(3) /\ /--\ is_integer(Y) 3 is Y+1 /|\ / |-\ Y=0 | Y is Y'+1 is_integer(Y') /|\ / |-\ Y'=0 | : :
while changes are made to Working Memory do:
Assign_Power_Supply_1
IF Most current active context is assign-power-supply
An SBI module is in cabinet
Position of module in cabinet is known
Space is available in cabinet for a power supply
for that position
No power supply is currently available
Voltage + frequency of components is known
THEN Find a power supply of that voltage and frequency
and add it to order
Check_Voltage_And_Frequency_1
IF Most current active context is
checking-voltage-and-frequency
There is a component requiring one voltage or
frequency
There is another component requiring a different
voltage or frequency
THEN Enter context of
fixing-voltage-or-frequency-mismatches
Put_UB_Module_6
IF Most current active context is
putting-unibus-modules-in-backplanes-in-box
It is known which module to insert
The module is a multiplexer interface
:
:
THEN Enter context of
verifying-panel-space-for-a-multiplexer
Deactivate_Unibus_Module_Context IF Most current active context is putting-unibus-modules-in-backplanes-in-box THEN Exit context
mammals house-pets birds
^ ^ ^ ^ ^ ^ ^
| | | | | | |
| | |------------| | |
| |--------| | | |
| | | | |
elephants dogs cats eagles chickens
^ ^
| |
| |
Clyde Ziggy
Member
Ziggy -------------> Cats
Subclass
Cats --------------> Mammals
Age
Ziggy -------------> 10
Num_Legs
Birds -------------> 2
Likes
People ------------> Foods
To answer the query "How many legs does Tweety have?" we first find the Tweety node in the network and then check if there is a Num_Legs link directly from that node. If there is, then we have an immediate answer to the query. If there is not such a link, then follow the Member link to the class Birds. Now check if there is a Num_Legs link from that node. If there is, then we look up the answer there; if not, then follow a Subclass link to a superclass such as Animals, and continue this process until either an answer is found or else there are no more Subclass links to chain through in the network.
Flies
Birds --------> True
^ ^ | Num_Legs
| | ----------> 2
| |------
| |Member
|Member |
| | Flies
Tweety Penguins ----------> False
^
|
|Member
|
Opus
In this case inheritance searches for the closest node where
the property is found and uses that information to answer the query.
For example, asking "Does Opus fly?" finds the property Flies
at the Penguins node and therefore the Flies
property at the superclass
Birds is implicitly cancelled. On the other hand, asking
"How many legs does Opus have?" finds the answer "2" at the Birds
node.
For example, the query "Is Dick a pacifist?" cannot be answered in the network below.
Pacifist Pacifist
Quaker ----------> True Republican ----------> False
^ ^
| |
------------- -------------
| |
| |
Dick
Copyright © 1996-2003 by Charles R. Dyer. All rights reserved.