KnowledgeWorks and Prolog User Guide > 2 Tutorial > 2.4 Browsers


2.4.1 Rule Browser

Figure 2.3 KnowledgeWorks Rule Browser

This may be obtained by choosing Window > KnowledgeWorks > Rules . The defined forward chaining contexts (or rule groups) are displayed in a drop-down list at the top. There is also a special pseudo-context for all the backward chaining rules, which is shown initially. In this case, the only other context is named DEFAULT-CONTEXT . Below that are listed the rules for the selected context. Choose DEFAULT-CONTEXT from the drop-down list and click on one of the rules, for example PLAY , and edit it by choosing Rule > Find Source from the menu bar. An editor window will appear showing this rule definition.

What this rule says is:

(root ?r node ?node)
(not (current-node ? node ?))
((capi:display-message "  ANIMAL GUESSING GAME - ~
          think of an animal to continue"))
(assert (current-node ? node ?node))

which means:

If the node ?node is the root node of the tree of questions, and there is no current node indicating the question about to be asked, then tell the user to think of an animal and make the root node ?node the current node (so that the top question of the tree will be asked next). This is the rule that starts the game by instructing: "if you haven't got a question you're about to ask, ask the topmost question in the tree of questions". The detailed syntax of forward chaining rule definitions will be explained in Forward chaining.

Select " -- All backward rules -- " from the drop-down list and bring up a backward chaining rule definition by clicking on its name in the Rule Browser and choosing Rule > Find Source again. The detailed syntax of backward chaining rules is in Backward Chaining.

KnowledgeWorks and Prolog User Guide (Macintosh version) - 22 Dec 2009