[rules-users] inconsistent behavior with the eclipse IDE and the Drools compiler

Hezi Stern hezis at delegatecom.com
Tue Nov 29 09:21:38 EST 2011


 

Hi all,

 

I encountered the following strange inconsistent behavior with the eclipse
IDE and the Drools compiler.

 

I have the following test rule which should fire if a specific time
condition is present. The time condition is evaluated by a function called
getTimelineDescriptor() which is imported using import function.

 

rule "ScheduleTime: request for explicit time arrived"  

      

      when        

                        ConditionMatrix(descriptors.times.timeline contains
getTimelineDescriptor(EButtonID.TIME_SPECIFIC) || 

                                        descriptors.times.timeline contains
getTimelineDescriptor(EButtonID.DYNAMIC_ABSOLUTE_TIME) ||

                                        descriptors.times.timeline contains
getTimelineDescriptor(EButtonID.DYNAMIC_RELATIVE_TIME),

                                        $srcAlt: srcWorkingAlternative,


                                        )

                                                            

      then

            //something...

                        

end

 

the IDE indicates an error on the conditionMatrix line with the following
description:

Multiple markers at this line

- [ERR 101] Line 123:77 no viable alternative at input '(' in rule
"ScheduleTime: request for explicit time arrived" in pattern ConditionMatrix

- [ERR 102] Line 123:103 mismatched input '||' expecting 'then' in rule
"ScheduleTime: request for explicit time arrived"

- [ERR 101] Line 123:101 no viable alternative at input ')' in rule
"ScheduleTime: request for explicit time arrived" in pattern
getTimelineDescriptor

 

BUT it compiles ok and runs properly.

 

When I wrap the function with brackets (as I thought it should be) like this

 

rule "ScheduleTime: request for explicit time arrived"  

      

      when        

                        ConditionMatrix(descriptors.times.timeline contains
(getTimelineDescriptor(EButtonID.TIME_SPECIFIC)) || 

                                        descriptors.times.timeline contains
(getTimelineDescriptor(EButtonID.DYNAMIC_ABSOLUTE_TIME)) ||

                                        descriptors.times.timeline contains
(getTimelineDescriptor(EButtonID.DYNAMIC_RELATIVE_TIME)),

                                        $srcAlt: srcWorkingAlternative,


                                        )

                                                            

      then

            //something...

                        

end

 

the IDE shows no error but the compilation fails with the following error:

16:19:14,734 [ERROR] [LoggerStream]: Unable to Analyse Expression
descriptors.times.timeline contains
(getTimelineDescriptor(EButtonID.TIME_SPECIFIC)) ||
descriptors.times.timeline contains
(getTimelineDescriptor(EButtonID.DYNAMIC_ABSOLUTE_TIME)) ||
descriptors.times.timeline contains
(getTimelineDescriptor(EButtonID.DYNAMIC_RELATIVE_TIME)):

[Error: unable to resolve method using strict-mode:
com.delegatecom.rules.ConditionMatrix.contains(com.delegatecom.nlp.api.Timel
ineDescriptor)]

[Near : {... tors.times.timeline contains (getTimelineDescripto ....}]

 

I am using Drools 5.2 with Helios (Eclipse).

Any ideas why this is so? Although I have a working option it is impossible
to maintain code when there are error indications.

 

Thanks,

Hezi

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111129/86d98e1e/attachment.html 


More information about the rules-users mailing list