I think Henrique Lopes Cardoso wrote:
> 
> In the Jess documentation (more specifically in "The Jess Language" 
> section) the following is written:
>     +If you don't specify a module, all deffacts, templates and rules 
> you define will automatically become part of the current module;
...
> 
> Are all these results ok, is there a bug in Jess, or am I missing something?

You're trying to make something very simple into something very
complicated. You *do* have to understand a few things, first, but all
of these things are documented:

1) When you assert a fact, Jess first looks for an existing
defftemplate it can use (we'll talk about this searching below, in
point #2.)  If Jess finds no matching template, then if the fact
appears to be an ordered fact -- i.e., no slots are given -- then Jess
will automatically create an appropriate deftemplate (we'll also say
more about this in a moment in point #3). If it's an unordered fact --
one with slots -- and there's no matching template, then that's an
error.

2) When looking for a deftemplate, whether it's parsing a rule or an
assert function call, Jess always looks in the current module
first. If the template isn't in the current module, MAIN is
searched. If the template isn't in MAIN, then the search fails.

3) When creating a template, Jess will always create it in the current
module -- unless, of course, its name explicitly contains a module name.

That's it. Using these three points, you should be able to explain all
of your observations. Generally, the rules are designed to make MAIN
into a "global template space"; templates defined in MAIN can be
easily used from any other module without writing "MAIN::" all the
time. Templates defined in modules beside MAIN have to be explicitly
qualified by the module names to be used outside of the module they're
defined in.

Note that the quote you give above is from section 2.10.1 of the Jess
6 manual; section 2.10.2 contains much of the additional information
I've shown here.







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




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