The variables ?ticket1 and ?ticket2 are references to shadow facts, not the Java objects themselves. If you want to bind to the Java objects, use the OBJECT slot:

defrule PS-R1
    "Conclure sur Service VoIP OK"
(TicketPS { failure == "306-1" || failure == "306-2" || failure == "306-3" } (OBJECT ?ticket1)) (TicketPS { failure == "308-1" || failure == "308-2" || failure == "308-3" } (OBJECT ?ticket2))
=>
(add (new MyMessage ?ticket1 )))

On Dec 9, 2008, at 4:47 AM, [EMAIL PROTECTED] wrote:


Hello,
My jess version : Jess71p2

I have some problem with a rule that triggers and call a java external Object My java class constructor ( MyMessage ) take as parameter another java objet ( TicketPS) ..see below When i use a String parameter in place of the My TicketPS class it works nicely … !! Any hint ?
Thanks
Philippe
----------------------------
1)  My Rules.clp:

(import emb.jess.audiphone.model.*)
(import emb.jess.audiphone.*)
(deftemplate TicketPS       (declare (from-class TicketPS)))
(deftemplate MyMessage (declare (from-class MyMessage)))
(defrule PS-R1
    "Conclure sur Service VoIP OK"
?ticket1 <- (TicketPS { failure == "306-1" || failure == "306-2" || failure == "306-3" }) ?ticket2 <- (TicketPS { failure == "308-1" || failure == "308-2" || failure == "308-3" })
=>
(add (new MyMessage ?ticket1 )))
------------------------------------------------------
2)  runtime  trace
 [java] Demo
     [java] Call engine
     [java] Jess reported an error in routine new
     [java]     while executing (new MyMessage ?ticket1)
     [java]     while executing (add (new MyMessage ?ticket1))
     [java]     while executing defrule MAIN::PS-R1.
[java] Message: Constructor not found: (new MyMessage ? ticket1).
_________________________________
3) My java code :

import emb.jess.audiphone.model.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class MyMessage  {
    private    TicketPS  AaudiTicketPS ;
    public MyMessage(TicketPS  audiTicketPS ) {
        System.out.println("TicketPS "  + audiTicketPS);
        AaudiTicketPS = audiTicketPS;
   }
}





---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







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