Re: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess
You cannot call the action() method of a Behaviour subtype. One of the paradigms to make an Agent do some useful work is to send it messages, and the agent's behaviour (typically a CyclingBehaviour) processes these messages. The message contents could be processed by a Jess engine. Develop an Agent capable of receiving and printing messages, without Jess. Make sure that it works. Separately, develop a Java program running Jess and inserting facts from Java, and observe that your rules fire. If you have any problems, post *full* code on this list. -W On 11/07/2012, lyes wrote: > > Hello, > Sorry To disturb you, > > My Objective with jess is to run the behaviours of agent. > > in méthode setup () i insert in the template information as contenu ..etc, > and i make rules to resound. > > in my class "Test1" i have : > > public class Test1 extends Agent{ > > > > protected void setup() { > > > (insertion into template). > } > > > And i have somme behavours as fo exemple behaviour to make addition. > > public class Addition extends OneShotBehaviour { > > > @Override > > public void action() { > > > > // TODO Auto-generated method stub > > > Make (A + B). > > > } > > > > in jess : > -- > I make rule to run behaviours. For exemple : > (deftemplate ACLMessage (slot contenu)) > > (defrule test (ACLMessage (contenu A)) => ( rune behaviour addition ). > > But i have 2 problem : when a assert into template from java, he don't make > it. the seconde problem is to rune behaviour. > > Thank's for all > Date: Wed, 11 Jul 2012 06:22:11 -0700 > From: ml-node+s2305737n4654079...@n4.nabble.com > To: clarke_ste...@hotmail.com > Subject: Re: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess > > > > In your setup() method, do something like > > > Rete engine = new Rete(); > > try { > > engine.store("AGENT", this); > > engine.batch("ex.clp"); > > Value v = engine.executeCommand("(assert(ACLMessage(contenu A)))"); > > engine.executeCommand("(run)"); > > ... > > > Then in Jess code, you can get access to the "Test1" object by calling > > > (fetch "AGENT") > > > And call Java methods on that object as needed. I'm afraid I can't help > > any more than that, since you haven't told us anything about what > > "activating a behavior" might entail. > > > > > On 7/11/12 7:36 AM, "lyes" <[hidden email]> wrote: > > >>Hello, > >> > >>I wish activate a behavior of agent from jess. > >> > >>Exemple : > >> > >>My class Agent > >>-- > >>public class Test1 extends Agent{ > >> > >> protected void setup() { > >> > >> System.out.println ("Agent " + getLocalName()+ " I am here > >>"); > >> > >> Rete engine = new Rete(); > >> try { > >> engine.batch("ex.clp"); > >> Value v = >> engine.executeCommand("(assert(ACLMessage(contenu A)))"); > >> engine.executeCommand("(run)"); > >> > >> } catch (JessException e) { > >> // TODO Auto-generated catch block > >> e.printStackTrace(); > >> } > >>} > >> > >> > >>public class MyAction extends OneShotBehaviour { > >> > >> @Override > >> public void action() { > >> > >> // TODO Auto-generated method stub > >> > >> System.out.println ("Agent " + > >>getLocalName()+ > >>" I am here "); > >> > >> } > >> > >> } > >>} > >> > >>My file ex.clp > >>-- > >>(deftemplate ACLMessage (slot contenu)) > >>(defrule test (ACLMessage (contenu A)) => [// i wish activate behaviour > >&
RE: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess
Hello, Sorry To disturb you, My Objective with jess is to run the behaviours of agent. in méthode setup () i insert in the template information as contenu ..etc, and i make rules to resound. in my class "Test1" i have : public class Test1 extends Agent{ protected void setup() { (insertion into template). } And i have somme behavours as fo exemple behaviour to make addition. public class Addition extends OneShotBehaviour { @Override public void action() { // TODO Auto-generated method stub Make (A + B). } in jess : -- I make rule to run behaviours. For exemple : (deftemplate ACLMessage (slot contenu)) (defrule test (ACLMessage (contenu A)) => ( rune behaviour addition ). But i have 2 problem : when a assert into template from java, he don't make it. the seconde problem is to rune behaviour. Thank's for all Date: Wed, 11 Jul 2012 06:22:11 -0700 From: ml-node+s2305737n4654079...@n4.nabble.com To: clarke_ste...@hotmail.com Subject: Re: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess In your setup() method, do something like Rete engine = new Rete(); try { engine.store("AGENT", this); engine.batch("ex.clp"); Value v = engine.executeCommand("(assert(ACLMessage(contenu A)))"); engine.executeCommand("(run)"); ... Then in Jess code, you can get access to the "Test1" object by calling (fetch "AGENT") And call Java methods on that object as needed. I'm afraid I can't help any more than that, since you haven't told us anything about what "activating a behavior" might entail. On 7/11/12 7:36 AM, "lyes" <[hidden email]> wrote: >Hello, > >I wish activate a behavior of agent from jess. > >Exemple : > >My class Agent >-- >public class Test1 extends Agent{ > > protected void setup() { > > System.out.println ("Agent " + getLocalName()+ " I am here >"); > > Rete engine = new Rete(); > try { >engine.batch("ex.clp"); > Value v = > engine.executeCommand("(assert(ACLMessage(contenu A)))"); > engine.executeCommand("(run)"); > > } catch (JessException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } >} > > >public class MyAction extends OneShotBehaviour { > > @Override > public void action() { > > // TODO Auto-generated method stub > > System.out.println ("Agent " + >getLocalName()+ >" I am here "); > > } > > } >} > >My file ex.clp >-- >(deftemplate ACLMessage (slot contenu)) >(defrule test (ACLMessage (contenu A)) => [// i wish activate behaviour >MyAction Defined in Agent java for excute instructions//]) > >Please Help me. >Thank's > > >-- >View this message in context: >http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp46 >54077.html >Sent from the Jess mailing list archive at Nabble.com. > > >To unsubscribe, send the words 'unsubscribe jess-users [hidden email]' >in the BODY of a message to [hidden email], NOT to the list >(use your own address!) List problems? Notify [hidden email]. > To unsubscribe, send the words 'unsubscribe jess-users [hidden email]' in the BODY of a message to [hidden email], NOT to the list (use your own address!) List problems? Notify [hidden email]. If you reply to this email, your message will be added to the discussion below: http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp4654077p4654079.html To unsubscribe from Activate a Behaviour Jade from Jess, click here. NAML -- View this message in context: http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp4654077p4654081.html Sent from the Jess mailing list archive at Nabble.com.
Re: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess
In your setup() method, do something like Rete engine = new Rete(); try { engine.store("AGENT", this); engine.batch("ex.clp"); Value v = engine.executeCommand("(assert(ACLMessage(contenu A)))"); engine.executeCommand("(run)"); ... Then in Jess code, you can get access to the "Test1" object by calling (fetch "AGENT") And call Java methods on that object as needed. I'm afraid I can't help any more than that, since you haven't told us anything about what "activating a behavior" might entail. On 7/11/12 7:36 AM, "lyes" wrote: >Hello, > >I wish activate a behavior of agent from jess. > >Exemple : > >My class Agent >-- >public class Test1 extends Agent{ > > protected void setup() { > > System.out.println ("Agent " + getLocalName()+ " I am here >"); > > Rete engine = new Rete(); > try { >engine.batch("ex.clp"); > Value v = > engine.executeCommand("(assert(ACLMessage(contenu A)))"); > engine.executeCommand("(run)"); > > } catch (JessException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } >} > > >public class MyAction extends OneShotBehaviour { > > @Override > public void action() { > > // TODO Auto-generated method stub > > System.out.println ("Agent " + >getLocalName()+ >" I am here "); > > } > > } >} > >My file ex.clp >-- >(deftemplate ACLMessage (slot contenu)) >(defrule test (ACLMessage (contenu A)) => [// i wish activate behaviour >MyAction Defined in Agent java for excute instructions//]) > >Please Help me. >Thank's > > >-- >View this message in context: >http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp46 >54077.html >Sent from the Jess mailing list archive at Nabble.com. > > >To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' >in the BODY of a message to majord...@sandia.gov, NOT to the list >(use your own address!) List problems? Notify owner-jess-us...@sandia.gov. > To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.