I have a few questions about how shadow facts and the “extends” keyword interact

 

If I define templates Atag and APLUStag, where APLUStag extends Atag, can I define a shadow-fact for APLUStag using a java APLUSclass without also defining an Aclass to shadow Atag? The syntax would seem to allow this, but I am not sure how well Jess would handle having some Atag’s shadowed and others not shadowed. If I must create a java Aclass, will jess require APLUSclass to extend Aclass, or is it sufficient to have a compatible properties interface?

 

The reason I am considering such an odd thing, is that I have a large number of Atag facts that get saved and restored between runs using save-facts and load-facts. My first few experiments resulted in a set of reloaded facts that had OBJECT set to nil with no associated java beans. Is a fact with OBJECT set to nil functionally the same as a non-shadowed fact, or is it an abomination that will lead to undefined behavior? Is there a standard way to save/restore a selected set of shadow facts (short of restoring the entire engine contents with bsave/bload)?

 

Let me throw in one more question related to shadow-facts. The description of defclass says “Note that it is an error for a given Java object to be installed in more than one definstance at a time.” I can see bad things happening with the same object installed twice in the same engine, but I suspect it might be safe to install the same object once in each of two separate engines. If I have more than one instance of the Rete engine running within my application, can I create a single java object and definstance it into more than one engine? This seems like it might be a nice way to let the two engines interact in a limited way, if it doesn’t violate some of Jess’s internal design assumptions.

 

Reply via email to