In Jess version prior to 6, a "Fact-ID" is an integer. In Jess 6, it's
a view of the actual Fact object: a jess.FactIdValue object. It
contains a reference to the Fact object itself. So when you bind a
fact to a variable, like this:

 ?v <- (some-fact)

?v is now the Fact object, not just the number. (assert) returns the
Fact object, too. If you print a FactIdValue, You see something like
"<Fact-27>" . After using (store) in Jess with the return value of
(assert) you can just use fetch().factValue() to get the Fact object
-- just a simple dereferencing, no lookup. You're right,
findFactById(int) is indeed slow. But you don't need to use it.

I think Gang Liu wrote:
> Right. We can write actions to return fact-id to main(). Then, main() can 
> retrieve that fact by Rete.findFactByID(int id). I want to avoid this 
> because the doc claims that Rete.findFactByID(int id) is very slow.
> 
> Sorry, maybe I don't get your points.
> 
> I want to find a way of getting a handle of that fact in main(). So, I can 
> retrive slot value by Fact.getSlotValue(java.lang.String slotname).
> 
> Or, maybe there are some efficient ways you know.
> 
> thanks
> 
> Gang
> 
> 
> 
> >From: [EMAIL PROTECTED]
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: JESS: Sample Codes?
> >Date: Fri, 17 May 2002 17:40:42 -0700 (PDT)
> >
> >The return value of (assert) is a Value of type RU.FACT; you extract
> >the Fact object with factValue().
> >
> >I think Gang Liu wrote:
> >
> > > main() wants to receive that new fact created in
> > > rule's action and process it.
> > >
> > > We can use "store" and "fetch". But, is "Fact" supported as a value?
> > >
> > > thanks
> > >
> > > Gang
> >
> >
> >
> >---------------------------------------------------------
> >Ernest Friedman-Hill
> >Distributed Systems Research        Phone: (925) 294-2154
> >Sandia National Labs                FAX:   (925) 294-2234
> >Org. 8920, MS 9012                  [EMAIL PROTECTED]
> >PO Box 969                  http://herzberg.ca.sandia.gov
> >Livermore, CA 94550
> >
> >--------------------------------------------------------------------
> >To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> >in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> >(use your own address!) List problems? Notify [EMAIL PROTECTED]
> >--------------------------------------------------------------------
> >
> 
> 
> _________________________________________________________________
> Join the world�s largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to