Chaining Rules

Recommending Actions for Problems

samples/basic/tutorial/diagnose_2.kb

Rules can refer to facts whose values are acquired from other rules. We can illustrate that point by adding to the diagnostic sample we've already built.

The application determines what the problem is, but doesn't tell the user what to do about it. We can add a set of rules that recommend an action for the user to take, based on what the problem is.

    1. Change the goal of the knowledgebase to action.
    2. Create a new rule_set, named action.
    3. Make it single_valued.
    4. Add the conditions and values below:

      conditions
      value
      problem = "Screen saver"
      "Move mouse"
      problem = "Monitor turned off"
      "Turn monitor on"
      problem = "Dirty rollers"
      "Clean rollers"
      problem = "No mouse pad"
      "Get a mouse pad"
      problem = "Broken mouse"
      "Buy new mouse"

Run It

    1. Run the system with different answers to questions, and study the traces to understand how the system is working.
    2. Add the goal problem to the knowledgebase to see how multiple goals can be specified. Use the arrows to make problem the first goal.
    3. Note that, because action uses problem, its not necessary to make problem a goal, but, by doing so you get to report back to the user both the problem and the action to take. However, the output is not formatted in a tidy manner for the Web.
    4. To fix this, create a new text object named ouput. Set the text to:

    text
    <p>The problem is: %problem%</p>
    <p>To fix it: %action%</p>



Copyright ©1995-2006 Amzi! inc. All Rights Reserved. Privacy Policy.
Amzi!, KnowledgeWright and WebLS are registered trademarks and Adventure in Prolog, Logic Server, Logic Explorer, Adventure in Prolog and Subscription Plus are trademarks of Amzi! inc.