All Manuals > KnowledgeWorks and Prolog User Guide > 2 Tutorial > 2.6 Debugging


2.6.1 Monitoring Forward Chaining Rules

Figure 2.8 KnowledgeWorks Rule Monitor

One of the problems with forward chaining rules is determining why they are (or are not) being matched. To deal with this KnowledgeWorks has Monitor Windows for forward chaining rules. To bring up a Monitor Window, select the DEFAULT-CONTEXT in the Rule Browser, click on PLAY and choose Works > Rule > Monitor . Alternatively you can use the context menu to raise the Rule Monitor window. A Rule Monitor window appears displaying in its upper pane the conditions of the rule. Both are highlighted meaning they are matched (as single conditions without reference to any variable bindings across conditions) in the object base. If you select one or more of these conditions, the message will change from "Number of instantiations matching selected conditions: <n>" to "No instantiations matching selected conditions" depending on whether objects can be found in the object base to match all the selected conditions at once (this takes account of variables bound across conditions).

By selecting the All Unfired Instantiations button, you can list any unfired instantiations of the rule. In this case there is one unfired instantiation. Selecting this in the lower pane and then choosing Works > Instantiations > Inspect raises an Inspector tool displaying the variable bindings in the instantiation.

You can have any number of monitor windows (though at most one per rule). At times (during rule execution, for example) the object base may change. Monitor windows can be updated by choosing Tools > Refresh from the Rule Monitor menu bar, or KnowledgeWorks > Memory > Update Monitor Windows from the KnowledgeWorks Listener. When you are single-stepping through rules (see below) Monitor windows are updated automatically.

KnowledgeWorks and Prolog User Guide (Windows version) - 6 Dec 2011