I'd tackle this with a set of rules according to:
First, a rule that collects everything a customer has bought. Then, low-priority rules matching defined Status sets with accumulated sets; this checks whether a customer has reached a certain status. Other rules detect customer sets that are subsets of status sets and these can easily compute the missing complement.
It may be of advantage to implement a set relation "subset of" as a custom operator, which isn't difficult.
Status sets can be composed by some external tool and injected during startup. This will keep all rules generic.
-W
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" statuscustomer has bought a tent, a jacket and food -> "camper" statusSince 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:-----whenBoughtCar( $c : customer )BoughtBicycle( customer == $c )theninsert( new WheelStatus( $c ) );end-----The example above is of course just an example and not actual rules from our system.Regards,David
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users