Hi!

>The problem now is that the KB isn't receive nothing, but if I gived
static values of the variables in my
>class Datos, the rules are fired (1). But I need that the value are
dynamics.

Looking at your rule below, it is quite clear why that happens.

>(defrule alfalfa
>    (evapo (temp "anual") (pluvial ?x&:(> ?x 600)&:(< ?x 1500)))
>         =>
>    ...)

The rule matches objects satisfying the follwowing condition (stated in
Java using your member variables):

     m_temp.equals("anual") &&
     ((600 < m_pluvial) && (m_pluvial < 1500))   // 600 < m_pluvial < 1500

An object initialized with the default values (m_temp == null, m_pluvial
== 0) does not satisfy the conditions.

I have added the following constructor to your class:

  public Datos(String temp, int pluvial) {
    m_temp = temp;
    m_pluvial = pluvial;
  }

This constructor can be used from Jess as follows:

(definstance evapo (new Datos "anual" 1200) dynamic)

Running the engine after defining an instance using appropriate parameters
will make your rule fire.

I attached the modified Java class (Datos.java) and a Jess script
(datos.txt) that demonstrates its use. Just try it...

Greetings

Thomas

(See attached file: Datos.java)(See attached file: datos.txt)

________________________________

Dipl.-Inform. Thomas Barnekow
Fraunhofer IAO, Competence Center Software Technology
                                               
 mail:   Nobelstra�e 12, D-70569 Stuttgart,    
         Germany                               
                                               
 phone:  +49 (0) 711 / 970 - 2346              
                                               
 fax:    +49 (0) 711 / 970 - 2300              
                                               
 mobile: +49 (0) 172 / 7126018                 
                                               
 email:  [EMAIL PROTECTED]            
                                               
 web:    http://www.swt.iao.fhg.de             
                                               


=?iso-8859-1?Q?Datos.java?=

Text - character set unknown

Reply via email to