[rules-users] Possibly stupid question... but I have to ask

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jul 29 03:27:11 EDT 2011


On 28 July 2011 23:36, menada <eujenia at gmail.com> wrote:

> Because the fact is not already in the kbase (so i can't modify it and then
> insert it).
>

(1)
X x = new X(...);
x.setA(...);...x.setZ(...);
insert( x );

(2)
X x = new X(...);
insert( x );
modify( x ){ setA(...),..., setZ(...) }

These two sequences are logically equivalent - you'll have equal objects and
facts x at the end. But (1) is decidedly preferred because it is much less
work for the engine. Consider: the "insert" in (2) sends it on one direction
and then the modify instructs it otherwise.

-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110729/8603c77e/attachment.html 


More information about the rules-users mailing list