logo       

Re: [drools-user] Using AND & O: msg#00175

java.drools.user

Subject: Re: [drools-user] Using AND & O

You don't want those semicolons.  Also, you don't need to quote the rule name.  Something more like this:

rule "bank_sovereign_corporate_standardizedWeight_1"
when
   result:String()
   $obj_seeker:Seeker(type=="bsc",(val == "issueRatings1" or val == "issueRatings2"))
then
   result = "Standardized weight   "+Rules.facilityWeight +" % ";
   retract(obj_seeker);
   modify(result);
end

That is at least more correct.  I didn't try to parse it myself, but it would get you closer.  In general, when the Drools compiler complains about a token, you have to look somewhere *around* that token's appearance to see where the error is -- you may have to backtrack a few lines.  I usually start cutting and pasting in successively more complex versions of a rule until it stops working, then I know what was wrong.

On a further note, I wouldn't use a String() type for rule matching.  It works, but now you've essentially said that any String in the WorkingMemory is, in fact, that result string and is a candidate to be matched.  Perhaps that's true, but it just... feels wrong.  What I've done in the past is just wrapped a String in a simple object tagged with the right information.  If this is a Result, make an object called Result and have it hold the String value.  Then you can match on *that*, not on a simple String.

---
Michael J. Suzio
msuzio@xxxxxxxxx
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise