The RHS of a rule X winds up in some class Rule_X_0. Calls like insert(),
retract(), etc. are, by definition, method calls of WorlingMemoryEntryPoint,
and the compiler ought to prefix them with the global reference to that
object, i.e., "drools". This fails within if statements, both branches.

If you write, inside (or outside) if
   drools.insert(...);
   drools.retract(...)
all is well.

-W


2009/3/23 Edson Tirelli <[email protected]>

>
>    This is odd, since this part of the code didn't changed much from drools
> 4 to 5 (assuming you are using java dialect for your consequence). Can you
> open a JIRA with your test case plz?
>
>    []s
>    Edson
>
> 2009/3/23 Jared Davis <[email protected]>
>
> Hi,
>>
>> This rule (not the best style) compiles fine in 4.07. It gives this error
>> message using 5.0 Snapshot. I changed some of the text to be generic so I
>> could
>> post the code.
>>
>> Rule Compilation error : [Rule
>> name='A.B.inlet.mxb.first.link.20090216.01']
>>        com/zzzzzz/yyy/awl/Rule_A_B_inlet_mxb_first_link_20090216_01_0.java
>> (11:5517) : The method insert(RuleLink) is undefined for the type
>> Rule_A_B_inlet_mxb_first_link_20090216_01_0
>>
>>
>> Here is the rule: (I had to change all the > to . to get gmane to accept
>> the
>> email as a non top post)
>>
>> rule "A.B.inlet.mxb.first.link.20090216.01"
>> agenda-group "A.B"
>> when
>>
>> .     comp :     XComponentRule( path == "~unit~mxb")
>> then
>> .     Point3d l = new Point3d();
>> .     comp.getBounds().getLower(l);
>>
>> .     if (l.x < 1)  {
>> .        insert( new RuleLink("FIRST.INLET" , comp, comp) );
>> .     } else {
>> .        insert( new RuleLink("FIRST.INLET.NOT" , comp, comp) );
>> .     }
>> .
>> end
>>
>> If I change the rule to
>>
>> rule "A.B.inlet.mxb.first.link.20090216.01"
>> agenda-group "A.B"
>> when
>>
>> .     comp :     XComponentRule( path == "~unit~mxb")
>> then
>> .     Point3d l = new Point3d();
>> .     comp.getBounds().getLower(l);
>> .     String name = "FIRST.INLET";
>> .     if (l.x < 1)  {
>> .       // nothing
>> .     } else {
>> .       name = "FIRST.INLET.NOT";
>> .     }
>> .     insert( new RuleLink(name , comp, comp) );
>> .
>> end
>>
>> it compiles w/o a problem.
>>
>>
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [email protected]
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to