|
I'm new mexican Jess's user, I don't speak
english very well, sorry.
I'm use Jess for to develop a Expert System, my
idea is use Java for the interfaz and Jess for KB. Now I'm make
small examples, but I've the problem that I'm trying to build rules
that receive arguments of a bean in Java. For
instance, if I (assume properly) define a bean in java like this: public class Datos
{ When I give value here, I've not
problem. But I need obtain with methods (In the future I'll make applets). My
idea is obtain the value of variables from a applet, and send this to the
KB.
private String m_temp;//= "anual";
(1)
private int m_pluvial;//= 1500; public void setTemp(String temp)
{ String tmp = m_temp; m_temp = temp; pcs.firePropertyChange("temp", tmp, m_temp); }
public void setPluvial(int pluvial) { int tmp = m_pluvial; m_pluvial = pluvial; pcs.firePropertyChange("pluvial", new Integer(tmp), new Integer(m_pluvial)); } public String getTemp() { return m_temp; } public int getPluvial() { return m_pluvial; } private PropertyChangeSupport pcs = new
PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener pcl) { pcs.addPropertyChangeListener(pcl); } public void removePropertyChangeListener(PropertyChangeListener pcl) { pcs.removePropertyChangeListener(pcl); } }
And my KB in Jess is:
(defclass evapo Datos) (bind ?sb (new Datos)) (definstance evapo ?sb dynamic) ...
(defrule alfalfa
(evapo (temp "anual")(pluvial ?x&:(> ?x 600)&:(< ?x 1500))) => (assert (producto (name alfalfa)(min 600) (max 1500))) (printout t "* Alfalfa" crlf) ) ... 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.
I don�t if somebody understand me, but if you
can help me, I would be eternally grateful.
|
- Re: JESS: To give arguments from Java to Jess Jahir Cruz
- Re: JESS: To give arguments from Java to Jess Thomas Barnekow
