NotFromMismatchedToken

When using the conditional element NOT together with FROM e.g.

 

rule "rulename"
when
    $t : Tariffs( )
    not TariffItemList ( ) from $t.getTariffItemLists()
then
    //Do something
end

 

The Tariffs object contains a list of TariffItem objects.

 

You might get a rule compilation error similar to:

org.drools.rule.InvalidRulePackage: 9830: unknown:98:30 mismatched token: [90327422745from529830|@903,2742:2745='from',<52>,98:30]; expecting type THEN

 

The error indicates the location of the problem which in this case is character 30 on line 98 - this is handy when you have a large number of rules in a single DRL file and the rule that caused the failure is not reported.

 

The compiler is reporting that your syntax is incorrect.

 

The correct syntax is:

 

rule "rulename"
when
    $t : Tariffs( )
    not ( TariffItemList ( ) from $t.getTariffItemLists() )
then
    //Do something
end