Looks like a bug on the offset calculation of the last "from"
pattern. Can you please open a JIRA with the information from your
e-mail?
Meanwhile, as a workaround, try to use the "or" as the last CE in
your rule, i.e.:
when
$ldes : Set(size == 2) from collect(LoopDetectorEvent() over
window:length(2))
LoopDetectorEvent($t3 : transportation == "BUS", $id3 : eventID) from $ldes
(or LoopDetectorEvent($t1 : transportation == "LKW", $id1 :
eventID) from $ldes
LoopDetectorEvent($t2 : transportation == "PKW", $id2 :
eventID) from $ldes)
Edson
2011/1/10 OlliSee <o.roess(a)seeburger.de>:
Hello there and a happy new year to everyone reading :)
Why am I here again? Yep, got a problem. Don't know why it doesn't work. I'm
using the latest snapshot version.
So here it goes.
A simple rule with conjunction and disjunction but over a set of events.
when
$ldes : Set(size == 2) from collect(LoopDetectorEvent() over
window:length(2))
(or LoopDetectorEvent($t1 : transportation == "LKW", $id1 :
eventID) from
$ldes
LoopDetectorEvent($t2 : transportation == "PKW", $id2 : eventID)
from
$ldes)
LoopDetectorEvent($t3 : transportation == "BUS", $id3 : eventID)
from
$ldes
So, what the rule says: fire when there's a BUS event plus either a LKW or
PKW event in the set.
But, instead I get a big exception. It's posted at the end.
Interestingly, it works if I don't use the Set, like this...
when
(or $e1 : LoopDetectorEvent($t1 : transportation == "PKW", $id1
: eventID)
over window:length(1)
$e2 : LoopDetectorEvent($t2 : transportation == "LKW", $id2 :
eventID)
over window:length(1))
LoopDetectorEvent($t3 : transportation == "BUS", $id3 : eventID)
over
window:length(1)
but that rule does not have the same meaning. So it's useless for me.
Besides, it DOES work with the set if I just cut the third event out (the
BUS event).
What is wrong here?
Thanks in advance.
Kind regards!
Oliver
Exception in thread "Thread-2" java.lang.ClassCastException:
org.drools.reteoo.InitialFactImpl cannot be cast to
trafficsys.domain.events.LoopDetectorEvent
at
org.drools.base.trafficsys.domain.events.LoopDetectorEvent446196$getTransportation.getValue(Unknown
Source)
at org.drools.base.ClassFieldReader.getValue(ClassFieldReader.java:91)
at
org.drools.base.evaluators.EqualityEvaluatorsDefinition$StringEqualEvaluator.evaluate(EqualityEvaluatorsDefinition.java:1961)
at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:92)
at org.drools.rule.LiteralConstraint.isAllowed(LiteralConstraint.java:109)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:264)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:138)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:64)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:279)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:138)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:64)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:662)
at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
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:1187)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1089)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:893)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:238)
at trafficsys.SessionInterface.insertAndFire(SessionInterface.java:133)
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Why-won-t-this-work-C...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com