Hi!

>I'm doing some experiments with mutiple engines within the same
>process and I hit the following issue. I'd like to construct a
>function that lets me assert a fact in a different engine - i.e.
>I'd like to do something like

>(defrule ..
>    (some-fact ?parameter)
>    (other-engine-instance ?rete)
>    =>
>    (assert-across-engines ?rete (a-new-fact ?parameter))
>..)

You have to do two different things:

(1) create a new fact
(2) assert it in the given target engine

I'm making this very explicit because there are some options that might
depend on other support functions yet to be implemented.

(1) You will have to create that fact on your rule RHS. With the current
Jess parser you can only do this using the (assert) function, because,
using your syntax above, the Jess parser will interpret

     (a-new-fact ?parameter)

as a function call. So, currently, creating a fact also involves asserting
it. At least temporarily.

I also had the same problem once. I modified the Jess parser, which
interprets a form (<head> <p1> ... <pN>) as a function call, if <head>
doesn't equal "assert". I discussed this "problem" with Ernest and he
proposed to introduce a new (fact) function that only creates but does not
assert a fact. The two options are thus:

Option A using (assert), (assert-across-engines) doesn't retract the fact:

     (bind ?fact (assert (a-new-fact ?parameter)))
     (assert-across-engines ?rete ?fact)
     (retract ?fact)

Option B using (fact), yet to be implemented:

     (assert-across-engines ?rete (fact (a-new-fact ?parameter)))

(2) Asserting the fact in the target engine is straightforward.

Option A works right out of the box. I'd vote for the introduction of a
(fact) function, though. After all, it seems to be pretty useful.

Greetings

Thomas

________________________________

Dipl.-Inform. Thomas Barnekow
                                              
 phone: +49 (0) 172 / 7126018                 
                                              
 email: [EMAIL PROTECTED]                
                                              




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