I think Mark Egloff wrote:
> Hello there 
> 
> I have a question regarding using the Fact & Value Class within Java.
> 
> 
> - What is happening during "r.assertFact(f)", does Jess deal internally
> with a copy of "f" or is this still the original object? 

Original object.

> If I do change
> after "assert()" the values from f are they going to be considered
> within Jess ? 

The manual specifically tells you not to do this -- see section 4.7:

  "Once you assert a jess.Fact object, you no longer "own" it - it
  becomes part of the Rete object's internal data structures. As such,
  you must not change the values of any of the Fact's slots. If you
  retract the fact, the Fact object is released and you are free to
  alter it as you wish. Alternatively, you can use the
  jess.Rete.modify() method to modify a fact.


> And the other way round, means if a rule change the "f",
> do I still retrieve over the "f" the actual values ? i.e.
> 

If you retain a reference to the fact, then you can read modified
values from it, yes.


> 
> - The jess.Value has the possibility to set Values during the
> construction. But for retrieving a Context object is necessary. So where
> can I get this Context object ?  I know that this is depending from the
> current Context as mentioned in the manual.

> 
>          Rete r = new Rete();
>          r.executeCommand("(deftemplate event (slot type))");
>          Fact f = new Fact("event", r);
>          f.setSlotValue("type", new Value("A", RU.ATOM));
>          r.assertFact(f);
>          
>          Value v = f. getSlotValue(("type");
>          v.atomValue( ????? ); // which context reference have I to use
> here ?

The safest bet is r.getGlobalContext(), although if you're sure the
value won't be a variable or function call, it's safe to use "null."
This is covered in depth in the book.

> 
> 
> - I think you recommend more to use java beans and let them convert into
> facts and "back" (update the bean) instead of using directly Facts and
> Values?        


Nope, I don't recommend one over the other; if you've got Java domain
objects, go ahead and use them; but if you're not going to write them
anyway, then you don't have to.



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

--------------------------------------------------------------------
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