I'm a new jess user, and am very impressed with the system. We're
using it as agent internals for agent-based intelligent information
access research. (http://www.ics.uci.edu/~burke/donna/, for those
interested.)

Here's my question: (I'm using 4.4 if that makes a difference...)

I have many "definstance" type shadow facts that correspond to java
objects. I need to use rules to detect facts and then call Java
methods with the facts as arguments.

Here is a simplified example of how I'm doing it now:

(defrule foo
       (bar (property1 5) (OBJECT ?factO))
        =>
        (call ?*BOUND_OBJECT* baz ?factO))

(where baz is a method on the object bound by the *BOUND_OBJECT*
global that take bar-type objects as an argument.)

It works, but it feels like a bit of a kludge. I only discovered the
"OBJECT" slot by looking around at internals. This usage is not
documented anywhere. Is this an "approved" method of getting objects
out?

It seems that it would be cleaner to say:

       ?fact <- (bar (property1 5))
        =>
        (call ?*BOUND_OBJECT* ?fact)
        
but, of course, fact in this case is bound to the fact-id, not the
external address object. I also had this problem with plain facts --
there doesn't seem to be any straightforward way to "export" a fact to
a Java function call as a ValueVector. After matching it on the
LHS, all you have is a fact-id.

I'm wondering if there is a Jess function I don't know about that
takes a fact-id and returns the fact it refers to. If there isn't,
this seems like a desirable thing to have -- is there some other way
to accomplish the same goal? I noticed that findFactByID is public in
the Rete class, but its usage is also not documented and there are
some warnings associated with it. Personally, I'd rather have this
conversion happen inside of Jess -- fact-ids should be its problem,
not the application programmer's. I might contribute such a thing
(gotta love that open source model), but would like to understand the
issues involved a bit better before I do.

Any thoughts on this question appreciated.

-- 

robin
=:-{)
University of California, Irvine
Information and Computer Science Dept.

http://www.ics.uci.edu/~burke/

"The universe is made of stories, not of atoms" - Muriel Rukeyser
---------------------------------------------------------------------
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