Would you please define unambiguously what constitutes an "invalid time"?
From your code it would appear that one time has to occur fivefold or
more often to
be "invalid".
In case any duplicates should be removed a simple high-priority rule
is sufficient:
rule killDuplicate
salience 1000
when
$f1: Fact()
$f2 :Fact( endTime == $f1.endTime )
then
retract( $f2 );
end
-W
On 24/02/2012, Benjamin Bennett <benbennett(a)gmail.com> wrote:
Trying to figure out if it can be done in a rule almost some sort of
pre
rule before other rules are triggered.
The current rule I have is
rule "RemoveInvalidEndTimestamps"
salience 100
when
$factN : Fact()
$factsToRemove : ArrayList(size>=5)
from collect( Fact(endTime==$factN.endTime))
then
List newFactsToRemove = new ArrayList();
newFactsToRemove.addAll($factsToRemove);
for(Fact n : newFactsToRemove ){
retract(n);
}
end
I am using a cloud based process . I could sort the facts and stream them
in.
Just in a few test cases there are many facts with invalid times , which
kills the speed .
>From the log I think that each collection of size>=5 , is triggered which
means triggered for 5,6,7, etc.
Just wondering if there is way to say before doing any other rules collect
up all these invalid times and remove them.
I was just going to write up a some java code and filter before feeding
facts into drools but I find the rule syntax is much easier to read for the
non software developers in my group.
--
Thanks,
Benjamin Bennett
<benbennett(a)gmail.com>