All of the polymorphic xxxValue() methods take a Context parameter,
but not all the implementations use them. Value has a number of
subclasses; VariableValue, FuncallValue, and FactIdValue are three of
them. If you have a VariableValue, then the value has to be looked up
in the Context. If you have a FuncallValue, the Context may similarly
be used to resolve variables before the function call is evaluated. If
you have a FactIDValue, however, the Context is ignored; the same is
true for a plain Value. 

If you know that a value doesn't need to be resolved (i.e., it's not a
VariableValue or a FuncallValue) then it's always safe to pass "null"
as the Context. A safe alternative if you're not sure is
Rete.getGlobalContext().


I think Gang Liu wrote:
> Ernest
> 
> thank you for replying my email in details. You suggestion is clear enough 
> exception the following point:
> It needs a context parameter for Rete.fetch().factValue(Context c).
> 
> If FactIdValue is a view of the actual Fact and it is a simple dereferencing 
> using fetch().factValue(), do we need such a context parameter? How to get 
> that parameter? (It is a kind of lookup for me with a context.
> 
> Anything, please let me know.
> 
> thanks
> 
> Gang
> 
> 
> 
> 
> >From: [EMAIL PROTECTED]
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: JESS: Sample Codes?
> >Date: Sat, 18 May 2002 07:24:49 -0700 (PDT)
> >
> >
> >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]
> >--------------------------------------------------------------------
> >
> 
> 
> _________________________________________________________________
> 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