I think Jeffrey Hau wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
> i am new to Jess, could someone please help me with the following problem?
> 
> i am trying to assert a fact by calling a Java Object's method getFact 
> (returns a String) as follows,
> 
> engine.executeCommand("(assert (call ?x getFact))");
> 
> is there anything that's obvoiously worng with this call?

(assert) is what they call in Lisp a "special form", meaning that its
arguments are interpreted specially by the parser. In this case, the
argument is always interpreted as a literal fact -- so in the above,
it's a "call" fact, not what you intended.

There are several ways to do this: perhaps the most straightforward
way would be to use the assert-string function instead:

engine.executeCommand("(assert-string (call ?x getFact))");

If ?x is something you've just passed to Jess for the purpose of this
function call, you could skip that step and just say (assuming the
Java variable x points to that same object:)

engine.assertString(x.getFact());










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