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 <[EMAIL PROTECTED]> 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
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to