Doesn't retracting all objects then inserting new objects cause the
rules to be evaluated for the objects currently in working memory?
Do I need to use Stateless instead of Stateful or something?
Thanks,
Chris
On 8/19/2011 7:47 PM, Wolfgang Laun wrote:
A condition based on the negated existence quantifier
is true when no such object is in the WM. Once recognized as true,
the rule fires, and that's it until it isn't true any more, which
is a sort of "rewind" for the condition after which the begin of
another period of absence is celebrated with another firing.
Repeated stop-and-go of the rule engine does not influence this
monitoring of truth.
Well..I insert some
objects, fire the rules and this rule will trigger the first
time (when it finds no object with those characterstis) but
every time after than when I insert more objects and fire
the rules, the rule never fires again. I have no idea why.
Here is my simple test case.
Two clasess: TestMain and TestObject and rule file Test.drl
I have included below.
It insterts a group of facts at one time, fires the rules,
and retracts all those facts from the stream. I have an
event listener on the session, as you see to verify
injections and retractions are occuring.
So the rule fires on the first batch, but on no other
batches after that???? What gives????
Among the Inserttion and retraction events I only see:
A proper object does not exist
One time, during firing rules on the first batch. Why does
this rule never fire again, even though every single batch
of objects I insert/retract does not contain the proper rule
values, and so should fire the rule.
How do I fire a rule if an object
with certain characterstics does not
exists.
For example my class Foo, if I have a rule:
rule "Identify Foos with values"
when
Foo(stringProp=="blah", intProp==5)
then
System.err.println("A Foo was found!");
end
So how do I check for lack of existence of an object
with certain
characteristics
I tried:
rule "Flag missing Foos with values"
when
not(Foo(stringProp=="blah", intProp==5))
then
System.err.println("A proper foo does not
exist");
end
That's the way to do it.
I also tried:
rule "Flag missing Foos with values"
when
not(exists(Foo(stringProp=="blah",
intProp==5)))
then
System.err.println("A proper foo does not
exist");
end
Since not( Foo(...)) means "if no Foo(...) exists",
the addition of "exists" is superfluous and generally
considered bad style (even though some systems accept
it to mean just "not".