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


2.6.2 Single-Stepping Rules

Figure 2.9 KnowledgeWorks Gspy Window

Select a rule, say, Y-N-QUESTION , in the Rule Browser and choose Works > Rule > GSpy from the menu bar. This brings up a Spy Window for the rule. In it you will see the actions of the rule.

Now enter (infer) in the Listener to run the demo again. Execution will stop when this rule fires. A message in the listener will say that the rule Y-N-QUESTION has been called. Click on the Creep button at the bottom of the Listener to single step through the rule. Watch the highlight move through the Spy Window as you go. If you still have a Monitor Window for the PLAY rule it will be updated automatically as you go.

Click on Leap at the bottom of the listener and it will "leap" to the end of the rule. When you have finished, close the Spy Window (for example by pressing Alt+F4 ) and press Leap in the Listener window to remove the break point and continue normally.

At any point when rule execution is suspended by this mechanism, the other KnowledgeWorks tools may be used, for example to examine the object base (with the Objects Browser) or see which rules have fired (with the forward chaining history). Spy Windows are available for backward chaining rules as well, and they work in exactly the same way (they are set by selecting the rule in the Rule Browser and choosing Works > Rule > Gspy ).

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