[rules-users] query or global

Ingomar Otter iotter at mac.com
Mon Jul 28 09:33:36 EDT 2008


 >what are disadvantages and advantages of the following  
possibillities to to
 >get access to working memory facts from outside:
Is there a reason why you want to use something other than queries?
  I would suggest to use queries _unless_ you have a definitive   
requirement that requires something else. Queries are easy and you get  
constraints for free.
Everything else is just work. ;-) If you need to use logicals, you  
also have to implement an event listener in your facts to track them   
properly.


Cheers
--I

Am 28.07.2008 um 15:15 schrieb thomas kukofka:

> Hello again,
>
> what are disadvantages and advantages of the following  
> possibillities to to
> get access to working memory facts from outside:
>
>
>   - -uses a query:
>
> in drl:
>
> query "queryname"
>    ...
> end
>
> in java code
>
> queryResults results = workingMemory.getQueryResults( "queryname" );
>
>   - -use globals that store facts:
>
> global java.util.HashMap service
> rule "XY"
>    when
>        f: FactX ()
>    then
>        ResultFact resultFact = new ResultFact();
>        service.put(f.getName(), resultFact);
>        insert(resultFact);
> end
>
>
> kind regards
> tom
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list