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
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to