I've got a global variable, which I refer to in an eval() , but the eval()
always just sees null.
I assert all my facts into WM /before/ I set the global variable, so I understand
that initially, the variable will be null when the condition is first evaluated.
But after I set the global variable, I assert additional facts, which trigger
other conditions of that rule:
rule "Create block rules for unauthorized resources in same network"
when
$r : Resource()
not AuthorizedResource(resource == $r)
eval (Tester.doNetworksIntersect($p, $r))
then
BlockRule block = new BlockRule();
block.resource = $r;
assert(block);
end
The "$p" in the eval is the global variable. I create new AuthorizedResource
objects after I set the global, so I figured the rule would be re-evaluated,
the eval() along with it. Sorry for lack of knowledge, I'm completely new
to rule's engines, and still don't fully understand how Rete works. Is the
result of the eval() cached initially and never re-evaled? If so, how are
eval() blocks ever activated again? Is that determined by the fact bindings
which are used (like when $r is modified, that activates the eval() block
since r$ is referred to inside it)? Thanks.