[rules-users] unexpected/spurious ClassCastException

Borris borris at chaos.org.uk
Mon Jul 7 20:11:53 EDT 2014


On Monday 07/07/2014 23:26, Davide Sottara wrote:
> I'll try to reproduce the exception with the rule and the data model.
> Meanwhile, could you share a self-contained unit test that reproduces
> the problem?
> That would speed up the fix process
> Thanks!
> Davide
Hmm. Worked out what is happening. The exception is triggered by these:

rule handleComplexFoodItemClash
     enabled false
     when
         $first: ContextFoodItem( $item, true; )
         $second: ContextFoodItem( this != $item, avoid == false )
         isExampleOf( $second, $first; )
     then
         retract($second);
end

query isExampleOf (FoodItem $subject, FoodItem $category)
     (
         eval($subject == $category)
     )
     or
     (
         BroaderNarrower($broader, $subject;)
         and
         ?isExampleOf($broader, $category;)
     )
end

This is the last thing I was playing with, so maybe not surprising 
there's an error (the exception arises because of the isExampleOf query 
and is a simple bug for me to fix).

BUT BUT BUT I have "enabled false" as a rule attribute. Am I missing 
something - I expected this to mean that the when part is never 
evaluated, but it looks more like the when part is evaluated but 
consequences are not added to the agenda. The documentation is 
sufficiently terse that both viewpoints could be argued :(

Borris



More information about the rules-users mailing list