[rules-users] DROOLS Negate Question

Michael Anstis michael.anstis at gmail.com
Sat May 21 18:03:09 EDT 2011


Problem fixed and committed to both 5.2.x and master branches on github.

There will be a build available soon - or CR1 *should* be available
soon.....

Please note, if you are negating a rule in the mortgages example, the RHS
attempts to set values on bound facts which is invalid when the rule is
negated.

Therefore if you negate a rule you'll also need to change the RHS in the
examples to not operate on bound facts to avoid further compilation errors.

With kind regards,

Mike

2011/5/21 mahmood lebbai <mahmoodlebbai at yahoo.com>

> Thanks *Michael for the immediate response.*
> **
> *Yes.The rule has been defined in guided web editor.*
> **
> *I had taken sample respoitory ( Pricing Loan guided web editor rules) and
> added the negate option in the row-1 of the rules and Validating the rules
> throws the error posted earlier.*
> **
> *Here is the source of the rule-1 , *
> **
>   1. | #from row number: 1 2. | rule "Row 1 Pricing loans" 3. |
> dialect "mvel" 4. |     when 5. |         not ( 6. |             application
> : LoanApplication( amount > "131000" , amount <= "200000" , lengthYears ==
>  "30" , deposit < "20000" ) 7. |             income : IncomeSource( type
> == "Asset" ) 8. |         ) 9. |     then 10. |         application.setApproved(
> true ); 11. |         application.setInsuranceCost( 0 ); 12. |         application.setApprovedRate(
> 2 ); 13. | end
>
> Regards,
> Mahmood
>
>
>  *From:* mahmood lebbai <mahmoodlebbai at yahoo.com>
> *To:* "rules-users at lists.jboss.org" <rules-users at lists.jboss.org>
> *Sent:* Saturday, 21 May 2011 2:55 PM
> *Subject:* DROOLS Negate Question
>  I need help to clarify the following
>
> I had taken latest Guvnour 5.2.0 M2 version and use the sample pricing loan
> rules.
>
> When i tried to use the "Negate" Meta data option and set it to true on
> first rule , i had got the following error.
>
>
>   Pricing loans] [ERR 102] Line 7:3 mismatched input 'income' in rule "Row
> 1 Pricing loans"  [Pricing loans] Line 16:0 unexpected exception at input
> 'rule'. Exception: java.util.EmptyStackException. Stack trace:
> java.util.EmptyStackException at java.util.Stack.peek(Stack.java:79) at
> java.util.Stack.pop(Stack.java:61) at
> org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:409) at
> org.drools.lang.ParserHelper.end(ParserHelper.java:723) at
> org.drools.lang.DRLParser.rule(DRLParser.java:915) at
> org.drools.lang.DRLParser.statement(DRLParser.java:248) at
> org.drools.lang.DRLParser.compilationUnit(DRLParser.java:143) at
> org.drools.compiler.DrlParser.compile(DrlParser.java:225) at
> org.drools.compiler.DrlParser.parse(DrlParser.java:71) at
> org.drools.compiler.DrlParser.parse(DrlParser.java:76) at
>  I have a similar requirement where in I need to write both negate with
> true and false within the same ruleset in guvnour. Please help me out how to
> achieve this.
>  Regards,
> Mahmood
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110521/c7d297c4/attachment.html 


More information about the rules-users mailing list