Hi there,

 

In our system we sometimes need to reload a rules file that may
contain deftemplates. This could happen for example if a rule changes
and needs to be redefined in the system. We reload the rules file with
the updated rule. Since deftemplates cannot be redefined (without
clearing out the rules engine first), we don't allow them to be
modified; however they still may be in the file. 

 

I have seen the jess src code (jess70p1 - Deftemplate.java - line 155
"equals" method) where you check to see if a new deftemplate object
matches an existing one of the same name. If they are identical there
is no error. This works fine except where the deftemplate extends
another deftemplate. It appears that the parent id of the extended
deftemplate is different even though the parent template is identical.


 

This error can be duplicated in a single script. Consider the
following:

 

(deftemplate t1 

   (slot s1))

 

(deftemplate t2 extends t1 

   (slot s2))

 

;

; redefining t1 is no problem

;

(deftemplate t1 

   (slot s1))

 

;

; redefining t2 causes an error where you cannot redefine 

;  the template even though it is exactly the same.

;

(deftemplate t2 extends t1 

   (slot s2))

 

 

I believe what is happening is that when t1 is redefined and added to
the m_deftemplates TreeMap (Defmodule,java - line 125 "addDeftemplate"
method) it is assigned a new id which does not match the id of t1 (as
a parent) when template t2 is redefined.

 

Thanks,

 

- Howard

Reply via email to