If I have a rule with multiple conditions, is it possible to know which condition failed if the rule does not execute?

Solution Verified - Updated -

Issue

  • I have a rule that must pass multiple conditons to fire.  If the rule does not fire, I want to know which condition failed.
  • In the rule below, Fire() must return true, on has to be set to true, and the roomnumber must be set to 5 in order for the rule to fire.  If the rule does not fire, I want to log information about the Room and Sprinkler fact objects so I know which condition failed.

    rule "When the fire is gone turn off the sprinkler"
    when
         $room : Room() ;
         not (Fire( room == $room ) ); 
         $sprinkler : Sprinkler( room == $room, on == true, roomnumber=5 ) ; 
    then
         modify( $sprinkler ) { setOn( false ) };
         System.out.println("Turn off the sprinkler for room "+$room.getName());
    end
    

Environment

  • JBoss Business Rules Management System (BRMS) 5.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content