This code is actually in error; the editor *should* show an error,
although the root cause error isn't the one that's being displayed
here. Start at the top of file B, and trace through it. Note at what
point VariabilityMechanismInstance is declared, and at what point
"defmodule A" is executed. You'll see that at the time the template is
defined, there *is* no module A, so the template ends up in module B.

The set-current-module function reports an error here (try running the
code from the Jess> prompt) but for some reason, the editor isn't
displaying it; I'll have to track that down. It's not that
set-current-module isn't being executed in the editor; if you play
around when both modules have been defined, you should be able to
convince yourself that it is.

I think Felix Bachmann wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I work with 7.0a6. Here the concrete (shortened) example:
> 
> ---- Module A ----
> (defmodule A)
> (provide A)
> 
> (deftemplate RealizeRelation
>      (slot id)
>      (slot source)
>      (slot parent)
>      (slot child)
>      (slot childType)
> )
> ---- Module B ----
> (defmodule B)
> 
> (set-current-module A)
> (deftemplate VariabilityMechanismInstance
>      (slot instantiationCost)
>      (slot patternGroup)
>      (slot name)
>      (slot description)
>      (slot skills)
>      (multislot methode)
>      (slot automation)
>      (slot cost)
>      (slot owner)
>      (slot source)
>      (slot status)
> )
> (set-current-module B)
> (require A)
> (deffunction InstantiateVariabilityMechanism (?template)
>      (return (assert (A::VariabilityMechanismInstance      <---- this 
> fact ist not recognized!!!
>          (name (str-cat "Instance of " (fact-slot-value ?template name)))
>          (description (fact-slot-value ?template description))
>          (skills (fact-slot-value ?template skills))
>          (methode (fact-slot-value ?template methode))
>          (automation (fact-slot-value ?template automation))
>          (cost (fact-slot-value ?template cost))
>          (patternGroup (fact-slot-value ?template name)))))
> )
> -------
> The line after (return (assert .... shows error "Undefined function name 
> ..."
> 
> Actually provide and require should not be needed in this case because 
> the deftemplate is in the same file, only in a different module
> 
> Felix
> 
> [EMAIL PROTECTED] wrote:
> > I think Felix H. Bachmann wrote:
> > [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > 
> >>A couple of minor issues with JessDE
> >>
> >>1) the editor shows "undefined function" for a recursive function call
> > 
> > 
> > Yes, indeed. Thanks.
> > 
> > 
> >>2) the editor does not recognise (set-current-module) which leads to 
> >>undefined facts. Example: I have a module A in file A.clp. Somewhere in 
> >>the middle of that module I need some new definitions for module B. So, 
> >>inside A.clp I do (set-current-module B), write the definitions and 
> >>switch back to module A. When I now have rules that use the templates 
> >>from module B then the editor doesn't recognize that. Execution of the 
> >>code itself works just fine.
> > 
> > 
> > Editor support for set-current-module was added in 7.0a6; are you
> > using the latest release? So, for example, if you have the two files:
> > 
> > a.clp:
> > ----------------------------------------------------------------------
> > (defmodule a)
> > (set-current-module b)
> > (deftemplate foo
> >     (slot bar))
> > (provide a)
> > ----------------------------------------------------------------------
> > b.clp
> > ----------------------------------------------------------------------
> > (defmodule b)
> > (require a)
> > (defrule foo
> >     (foo (bar x))
> >     =>)
> > ----------------------------------------------------------------------
> > 
> > Neither of these files gets any error markers in 7.0a6.
> > 
> > 
> > ---------------------------------------------------------
> > Ernest Friedman-Hill  
> > Advanced Software Research          Phone: (925) 294-2154
> > Sandia National Labs                FAX:   (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]
> > --------------------------------------------------------------------
> > 
> > 
> 

[Attachment, skipping...]



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

Reply via email to