List Info

Thread: DRL authoring help




DRL authoring help
country flaguser name
United States
2007-06-18 08:14:38
Hi,
I am new to JBoss rules. I have a .drl as given below:
 
rule "Rule1"
when
$Position1 : Position()
eval($Position1.getName() contains "POS-RPT_0_1")
then
util.setColor($Position1, "red");
end
 
Before firing the rules, I assert my object as
 
posIn = new Position(name,
   ;  id,
 ;    symbolCode,
     ;lonDouble,
     latDouble,
     elevDouble,
     reportDate,
   ;  this);
    workingMemory.assertObject( posIn );
    workingMemory.fireAllRules();
 
I get the following error.
 
org.drools.rule.InvalidRulePackage: Rule Compilation error The left-hand side of an assignment must be a variable Syntax error on token "contains", invalid AssignmentOperator
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
 
What is wrong with my drl? I have a Utilities class that I have defined as global.
 
Thanks
 


Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
Re: DRL authoring help
user name
2007-06-18 08:26:56
Hi Smitha,

Rewrite the rule as follows :-

rule "Rule1"
when
$Position1 : Position ( name matches "POS-RPT_0_1" )
then
$Position.setColor("red");
end

Note : You had something called util, unless it is a global, it will not work.

-Krishnan.

On 6/18/07, Smitha Bhat < bhat_smithayahoo.com">bhat_smithayahoo.com> wrote:
Hi,
I am new to JBoss rules. I have a .drl as given below:
 
rule "Rule1"
when
$Position1 : Position()
eval($Position1.getName() contains "POS-RPT_0_1&quot;)
then
util.setColor($Position1, "red&quot;);
end
 
Before firing the rules, I assert my object as
 
posIn = new Position(name,
   ; &nbsp;id,
 ; &nbsp; &nbsp;symbolCode,
 &nbsp;   ;lonDouble,
 &nbsp; &nbsp; latDouble,
&nbsp; &nbsp;  elevDouble,
&nbsp; &nbsp; &nbsp;reportDate,
   ; &nbsp;this);
&nbsp; &nbsp; workingMemory.assertObject ( posIn );
 &nbsp;  workingMemory.fireAllRules();
 
I get the following error.
 
org.drools.rule.InvalidRulePackage: Rule Compilation error The left-hand side of an assignment must be a variable Syntax error on token "contains", invalid AssignmentOperator
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
 
What is wrong with my drl? I have a Utilities class that I have defined as global.
 
Thanks
 


Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.


_______________________________________________
rules-users mailing list
lists.jboss.org"> rules-userslists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Sivaramakrishna Iyer Krishnan (Anand)

Never assume the obvious is true.
- William Safire
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )