Above all, realize that only facts *insert*-ed into Working Memory can
be taken into account by rules. So, first thing, insert the Event in rule
"size". Then you can, basically, write a rule like this:
rule "size"
when
$p: RuleContext($size: getOldContext().getParent().getUsableSpace()
(30*1024*1024))
not Event( ...?... ) // (!)
then
Event event =
new Event("folder almost full", $p.getOldContext().getParent(),
new Date());
event.display();
insertLogical( event );
end
The "...?..." must be replaced by constraints that check that the
first and second argument of the Event constructor are not there in
the absent Event in the rule marked with // (!)
Cheers
-W
On 17/03/2014, Sandhya Sree <sandhyachinnaraj(a)gmail.com> wrote:
hi,
i have the following rule file :
rule "size"
when
$p: RuleContext($size: getOldContext().getParent().getUsableSpace() >
(30*1024*1024))
then
Event event = new Event("folder almost full",
$p.getOldContext().getParent(), new Date());
event.display();
end
im loading this rule file and executing the rules once in 10 seconds in a
continuous loop from my java class. assuming the when part is always true,
the event object created gets displayed each and every time once in 10
seconds. i want to create the object only once with the fact that the event
is already there.. i.e. i dont want to create the object again if it is
already created.. how can i do that?
Thanks.