I think that *Venkat Kasuganti* said:
When I execute this code I get only the last fact ie blue printed.  I
need both facts printed. Is there a specific function to search the
working memory to test the existence of fact based on the head?

To be clear, if you want to test for the existence of a particular fact
type, you would use Jess's "exists" conditional element in your rule fact
pattern.  However, this will only tell you that at least one fact of a
particular type exists in working memory.  Judging from your code, you want
to access all data that was saved using Jess's store/fetch mechanism.
Jess's store and fetch mechanism is just a hashmap.  In your code, you only
print one value at a time because you are only retrieving one value at a
time by its key.

I might be wrong, but as far as I can see in Jess's API, Ernest doesn't
expose the underlying hashmap object -- just wrappers around put/get.
Otherwise, you could just call its keySet() method and loop through fetch()
using each key.  One workaround is to store your keys in some other
accessible data structure as you assert your facts.

Perhaps Ernest can tweak this for 7.1 and provide a Rete

   public Set getStorageKeys() {}

method or something.

Cheers,
Jason

-----------------------------------------------------------
Jason C. Morris
Worcester Polytechnic Institute     Phone: (508) 831-5006
Department of Computer Science      FAX:   (508) 831-5776
Fuller Laboratories - Room 312      [EMAIL PROTECTED]
Artificial Intelligence Lab (AIRG)
100 Institute Road
Worcester, MA 01609-2280
-----------------------------------------------------------

Reply via email to