JESS: Date: Wed, 26 Oct 2005 15:13:21 +0200
Hi I'm testing a JADE agent integrated with Jess by using the "BasicJessBehaviour" provided by the JADE platform. My testing environment consists of 2 agents : agent A and agent B wich includes the Jess engine. Agent A is sending 3 messages to agent B. Agent B uses the rules from the file thatwhich is a slightly modified version of the JadeAgent.clp so that it looks like that: (defrule proposal1"When a 'QUERY_IF' message arrives from an agent ?s, this rule asserts a 'AGREE' message to the same sender and retracts the just arrived message" (MyAgent (name ?r)) ?m - (ACLMessage (communicative-act QUERY-IF) (sender ?s) (receiver ?r) (reply-with ?id) (in-reply-to nil) (envelope nil) (conversation-id ?cid) (protocol nil) (language nil) (ontology nil) (content ?con1) (encoding nil) (reply-to ) (reply-by nil) )= (send (assert (ACLMessage (communicative-act AGREE) (sender ?r) (receiver ?s ;(assert (ACLMessage (communicative-act AGREE) (sender ?r) (receiver ?s))) (retract ?m)) (defrule proposal2"When a 'QUERY_REF' message arrives from an agent ?s, this rule asserts a 'SUBSCRIBE' message to the same sender and retracts the just arrived message" (MyAgent (name ?r)) ?m - (ACLMessage (communicative-act QUERY_REF) (sender ?s) (receiver ?r) (reply-with ?id) (in-reply-to nil) (envelope nil) (conversation-id ?cid) (protocol nil) (language nil) (ontology nil) (content ?con2) (encoding nil) (reply-to ) (reply-by nil) )= (send (assert (ACLMessage (communicative-act SUBSCRIBE) (sender ?r) (receiver ?s ;(assert (ACLMessage (communicative-act SUBSCRIBE) (sender ?r) (receiver ?s))) (retract ?m)) (defrule proposal3"When a 'REQUEST' message arrives from an agent ?s, this rule asserts a 'REFUSE' message to the same sender and retracts the just arrived message" (MyAgent (name ?r)) ?m - (ACLMessage (communicative-act REQUEST) (sender ?s) (receiver ?r) (reply-with ?id) (in-reply-to nil) (envelope nil) (conversation-id ?cid) (protocol nil) (language nil) (ontology nil) (content ?con2) (encoding nil) (reply-to ) (reply-by nil) )= (send (assert (ACLMessage (communicative-act REFUSE) (sender ?r) (receiver ?s ;(assert (ACLMessage (communicative-act REFUSE) (sender ?r) (receiver ?s))) (retract ?m)) (defrule send-a-message"When a message is asserted whose sender is this agent, the message is sent and then retracted from the knowledge base." (MyAgent (name ?n))?m - (ACLMessage (sender ?n))=(send ?m)(retract ?m)) (watch facts)(watch all)(reset) When running, I get the following strange results: Agent container [EMAIL PROTECTED]://bercaru56 is ready. == Focus MAIN == f-0 (MAIN::initial-fact) == f-1 (MAIN::MyAgent (name [EMAIL PROTECTED]:1099/JADE)) -A - QUERY_IF to B. in 1000 == f-2 (MAIN::ACLMessage (communicative-act QUERY-IF) (sender A/JADE) (receiver B/JADE) (reply-with nil) (in-reply-to nil) (envelope nil) (conversation-id I121223475640_0) (protocol nil) (language nil) (ontology nil) (content "ask QUERY_IF") (encoding nil) (reply-to ) (reply-by nil)) == Activation: MAIN::proposal1 : f-1, f-2 FIRE 1 MAIN::proposal1 f-1, f-2 perf AGREE receiver A/JADE == f-2 (MAIN::ACLMessage (communicative-act QUERY-IF) (sender A/JADE) (receiver B/JADE) (reply-with nil) (in-reply-to nil) (envelope nil) (conversation-id I121223475640_0) (protocol nil) (language nil) (ontology nil) (content "ask QUERY_IF") (encoding nil) (reply-to ) (reply-by nil)) Jess has executed 1 passes pause -A - QUERY_REF to B. in 1000 == f-3 (MAIN::ACLMessage (communicative-act QUERY-REF) (sender A/JADE) (receiver B/JADE) (reply-with nil) (in-reply-to nil) (envelope nil) (conversation-id I121223475640_1) (protocol nil) (language nil) (ontology nil) (content "ask QUERY_REF") (encoding nil) (reply-to ) (reply-by nil)) == Focus MAIN Jess has executed 0 passes pause -A - REQUEST to B. in 1000 == f-4 (MAIN::ACLMessage (communicative-act REQUEST) (sender A/JADE) (receiver B/JADE) (reply-with nil) (in-reply-to nil) (envelope nil) (conversation-id I121223475640_2) (protocol nil) (language nil) (ontology nil) (content "ask REQUEST") (encoding nil) (reply-to ) (reply-by nil)) == Activation: MAIN::proposal3 : f-1, f-4 FIRE 1 MAIN::proposal3 f-1, f-4 perf REFUSE receiver A/JADE == f-4 (MAIN::ACLMessage (communicative-act REQUEST) (sender A/JADE) (receiver B/JADE) (reply-with nil) (in-reply-to nil) (envelope nil) (conversation-id I121223475640_2) (protocol nil) (language nil) (ontology nil) (content "ask REQUEST") (encoding nil) (reply-to ) (reply-by nil)) Jess has executed 1 passes Could you please give me a hint why the second rule is not fired and the fact f3 is not retracted? Thanks for help, regards._Vladimir FlorianSenior ResearcherNational Institute for RD in InformaticsB-dul Maresal Averescu, nr.8-101-Bucharest, 011455-ROMANIAMobile: 0744
JESS: MethodNameComparator generates error in 70b3
I just updated from 70a4 to 70b3. During compile of Jess 70b3 in Eclipse, I receive the following error in MethodNameComparator.java: The method compareTo(String) in the type String is not applicable for the arguments (Object) I looked at the source files and noted the following differences: 70b3's compare() ends with: return ((String) o1).compareTo(o2); Whereas 70a4's compare ends with: return ((String) o1).compareTo((String) o2); I am using JDK 1.5.0. If I add a String cast, the error goes away under 70b3. If this is not a known problem, please let me know so as I can verify my compiler settings. Thanks, Glenn 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]
Re: JESS: MethodNameComparator generates error in 70b3
I think Semmel, Glenn S wrote: I looked at the source files and noted the following differences: 70b3's compare() ends with: return ((String) o1).compareTo(o2); Whereas 70a4's compare ends with: return ((String) o1).compareTo((String) o2); Interesting! If you look at the java.lang.String source in JDK 1.5, String is declared to implement ComparableString (which makes sense) and therefore the method compareTo(Object) is now written as compareTo(String), which also makes sense, although it's certainly surprising. This explains the compilation error, but now I wonder how some older code, still expecting compareTo(Object), will be able to run. The JVM must do some magic that, so far at least, I haven't thought about. Anyway, I'm rambling. I will put that cast into the source, but it's probably prudent to use -source 1.4 while compiling Jess itself (which also fixes this problem -- I just checked). - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov 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]
JESS: exists description in the documentation missing?
I am reading the Jess in Action book and noticed that it lists exists as a Jess' CEs but I could not find it in the online doc for version 6.1. What's the best way to test that a fact doesn't exist? The fact would be (tick 23) for example when it exists. I want to initialize it if it doesn't exist with a rule like this: (defrule tick-init (not (exists(tick ?))) = (printout t tick doesn't exist, creating it crlf) (assert (tick 0)) ) Thanks Fred 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]
Re: JESS: exists description in the documentation missing?
I think Fred Janon wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] I am reading the Jess in Action book and noticed that it lists exists as a Jess' CEs but I could not find it in the online doc for version 6.1. It's here, in chapter 2: http://herzberg.ca.sandia.gov/jess/docs/61/language.html#exists_ce What's the best way to test that a fact doesn't exist? The not CE tests for non-existence. Although what you've written sounds good in English: (not (exists(tick ?))) it's actually just silly. (exists (x)) is actually equivalent to (not (not (x))) -- i.e., It's not true that (not (x)) is true. Therefore, (not (exists (x))) is the same as (not (not (not (x, which, as you can imagine, is precisely the same as (not (x)). - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov 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]