[rules-users] Arbitrary problem using OR?

Edson Tirelli tirelli at post.com
Wed Sep 19 13:18:36 EDT 2007


   Bryan,

   This is a bug. May I ask you please to open a JIRA for it. I will fix and
include it into the 4.0.2 release.

   Thanks,
      Edson

2007/9/19, wasabifan <bryan.rickman at kewill.com>:
>
>
> Sure.  Here is one example (though I think it may have an
> existential/universal not error as mentioned in another post):
>
> rule "6040 Pass CA Fees"
>         when
>                 #conditions
>                 $status : ValidationPassFailStatus()
>                 exists ValidationControl(validationNo == 6040)
>                 CiLines($ciNo : ciNo, $ciLineNo : ciLineNo,
> $countryOrigin :
> countryOrigin)
>                 Country(country == $countryOrigin, canadianProvince != "",
> canadianProvince != "N")
>                 (CiLineFees(amtFee == 0, ciNo == $ciNo, ciLineNo ==
> $ciLineNo)
>                 or not CiLineFees(ciNo == $ciNo, ciLineNo == $ciLineNo))
>         then
>                 #actions
>                 System.out.println("6040 Pass CA Fees");
>                 $status.passSq(6040);
> end
>
> I have tried this with and without the parenthesis for explicitness.  It
> errors out when inserting facts for the rule:
>
> java.lang.ClassCastException:
>
> com.kewill.icustoms.customs.rules.model.ValidationPassFailStatusShadowProxy
>         at
>
> org.drools.base.com.kewill.icustoms.dbi.model.CiLines$getCountryOrigin.getValue
> (Unknown
> Source)
>         at
> org.drools.base.extractors.BaseObjectClassFieldExtractor.getHashCode(
> BaseObjectClassFieldExtractor.java:139)
>         at
> org.drools.base.ClassFieldExtractor.getHashCode(ClassFieldExtractor.java
> :173)
>         at org.drools.rule.Declaration.getHashCode(Declaration.java:272)
>         at
> org.drools.util.AbstractHashTable$SingleIndex.hashCodeOf(
> AbstractHashTable.java:489)
>         at
> org.drools.util.TupleIndexHashTable.getOrCreate(TupleIndexHashTable.java
> :280)
>         at org.drools.util.TupleIndexHashTable.add(
> TupleIndexHashTable.java:192)
>         at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:111)
>         ...
>
> However, if I break this into two separate rules, it behaves as expected
> (with the possible existensial/universal logic problem I mention above).
>
> rule "6040 Pass CA Fees"
>         when
>                 #conditions
>                 $status : ValidationPassFailStatus()
>                 exists ValidationControl(validationNo == 6040)
>                 CiLines($ciNo : ciNo, $ciLineNo : ciLineNo,
> $countryOrigin :
> countryOrigin)
>                 Country(country == $countryOrigin, canadianProvince != "",
> canadianProvince != "N")
>                 CiLineFees(amtFee == 0, ciNo == $ciNo, ciLineNo ==
> $ciLineNo)
>         then
>                 #actions
>                 System.out.println("6040 Pass CA Fees");
>                 $status.passSq(6040);
> end
>
> rule "6040 Pass CA No Fees"
>         when
>                 #conditions
>                 $status : ValidationPassFailStatus()
>                 exists ValidationControl(validationNo == 6040)
>                 CiLines($ciNo : ciNo, $ciLineNo : ciLineNo,
> $countryOrigin :
> countryOrigin)
>                 Country(country == $countryOrigin, canadianProvince != "",
> canadianProvince != "N")
>                 not CiLineFees(ciNo == $ciNo, ciLineNo == $ciLineNo)
>         then
>                 #actions
>                 System.out.println("6040 Pass CA No Fees");
>                 $status.passSq(6040);
> end
>
>
>
> Edson Tirelli-3 wrote:
> >
> >
> >    As we speak, there is no known problem in the use of this
> functionality
> > in 4.0.1.
> >
> >    Can you please provide an example of the problems you are finding?
> >
> >    Thanks,
> >      Edson
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Arbitrary-problem-using-OR--tf4481210.html#a12779845
> Sent from the drools - user mailing list archive at Nabble.com.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070919/d9b1cf5f/attachment.html 


More information about the rules-users mailing list