From: <jbo...@li...> - 2006-05-25 00:11:23
|
Author: mic...@jb... Date: 2006-05-24 20:11:04 -0400 (Wed, 24 May 2006) New Revision: 4414 Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/Marginal-age.drl Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl Log: lab 4 finished Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/Marginal-age.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/Marginal-age.drl 2006-05-24 22:58:11 UTC (rev 4413) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/Marginal-age.drl 2006-05-25 00:11:04 UTC (rev 4414) @@ -0,0 +1,16 @@ +package org.acme.insurance +expander acme.dsl + +# +# Sometimes it may make sense to manage one rule per file. +# + +rule "Driver is in marginal age" + #remember, don't leave any blank lines in between expressions + when + Driver is between 18 and 24 years old + Driver has had more than 1 prior claims + Policy type is 'COMPREHENSIVE' + then + Reject Policy with explanation : 'No accidents allowed if in marginal age group' +end Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/Marginal-age.drl ___________________________________________________________________ Name: svn:eol-style + native Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl 2006-05-24 22:58:11 UTC (rev 4413) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl 2006-05-25 00:11:04 UTC (rev 4414) @@ -1,13 +1,12 @@ #ACME Discount insurance rule language -[then]Log "{message}"=System.out.println("{message}"); -[when]The Driver is less than {age} years old=d : Driver(age < {age}) -[when]The Driver is greater than {age} years old=d : Driver(age > {age}) -[when]The Driver has had more than {prior} prior claims=d : Driver(priorClaims > {prior}) -[when]The Policy type is '{type}'=Policy(type == "{type}") -[then]Reject the policy with explanation : '{reason}'=assert(new Rejection("{reason}")); -[when]The Driver has a location risk profile of '{risk}'=d : Driver(locationRiskProfile == "{risk}") -[when]The Driver has an age of at least {age}=d : Driver(age >= {age}) -[when]The Driver is between {lower} and {upper} years old=d : Driver(age >= {lower}, age <= {upper}) +[when]Driver is less than {age} years old=d : Driver(age < {age}) +[when]Driver is greater than {age} years old=d : Driver(age > {age}) +[when]Driver has had more than {prior} prior claims=d : Driver(priorClaims > {prior}) +[when]Policy type is '{type}'=Policy(type == "{type}") +[then]Reject Policy with explanation : '{reason}'=assert(new Rejection("{reason}")); +[when]Driver has a location risk profile of '{risk}'=d : Driver(locationRiskProfile == "{risk}") +[when]Driver has an age of at least {age}=d : Driver(age >= {age}) +[when]Driver is between {lower} and {upper} years old=d : Driver(age >= {lower}, age <= {upper}) [when]Policy has not been rejected=not Rejection() [when]Driver has had {number} prior claims=d : Driver(priorClaims == {number}) -[then]Approve the policy with the reason : '{reason}'=assert(new Approve("{reason}")); +[then]Approve Policy with the reason : '{reason}'=assert(new Approve("{reason}")); Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl 2006-05-24 22:58:11 UTC (rev 4413) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl 2006-05-25 00:11:04 UTC (rev 4414) @@ -11,72 +11,73 @@ rule "Driver has had too many accidents" when - The Driver has had more than 3 prior claims + Driver has had more than 3 prior claims then - Reject the policy with explanation : 'Too many accidents' + Reject Policy with explanation : 'Too many accidents' -end +end rule "Driver is underage" when - The Driver is less than 18 years old - then - Reject the policy with explanation : 'Driver is underage. Try another insurer' + Driver is less than 18 years old + then + Reject Policy with explanation : 'Driver is underage. Try another insurer' end rule "Driver is in marginal age" #remember, don't leave any blank lines in between expressions when - The Driver is between 18 and 24 years old - The Driver has had more than 1 prior claims - The Policy type is 'COMPREHENSIVE' + Driver is between 18 and 24 years old + Driver has had more than 1 prior claims + Policy type is 'COMPREHENSIVE' then - Reject the policy with explanation : 'No accidents allowed if in marginal age group' + Reject Policy with explanation : 'No accidents allowed if in marginal age group' end rule "Driver in unsafe area for marginal age" when - The Policy type is 'COMPREHENSIVE' - The Driver is less than 25 years old - The Driver has a location risk profile of 'HIGH' + Policy type is 'COMPREHENSIVE' + Driver is less than 25 years old + Driver has a location risk profile of 'HIGH' then - Reject the policy with explanation : 'Marginal age driver in high risk area' + Reject Policy with explanation : 'Marginal age driver in high risk area' end rule "Driver in unsafe area with priors" when - The Driver has a location risk profile of 'MED' - The Policy type is 'COMPREHENSIVE' - The Driver is less than 25 years old - The Driver has had more than 1 prior claims + Driver has a location risk profile of 'MED' + Policy type is 'COMPREHENSIVE' + Driver is less than 25 years old + Driver has had more than 1 prior claims then - Reject the policy with explanation : 'Driver in that area is too risky - given past accidents and age.' + Reject Policy with explanation : 'Driver in that area is too risky - given past accidents and age.' end rule "Driver unsafe for third party" when - The Policy type is 'THIRD_PARTY' - The Driver has had more than 2 prior claims - then - Reject the policy with explanation : 'Too many priors for third party' + Policy type is 'THIRD_PARTY' + Driver has had more than 2 prior claims + then + Reject Policy with explanation : 'Too many priors for third party' + end - + rule "Driver in bad area for theft" when - The Policy type is 'FIRE_THEFT' - The Driver has a location risk profile of 'HIGH' - then - Reject the policy with explanation : 'Unsafe area for theft' + Policy type is 'FIRE_THEFT' + Driver has a location risk profile of 'HIGH' + then + Reject Policy with explanation : 'Unsafe area for theft' end rule "Quick approval - safe driver, any policy type" when Policy has not been rejected - The Driver has an age of at least 30 + Driver has an age of at least 30 Driver has had 0 prior claims then - Approve the policy with the reason : 'Driver is safe and mature.' + Approve Policy with the reason : 'Driver is safe and mature.' end |