Conceptually you are right, but in practice, when you add a rule/query
to the KBase all the available facts are propagated through the newly
built piece of RETE. Since you clear all the rules first (which has some
cost)
and then you build a new set of rules, the effect is very similar - only,
the engine will implicitly re-insert the objects for you.
Now, a clean insertion has some costs (like the creation of the handles),
so it would be interesting to benchmark the two alternatives.
From a developer's perspective, moving the objects from a session
into
another is as simple as this:
for ( Object o : oldSession.getObjects() ) {
newSession.insert( o );
}
and if you can't (re)compile the source code, there is little that can be
done to solve your problem. Unless there is a multi-threading issue,
that is, you have different threads adding facts, removing rules/queries
and adding the new ones. If that was the case, I would not be surprised
since 5.5 was not thread safe.
Davide
On 07/15/2014 02:29 PM, braveheart85 wrote:
My users can apply a filter (query in Drools) and the result facts
are tagged
to be shown.
Filters can be from a filter library or also directly written by users.
I need to clear the production memory and set new knowledge (filter) each
time in order to get filter result.
First solution you propose is a bit problematic for me because i'd have to
reinsert all facts inside the working memory but I don't keep these objects
outside Drools. In my context facts are fixed while rules/queries are
variables. I'd have to query Drools for all facts, then instantiate a new
KnowledgeBase and finally reinsert all facts...
What do you think?
Thanks
Andrea
--
View this message in context:
http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users