Tuesday, October 19, 2010

Leveraging Rule Engines

We are now leveraging the power of rule based systems to power the targeting of our offers. This example does not really show what we are planning exactly, heck it is a trade secret! But you can see that rules can grow in complexity in time to add targeting rules. We think this will help our users get better deals.

 <?xml version="1.0"?>  
 <rule-set name="offer01"  
      xmlns="http://drools.org/rules"  
      xmlns:java="http://drools.org/semantics/java"  
      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"  
      xs:schemaLocation="http://drools.org/rules rules.xsd  
                http://drools.org/semantics/java java.xsd">  
   <import>com.sightlyinc.ratecred.client.offers.Offer</import>  
       <rule name="filter_No_Code">  
     <parameter identifier="offer">  
       <class>com.sightlyinc.ratecred.client.offers.Offer</class>  
     </parameter>  
     <java:condition>offer.getCouponCode().contains("No") || offer.getCouponCode().contains("NO")</java:condition>  
     <java:consequence>  
       offer.setVisible(false);  
     </java:consequence>  
   </rule>  
   <rule name="filter_Code_NULL">  
     <parameter identifier="offer">  
       <class>com.sightlyinc.ratecred.client.offers.Offer</class>  
     </parameter>  
     <java:condition>offer.getCouponCode() == null</java:condition>  
     <java:consequence>  
       offer.setVisible(false);  
     </java:consequence>  
   </rule>  
  </rule-set>  

No comments:

Post a Comment