you would not call drools.modifyObject if you just were storing the result of some calculation in a consquence, that really has nothing to do with other rules firing. as modifyObject causes all the rules to be checked against again etc... But you would use modifyObject if you were changing the state such that a whole stack of other rules may now apply.
Mark may be able to correct me, but in drools 3.0 calling modifyObject may not be necessary, and it will be easier to track what facts have changed. I don't think it currently tracks what objects were modified by modifyObject, but it would be pretty easy to via many means (adding in event listeners is one way - you can easily trap all the events of objects being modified and build up a map of them if you like). You can register a listener with the working memory, and it will tell you each time an object is modified. On 12/30/05, Jonathan Lundquist <[EMAIL PROTECTED]> wrote: > > What would be the difference between modifying the state of the object > and using drools.modifyObject? I know they're two different steps, but > if you change the state of the object, wouldn't you always want to call > modifyObject right after that? Or are there times you would do one without > the other? I'd be interested to know if this is the case. > > Michael Neale <[EMAIL PROTECTED]> wrote: Not off the top of my head > (I may be missing something obvious). > > Do you mean modified as in the state of the object is modified, or > modified > in terms of drools.modifyObject? > > PropertyChangeListeners are always are always an option to capture state > changes. > > On 12/30/05, Jonathan Lundquist wrote: > > > > If there isn't a way to do with with the JSR94 api stateful session, is > > there a way with the standard drools interface (rule base, working > memory, > > etc) to fireAllRules and get just the facts that have changed as a > > result? I've mostly only worked with Drools through the JSR94 api so > far > > and not with the direct Drools objects/interfacts. > > > > Thanks again! > > Jonathan > > > > ------------- > > Is there a way, when using the JSR94 api for Drools and using a > > StatefulRuleSession to find only those facts that have changed upon > > execution of the executeRules method? I understand, as with all rules > > engines, that executing all the rules in the fact base can assert new > > facts, retract existing ones, and update existing ones. So the real > > question is, can you get just the facts that currently exist in the > working > > memory that were changed or added by the last executeRules() method > call? > > > > Here is the basic sequence: > > (1) load a base set of lots of facts into the fact base > > (2) assert a few more facts > > (3) executeRules & find which facts changes (& still exist) > > (4) assert a few more facts > > (5) executeRules & find which facts changes (& still exist) > > > > I thought that a way to do this might be to use the > StatefulRuleSession > > 's getObjects() method that takes a parameter. However, > > I looked at the drools jsr94 code base (the online cvs repository) and > > didn't see any implementation of the ObjectFilter class. Is this the > case > > -- Object filter is not implemented and not currently supported by > drools' > > jsr94 implementation? If it is implemented, could someone tell me > how to > > use it, what its uses are, etc? > > > > Is there another approach that will let me get just those objects from > > the StatefulRuleSession that have changed upon calling executeRules? > > > > Thanks! > > > > > > > > > > > > > >