RE: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess

lyes <[email protected]> Wed, 11 Jul 2012 07:00:41 -0700
Newsgroups gmane.comp.java.jess
Message-ID <[email protected]>
------=_Part_13313_22426932.1342015241180
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable


Hello,=20
Sorry To disturb you,

My Objective with jess is to run the behaviours of agent.

in m=C3=A9thode 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{

       =20

        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() {

                       =20

                        // TODO Auto-generated method stub


                            Make (A + B).
                       =20

                }



in jess :
--------------
I make rule to run behaviours. For exemple :=20
(deftemplate ACLMessage  (slot contenu))

(defrule test (ACLMessage (contenu A)) =3D> ( 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=20
Date: Wed, 11 Jul 2012 06:22:11 -0700
From: [email protected]
To: [email protected]
Subject: Re: JESS: [EXTERNAL] Activate a Behaviour Jade from Jess



=09In your setup() method, do something like


Rete engine =3D new Rete();

                        try {

    engine.store("AGENT", this);

    engine.batch("ex.clp");

    Value v =3D 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 :=20

>

>My class Agent

>--------------

>public class Test1 extends Agent{

>=09

>=09protected void setup() {

>

>               System.out.println ("Agent " + getLocalName()+ " I am here

>");

>

>               Rete engine =3D new Rete();

>=09=09=09try {

>=09=09=09=09 engine.batch("ex.clp");

>=09=09=09=09Value v =3D engine.executeCommand("(assert(ACLMessage(contenu =
A)))");

>=09=09=09=09engine.executeCommand("(run)");

>=09=09=09=09

>=09=09=09} catch (JessException e) {

>=09=09=09=09// TODO Auto-generated catch block

>=09=09=09=09e.printStackTrace();

>=09=09=09}

>    }

>

>

>        public class MyAction extends OneShotBehaviour {

>

>=09=09@Override

>=09=09public void action() {

>=09=09=09

>=09=09=09// TODO Auto-generated method stub

>

>                             System.out.println ("Agent " +

>getLocalName()+

>" I am here ");

>=09=09=09

>=09=09}

>=09=09

>=09}

>}

>

>My file ex.clp

>--------------

>(deftemplate ACLMessage  (slot contenu))

>(defrule test (ACLMessage (contenu A)) =3D> [// i wish activate behaviour

>MyAction Defined in Agent java  for excute instructions//])

>

>Please Help me.

>Thank's=20

>

>

>--

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

--------------------------------------------------------------------



=09
=09

=09

=09
=09
=09=09If you reply to this email, your message will be added to the discuss=
ion below:
=09=09http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess=
-tp4654077p4654079.html
=09
=09
=09=09
=09=09To unsubscribe from Activate a Behaviour Jade from Jess, click here.

=09=09NAML
=09 =09=09 =09   =09=09 =20

--
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.
------=_Part_13313_22426932.1342015241180
Content-Type: text/html;
 charset=UTF8
Content-Transfer-Encoding: quoted-printable




<div dir=3D'ltr'>
Hello, <br>Sorry To disturb you,<br><br>My Objective with jess is to run th=
e behaviours of agent.<br><br>in m=C3=A9thode setup () i insert in the temp=
late information as contenu ..etc, and i make rules to resound.<br><br>in m=
y class "Test1" i have :<br><br>public class Test1 extends Agent{
<br>&nbsp; &nbsp; &nbsp; &nbsp;=20
<br>&nbsp; &nbsp; &nbsp; &nbsp; protected void setup() {
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (insertion into template).<br>&n=
bsp; &nbsp; }
<br><br>And i have somme behavours as fo exemple behaviour to make addition=
.<br><br> public class Addition extends OneShotBehaviour {
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void act=
ion() {
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp;=20
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; // TODO Auto-generated method stub
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp; &nbsp; &nbsp; &nbsp; Make (A + B).<br>&nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
<br><br><br>in jess :<br>--------------<br>I make rule to run behaviours. F=
or exemple : <br>(deftemplate ACLMessage &nbsp;(slot contenu))
<br>(defrule test (ACLMessage (contenu A)) =3D&gt; ( rune behaviour additio=
n ).<br><br>But i have 2 problem : when a assert into template from java, h=
e don't make it. the seconde problem is to rune behaviour.<br><br>Thank's f=
or all <br><div><div id=3D"SkyDrivePlaceholder"></div><hr id=3D"stopSpellin=
g">Date: Wed, 11 Jul 2012 06:22:11 -0700<br>From: <a href=3D"/user/SendEmai=
l.jtp?type=3Dnode&node=3D4654081&i=3D0" target=3D"_top" rel=3D"nofollow" li=
nk=3D"external">[hidden email]</a><br>To: <a href=3D"/user/SendEmail.jtp?ty=
pe=3Dnode&node=3D4654081&i=3D1" target=3D"_top" rel=3D"nofollow" link=3D"ex=
ternal">[hidden email]</a><br>Subject: Re: JESS: [EXTERNAL] Activate a Beha=
viour Jade from Jess<br><br>

=09In your setup() method, do something like
<br><br>Rete engine =3D new Rete();
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; try {
<br>&nbsp; &nbsp; engine.store("AGENT", this);
<br>&nbsp; &nbsp; engine.batch("ex.clp");
<br>&nbsp; &nbsp; Value v =3D engine.executeCommand("(assert(ACLMessage(con=
tenu A)))");
<br>&nbsp; &nbsp; engine.executeCommand("(run)");
<br>&nbsp; &nbsp; ...
<br><br>Then in Jess code, you can get access to the "Test1" object by call=
ing
<br><br>&nbsp; &nbsp; (fetch "AGENT")
<br><br>And call Java methods on that object as needed. I'm afraid I can't =
help
<br>any more than that, since you haven't told us anything about what
<br>"activating a behavior" might entail.
<br><br><br><br>On 7/11/12 7:36 AM, "lyes" &lt;<a href=3D"http:///user/Send=
Email.jtp?type=3Dnode&amp;node=3D4654079&amp;i=3D0" rel=3D"nofollow" target=
=3D"_blank" link=3D"external">[hidden email]</a>&gt; wrote:
<br><div class=3D"ecxshrinkable-quote"><div class=3D'shrinkable-quote'><br>=
&gt;Hello,
<br>&gt;
<br>&gt;I wish activate a behavior of agent from jess.
<br>&gt;
<br>&gt;Exemple :=20
<br>&gt;
<br>&gt;My class Agent
<br>&gt;--------------
<br>&gt;public class Test1 extends Agent{
<br>&gt;=09
<br>&gt;=09protected void setup() {
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.printl=
n ("Agent " + getLocalName()+ " I am here
<br>&gt;");
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rete engine =3D n=
ew Rete();
<br>&gt;=09=09=09try {
<br>&gt;=09=09=09=09 engine.batch("ex.clp");
<br>&gt;=09=09=09=09Value v =3D engine.executeCommand("(assert(ACLMessage(c=
ontenu A)))");
<br>&gt;=09=09=09=09engine.executeCommand("(run)");
<br>&gt;=09=09=09=09
<br>&gt;=09=09=09} catch (JessException e) {
<br>&gt;=09=09=09=09// TODO Auto-generated catch block
<br>&gt;=09=09=09=09e.printStackTrace();
<br>&gt;=09=09=09}
<br>&gt; &nbsp; &nbsp;}
<br>&gt;
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;public class MyAction extends OneShotBe=
haviour {
<br>&gt;
<br>&gt;=09=09@Override
<br>&gt;=09=09public void action() {
<br>&gt;=09=09=09
<br>&gt;=09=09=09// TODO Auto-generated method stub
<br>&gt;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println ("Agent " +
<br>&gt;getLocalName()+
<br>&gt;" I am here ");
<br>&gt;=09=09=09
<br>&gt;=09=09}
<br>&gt;=09=09
<br>&gt;=09}
<br>&gt;}
<br>&gt;
<br>&gt;My file ex.clp
<br>&gt;--------------
<br>&gt;(deftemplate ACLMessage &nbsp;(slot contenu))
<br>&gt;(defrule test (ACLMessage (contenu A)) =3D&gt; [// i wish activate =
behaviour
<br>&gt;MyAction Defined in Agent java &nbsp;for excute instructions//])
<br>&gt;
<br>&gt;Please Help me.
<br>&gt;Thank's=20
<br>&gt;
<br>&gt;
<br>&gt;--
<br>&gt;View this message in context:
<br>&gt;<a href=3D"http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-J=
ade-from-Jess-tp46" rel=3D"nofollow" target=3D"_blank" link=3D"external">ht=
tp://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp46</a=
><br>&gt;54077.html
<br>&gt;Sent from the Jess mailing list archive at Nabble.com.
<br>&gt;
<br>&gt;-------------------------------------------------------------------=
-
<br>&gt;To unsubscribe, send the words 'unsubscribe jess-users <a href=3D"h=
ttp:///user/SendEmail.jtp?type=3Dnode&amp;node=3D4654079&amp;i=3D1" rel=3D"=
nofollow" target=3D"_blank" link=3D"external">[hidden email]</a>'
<br>&gt;in the BODY of a message to <a href=3D"http:///user/SendEmail.jtp?t=
ype=3Dnode&amp;node=3D4654079&amp;i=3D2" rel=3D"nofollow" target=3D"_blank"=
 link=3D"external">[hidden email]</a>, NOT to the list
<br>&gt;(use your own address!) List problems? Notify <a href=3D"http:///us=
er/SendEmail.jtp?type=3Dnode&amp;node=3D4654079&amp;i=3D3" rel=3D"nofollow"=
 target=3D"_blank" link=3D"external">[hidden email]</a>.
<br>&gt;-------------------------------------------------------------------=
-
</div></div><br><br>-------------------------------------------------------=
-------------
<br>To unsubscribe, send the words 'unsubscribe jess-users <a href=3D"http:=
///user/SendEmail.jtp?type=3Dnode&amp;node=3D4654079&amp;i=3D4" rel=3D"nofo=
llow" target=3D"_blank" link=3D"external">[hidden email]</a>'
<br>in the BODY of a message to <a href=3D"http:///user/SendEmail.jtp?type=
=3Dnode&amp;node=3D4654079&amp;i=3D5" rel=3D"nofollow" target=3D"_blank" li=
nk=3D"external">[hidden email]</a>, NOT to the list
<br>(use your own address!) List problems? Notify <a href=3D"http:///user/S=
endEmail.jtp?type=3Dnode&amp;node=3D4654079&amp;i=3D6" rel=3D"nofollow" tar=
get=3D"_blank" link=3D"external">[hidden email]</a>.
<br>--------------------------------------------------------------------
<br><br>
=09
=09<br>
=09<br>
=09<hr size=3D"1" color=3D"#cccccc">
=09<div style=3D"color:#444;font:12px tahoma,geneva,helvetica,arial,sans-se=
rif">
=09=09<div style=3D"font-weight:bold">If you reply to this email, your mess=
age will be added to the discussion below:</div>
=09=09<a href=3D"http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jad=
e-from-Jess-tp4654077p4654079.html" target=3D"_blank" rel=3D"nofollow" link=
=3D"external">http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-f=
rom-Jess-tp4654077p4654079.html</a>
=09</div>
=09<div style=3D"color:#666;font:11px tahoma,geneva,helvetica,arial,sans-se=
rif;line-height:1.5em">
=09=09
=09=09To unsubscribe from Activate a Behaviour Jade from Jess, <a href=3D""=
 target=3D"_blank" rel=3D"nofollow" link=3D"external">click here</a>.<br>
=09=09<a href=3D"http://jess.2305737.n4.nabble.com/template/NamlServlet.jtp=
?macro=3Dmacro_viewer&amp;id=3Dinstant_html%21nabble:email.naml&amp;base=3D=
nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamesp=
ace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=3Dnotify_subscri=
bers%21nabble:email.naml-instant_emails%21nabble:email.naml-send_instant_em=
ail%21nabble:email.naml" rel=3D"nofollow" style=3D"font:9px serif" target=
=3D"_blank" link=3D"external">NAML</a>
=09</div></div> =09=09 =09   =09=09  </div>

=09
<br/><hr align=3D"left" width=3D"300" />
View this message in context: <a href=3D"http://jess.2305737.n4.nabble.com/=
Activate-a-Behaviour-Jade-from-Jess-tp4654077p4654081.html">RE: JESS: [EXTE=
RNAL] Activate a Behaviour Jade from Jess</a><br/>
Sent from the <a href=3D"http://jess.2305737.n4.nabble.com/">Jess mailing l=
ist archive</a> at Nabble.com.<br/>
------=_Part_13313_22426932.1342015241180--