Krister,

   Well, the best way to write the rule is indeed without that "or", since it will generate unneeded subrules. To achieve best performance and results would be better to do (using new features from MR3):

rule "Buyer neutral"
when
                $c : CallContext(cause == "checkout", state == "new")
                Order( buyer.prospect == true )
                Quality( value in ( 1, 2 ) )
then
                $c.setState("neutral");
end

    But what you reported is a problem anyway, so, if you can open a JIRA and attach a test case, I really appreciate. I will look at it and fix as soon as possible.

    []s
    Edson

2007/6/28, Krister Saleck <krister.saleck@mytoys.de>:

Hi,

thanks for the new features in 4.0MR3 - now i may get rid
of some of my workarounds :-)

Unfortunately one problem still pops up in MR3:

Some generated code causes a ClassCastException while casting to
a implementation class. Because JBossRules wraps Facts by a generated
class implementing the facts interface, there should only be some
casting to the interface class?!

---
caused by: java.lang.ClassCastException : de.myToys.CallContextImpl
        at
de.myToys.konsum.core.account.rules.Rule_Buyer_neutral_0Eval0Invoker.eva
luate(
                Rule_Buyer_neutral_0Eval0Invoker.java:12)
        at
org.drools.rule.EvalCondition.isAllowed (EvalCondition.java:71)
---
rule "Buyer neutral"
        when
                $c : CallContext(cause == "checkout", state == "new")
                $order : Order()
                (Quality(value == 1) or Quality(value == 2))
                eval($order.getBuyer().isProspect())
        then
                $c.setState("neutral");
end
---

If I execute the rule without the "or" term i do not run into
that problem.... bad rule style?

Did anyone have a hint?

Thanks in advance,
Krister

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com