[rules-users] Find facts in partially matching LHS

David Jacobsson david.jacobsson at netlight.se
Fri Feb 4 10:01:17 EST 2011


Hi,

I'm currently working with a system where we have customers with different status flags. This could look something like:

customer has bought a car and a bicycle -> "wheel" status
customer has bought a tent, a jacket and food -> "camper" status

Since these rules can be quite complex and change often using Drools would be a good way so solve the problem. The problem now is that we want to answer the question, what's needed to achieve "camper" status? When it comes to DRL this becomes that we want to know which LHS facts that are missing for the "camper" rule to fire, i.e. so we can tell the customer that in order to achieve "camper" status you also need to buy a tent when he/she already have bought a jacket and food.

The solution we have so far is to add a number of "negative" rules in DRL that can identify the missing facts. Our concern though is that this doesn't scale since these extra rules become several more then the base rules that define the statuses.

Is it possible to solve this in a general way with Drools, i.e. to find missing facts leading to a specific conclusion?

And example of status rule in DRL would look something like:
-----
when
   BoughtCar( $c : customer )
   BoughtBicycle( customer == $c )
then
   insert( new WheelStatus( $c ) );
end
-----

The example above is of course just an example and not actual rules from our system.

Regards,
David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110204/6f613e0f/attachment.html 


More information about the rules-users mailing list