JESS:Modular deffacts problem

2005-11-02 Thread David Firmin

Hi

I'm having a problem with deffacts and modules I was hoping someone could
help me out with.

I'm trying to use deffacts with a specific module, but am having some
problems changing out of that module once the deffacts has taken place.
At present, I'm doing the following (although I've simplified the code
here, the sense remains the same):

(defmodule ONE)
(defmodule TWO)
(defmodule THREE)

(set-current-module MAIN)

(deftemplate TWO::template-for-module-two
  (slot slot1)
)

(deffacts some-facts
  (TWO::template-for-module-two (slot1 value1))
  (TWO::template-for-module-two (slot1 value2))
)

;;; some business logic rules

(reset)

Once the code has been parsed into the Rete [ using executeCommand(String)]
I then subsequently assert some shadow fact objects before running the
rete. The problem is that the shadow facts are asserted into the TWO module
rather than the MAIN module as I would like them to be. It seems my call to
set-current-module is being overridden by the deffacts construct asserting
facts straight into the TWO module.

Is there a way around this so that once the reset command has been called,
the focus shifts back to MAIN automatically?

Any help would be gratefully received.


Many thanks
Regards
David


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]




Re: JESS:Modular deffacts problem

2005-11-02 Thread ejfried
I think David Firmin wrote:

 
 I'm trying to use deffacts with a specific module, but am having some
 problems changing out of that module once the deffacts has taken place.
 At present, I'm doing the following (although I've simplified the code
 here, the sense remains the same):

I'm afraid you've simplified things a little bit too much. The
important points are 1) when and where the defclass for your Java
objects is being done, 2) exactly how the object is being put into
working memory, and 3) what version of Jess you're using.

Jess 7.0b4 was released just today, and it fixes a bug in earlier 7.0
releases related to definstances in the presence of multiple modules,
although the symptoms don't sound precisely right.

-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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]