[rules-users] How can i delete any object after executing the rules from the memory.

Michael Anstis michael.anstis at gmail.com
Fri Oct 22 14:22:16 EDT 2010


Sure, check out KnowledgeBase's removeRule(String, String) method.
Modifications to you KnowledgeBase are going to be more expensive than with
Sessions, so ask yourself whether manipulating KnowledgeBase's at runtime is
something you really want to be doing when you (probably) will be able to
get identical function by re-thinking your approach.

On 22 October 2010 17:37, <rouvas at di.uoa.gr> wrote:

> Michael Anstis wrote:
> > If you use a StatelessKnowledgeSession you won't need to remove the old
> > facts.
> >
> > If however you want to use a StatefulKnowledgeSession for other reasons
> > the
> > insert method returns a FactHandle that can be later used to retrieve the
> > fact: ksession.retract(factHandle). Please refer to the documenation for
> > more details.
>
> That is very convenient, I've also been looking (obviously not hard
> enough) for a similar facility.
>
> Is here something similar for "retracting" rules as well?
>
> -Stathis
>
> >
> > On 20 October 2010 16:35, nkumar <nkumar at objectwave.com> wrote:
> >
> >>
> >> Hi..
> >>
> >>
> >> I want to delete the objects which i inserted earlier to execute the
> >> rules
> >> upon. Why i want this is i have two lists containing 20 objects of two
> >> different classes. for every combination i am assigning some values to
> >> the
> >> class variables in the rule file. So at any single time i want to
> >> execute
> >> rule on a single set of 2 classes.
> >>
> >> ksession.insert(object1 of class1)
> >> ksession.insert(object1 of class2)
> >>
> >>
> >> then next time i want this on
> >>
> >>
> >> ksession.insert(object1 of class1)
> >> ksession.insert(object2 of class2)
> >>
> >> and so on..
> >>
> >> I can insert all the objects once and can execute the rules on the
> >> objects
> >> but i have to save result of each combination in the list. No matter
> >> what
> >> the output is.
> >>
> >> Please suggest how can i solve this. if i have to insert only 2 objects
> >> at
> >> a
> >> time then after inserting an object,there is no use to insert that
> >> again.
> >> So
> >> how can i remove the objects from the memory after executing the rules.
> >>
> >>
> >> Thansk...appreciate your help.
> >> --
> >> View this message in context:
> >>
> http://drools-java-rules-engine.46999.n3.nabble.com/How-can-i-delete-any-object-after-executing-the-rules-from-the-memory-tp1739477p1739477.html
> >> Sent from the Drools - User mailing list archive at Nabble.com.
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101022/e438c0a9/attachment.html 


More information about the rules-users mailing list