Hello
I am a beginner in Drools 5.1.1 and try to use 'memberOf' operator.
Simply I want check whether a short field 'f' (belonging to Item class) 
is a member of an array 'a': retrieved by a function 'makeA'.
In my .drl file I try with :

function Short[] makeA() {
   return  (new Short[] {1, 2, 3} );
}

rule "chek"
when
   a: Short[]() from makeA()
   i: Item ( f memberOf a )
then
... 'f' is member of array 'a' !
end

I have following stack trace:
java.lang.ClassCastException: Can't check if an attribute is member of 
an object of class class java.lang.Short
at 
org.drools.base.evaluators.SetEvaluatorsDefinition$BaseMemberOfEvaluator.evaluateCachedRight(SetEvaluatorsDefinition.java:532)
at 
org.drools.rule.VariableRestriction.isAllowedCachedRight(VariableRestriction.java:117)
at 
org.drools.rule.VariableConstraint.isAllowedCachedRight(VariableConstraint.java:121)
at 
org.drools.common.SingleBetaConstraints.isAllowedCachedRight(SingleBetaConstraints.java:151)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:125)
at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at 
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
at 
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)

In :
http://lists.jboss.org/pipermail/rules-users/2008-October/006746.html
and
http://lists.jboss.org/pipermail/rules-users/2007-September/003010.html
I haven't found the solution to my problem.

I don't know if it is already open a related issue.

Thanks for your attention.
Regards.

Marco Malziotti
Tecnologie nelle Reti e nei Sistemi T.R.S. S.p.A.
Integration Test Engineer
Tel.  + 39 06.87281.407
Fax.  + 39 06.87281.550
E-mail: [email protected]


Tecnologie nelle Reti e nei Sistemi T.R.S. SpA
Via della Bufalotta, 378 - 00139 Roma
Tel +39.06.87.28.1.1 - Fax +39.06.87.28.1.550

-------------------------------------------------------
 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni contenute in questo 
messaggio 
sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in 
parola Le 
fosse pervenuto per errore, la preghiamo di eliminarlo senza copiarlo e di non 
inoltrarlo 
a terzi, dandocene gentilmente comunicazione. Grazie.
This message, for the law 196/2003, may contain confidential and/or privileged 
information.
If you are not the addressee or authorized to receive this for the addressee, 
you must not 
use, copy, disclose or take any action based on this message or any information 
herein. 
If you have received this message in error, please advise the sender 
immediately by reply 
e-mail and delete this message. Thank you for your cooperation.

-------------------------------------------------------

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to