Conclusion
CONCLUSION
(rel-get 'Jill 'brother 'Jack)
It looks in the relation field in the "Jill" frame to see if there is a relation called "brother". If there is it looks to see if one of the subjects of that relation is "Jack".
If' it is, rel-get returns true, if not the system will attempt to find the value of the "brother" relation by backward chaining.
Relations are indexed to th~ clauses that use them, and the clauses that set them, these indices are the same as the slots' indices.
relations between frames, add and remove frames, change a
fra~e's control block knowledge and set a variable's value.
A slqt's value is set using one of the set commands. There are set commands for setting the value of a single-valued slot, as well as adding or removing values from a multi-valued slot. An own or inherited slot's value is set using set commands as shown in [diagram 8.8]
A slot's value is changed using the f-put command which is generated from the set commands by the compiler. F-put has the arguments: frame-name, slot name, type and expression.
set f1.s1 := 5
*
f2.s2reset f1.s1
add the value 'x to the multi valued slot s1 in frame f1 remove a multi f1.s1 'x
Compiled from :
(f-put 'f1 'own-slot 's1 (+ (f-get 'f2 's2) 6))
F-put works as follows :
1) If the slot is in the frame, goto 4
2) if slot is not in the frame, it is inherited, a·s in
f-I •
get, using the inheritance strategy of the frame which is either depth or breadth first.
3) The slot is copied into the frame. If the frame is generic it goes into a new inherited slot if the frame is an
instantiation it goes into a new own slot.
4) Set value equal to the evaluated expression. This involves getting the values from .the slots and evaluating the expression. The value is then put into the value facet of the slot.
5) Put the value in the slot.
6) If ·the value to which the slot is being set is NULL then the if-removed facet's procedural actions are executed. If the value is not null, the if-added facet's procedural actions are executed.
7) Reset validity flags of all the clauses whose truth value depends on the value of this slot.
8) Add the rules which use this slot to the relevancy list
9) stop.
The reset commands are .used to set a slot or variable's value to NULL, which is a system defined value much the same
·as the lisp NULL or (). When a slot's value is reset the if-removed procedure is executed.
There are functions for adding and removing values from a multi valued slot. for example in [diag~am 8.8] the third clause adds the value "x" to the slot s1 and the fourth removes the value "x" from the same slot. These functions are compiled to the form
add-a-multi (frame, slot, value) and
remove-a-multi (frame, slot, &optional value) will remove the first element from a multi-valued slot. Remove
'
from multi can be called with a value as a third parameter in this case that particular value is removed from the slot.
The second class of functions that change the knowledge base are those functions that change the structure of the knowledge base. They do this by changing the relationship between frames, or adding new frames.
The set relation· conwnands al low the knowledge engineer to dynamically change the relations of a frame. This very powerful command must be used careful 1 y as it changes the structure of the knowledge base. For example in [diagram 8.9] as new relations between objects are discovered the links between these frames are put in.
set the relation 'member in frame 'tiger to 'carnivore compiled from :
{rel-put 'tiger 'member 'carnivore)
J)~ 8.9
Apart from setting a relation between two frames there is also a command for removing such relations. The set relation and remove -relation commands have 3 arguments
frame the source frame, relation and object frame.
the They are compiled to rel-put and rel-removed as shown in [diagram
8. 9.]
As mentioned earlier the relations are indexed to the rule clauses that use them. When a relation is set or changed all the clauses that access have their validity flags set to
'unknown.
Another very useful C?mmand that changes the structure of the knowledge base is the create frame command. This allows the knowledge engineer to create instantiations of the generic frames at run-time. Concept or generic frames store prototypical situations. These prototypical situations manifest themselves in actual occurrences of the concept eg BOB is a occurrence of the concept TEACHER this
is known as instantiation.
The create-frame command takes two arguments a generic frame and a new instantiated frame. The new frame is created from the generic one by putting ,all the inherit-slots of generic in own-slots of new. Relations, rules , entry and exit conditions are not put in the new frame but the control knowledge is.
In order to allow the WISE language to represent quantified statements the language has variables. There are sever a 1 types of variables, namely loop-variable, choice-variables and global variables. Loop-variables are used in loop rules and allow the knowledge engineer to make universally quantified statements. The choice variables are discussed in the next chapter, and they allow the knowledge engineer to make existentially quantified statements. Global variables set up bindings using the set-var command
[appendix 1]. Variables are treated very much like slots, in that they are indexed and when changed they update the relevancy list and validity flags.
The change-control commands allow the knowledge engineer to dynamically change the control parameters of a frame. There are commands for
resolution strategy, frame. The priority
setting search strategy, conflict relevancy and refractory fields in a
of a rule can al so be dynamical 1 y changed, thus changing the order of execution of the rules within a frame. This allows for a meta-meta-reasoning where the system can reason about what control strategies _it
should use.
8.5 Validity-flags and indices.
The entire WISE knowledge base is cross indexed ie there are indices from. the slots, variables, and relations, to the rules that use them. For example slot "animal. type"• s
index is shown in diagram 8.10]
own slot type
: if-index ((mammal (R1 1) (R2 1)) (bird (R1 1) (R2 1))) : then-Index (carnivore (R1 1))
The indices are set up by the compiler at compile time.
Each clause that is compiled has all the items that it references stored in a contents field. Each member of the contents has its index updated with the rule-name and the position of the clause in the rule.
The if-index is the part of the index that has the address of all the if-clauses in which an item appears. It is used in conjunction with the validity flag of the clause. When a clause's truth value is decided, it is stored in the validity flag of that clause. That truth value should remain unchanged until any item that is referenced by the c 1 a use changes . When an item's value is changed, all the if-clauses that reference it have their truth value set to
"unknown".
The then-index is the part of the index that has the address of all the then clauses in which this item appears. It is used by the backward chainer. When the backward chainer is attempting to find a value for this item, it uses this index to find all the places that the value of this item is set.
'
When an item is changed the if-index is referenced and all the rules that reference this item in their if clauses are added to the relevancy list. The relevancy list is organized according to frames and rules. It is used to decide which rules are relevant in a frame.
8.6 Control Actions
There are two explicit control actions that can be used to make meta-rules. These are execute a rule and enter a
frame. The execute a rule command al lows the knowledge engineer to specify a rule to be tried at a specific point.
The enter a frame command is used to control which rules the system must consider.
The last action to be considered is the contradiction which is used to tell the system it is in a contradictory state.
The implications of this are treated in chapter9 on the TMS.
CHAPTER9 : THE WISE TRUTH MAINTENANCE SYSTEM.