Hello I'm facing the following problem, I'm trying to insert an object into jess, firing a rule on it wich then returns this object.
Here's the rule:
(defrule petstore
( card (name ?name)(item1 ?item1) (message ?message) (item2 ?item2)
(count1 ?count1) (count2 ?count2) (OBJECT ?cart) )
(test (> ?count1 2))
=>
(printout t "More then 2 !" (get ?cart message) crlf)
(printout t " Number of " ?item1 " = " ?count1 ", number of " ?item2 " ="?count2 crlf )
(store SHOP ?cart)
)
but something goes wrong :the rule is fired twice with only one object?
I know it has something to do with the (OBJECT ?cart) but I couldnt think of a different way to send the object from jess to the java code.
java code :
ShoppingCard sh = new ShoppingCard("petstore1"); Rete rete = new Rete();
// Read in the rules
rete.executeCommand("(batch D:/school/Jess61p6/Jess61p6/jess/examples/xfer/xferCard.clp)");
rete.executeCommand("(reset)");
rete.reset();
Funcall f = new Funcall("definstance", rete);
f=new Funcall("definstance", rete);
f.add(new Value("card", RU.ATOM));
f.add(new Value(sh));
f.execute(rete.getGlobalContext());
rete.run(); Value shop = rete.fetch("SHOP");
ShoppingCard shopping = (ShoppingCard)shop.externalAddressValue(
rete.getGlobalContext());
hope someone can help me, greetings Chris
_________________________________________________________________
-------------------------------------------------------------------- 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] --------------------------------------------------------------------
