[rules-users] Fetching Facts from WM...
Steven Williams
stevearoonie at gmail.com
Mon Apr 9 23:15:34 EDT 2007
Two ways you could do it:
List list = workingMemory.getObjects(Target.class);
or use a query:
drl:
query "target objects"
Target()
end
code:
QueryResults results = workingMemory.getQueryResults( "target objects" );
cheers
Steve
On 4/10/07, jdepaul <jjdepaul at us.ibm.com> wrote:
>
>
> Suppose my client code initially asserts two Facts into WorkingMemory
> instance: one Source object and one TargetOne object. As the rules get
> applied, some of the rules may assert additional Target facts into WM.
> How
> can I retrieve all of the Target facts (however many were created) from
> the
> WorkingMemory after fireAllRules() method was called (regardless of how
> many
> Target objects were created as a result)?!
>
> I will not know the concrete type of the target object types that were
> asserted into WM instance, as they can be as many as 7 class sub-types
> (TargetOne, TargetTwo, TargetThree), though they will all share a common
> super-class (com.mypackage.Target). Can someone show an example on how to
> fetch the resulting Target objects after fireAllRules() is called and
> filter
> out the Target objects?
>
> Thanks in advance -
> James
>
> --
> View this message in context:
> http://www.nabble.com/Fetching-Facts-from-WM...-tf3550451.html#a9912199
> 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
>
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw at objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070410/6d352897/attachment.html
More information about the rules-users
mailing list