Hello, I'm writting an expert system in jess. It includes the two kinds of
templates, the ones that you can define from java (using declare from-class)
and the ones that you define directly in the clp archive. The beans are all
of the same kind, all of the contains Strings.

I've experimenting some problems when I want to execute a query that is
defined in the clp archive from java, regarding a template defined a java
bean. When i want to pass a parameter, the rules does not match with any of
the facts. Jess engine had stored the strings of the beans with "". Does
anyone can give me a tip in how to execute a query from java regarding facts
created as java bean objects???

Here is the query that i run from java:
QueryResult result;
        try {
            result = jessEngine.runQueryStar("llamados", new
ValueVector().add("metodo1"));
             while (result.next()) {
                 System.out.println(result.getString("caller_id") + " " +
result.getString("callee_id")));
                 addFanInMetric(ff);
                }
        } catch (JessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Here is the clp archive:

(import JessIntegrationModel.*)


(deftemplate Call    (declare (from-class Call)))

(deftemplate llamado_no_directo
    "comment"
    (slot caller_id)
    (slot calle_id))

(deftemplate metodoFamiliar
    (slot metodo1)
    (slot metodo2)
)

(deftemplate metodoFamiliar_counted
    (slot metodo1)
    (slot metodo2)
)


(defrule propagarLlamadas
       (declare (salience 500))
    (Call (callee_id ?metodoLlamado)(caller_id ?metodoLlamador))
    (metodoFamiliar (metodo1 ?metodoLlamado)(metodo2 ?metodoFamiliar))
    (not (metodoFamiliar_counted(metodo1 ?metodoLlamado)(metodo2
?metodoFamiliar)))
    =>
    (assert (metodoFamiliar_counted(metodo1 ?metodoLlamado)(metodo2
?metodoFamiliar)))
    (assert (llamado_no_directo(calle_id ?metodoFamiliar)(caller_id
?metodoLlamador)))
    )


(defquery llamados
    "comment"
    (declare (variables ?ln))
    (call_counted (caller_id ?Caller) (callee_id ?ln))

    )

(defquery llamadosNoDirectos
    "comment"
    (declare (variables ?ln))
    (llamado_no_directo (caller_id ?Caller) (calle_id ?ln))

    )

Reply via email to