package client; //import agent.core.communication.Message; import java.io.*; import server.TraderAgent; import jade.core.AID; import jade.core.Agent; import jade.core.behaviours.ReceiverBehaviour; import jade.lang.acl.ACLMessage; import jade.lang.acl.MessageTemplate; import lookup.Lookup_ontology; public class AppletAgentQI extends Agent { QIApplet qiApplet; TraderAgent trader; private String interfaceQuery; public AppletAgentQI(QIApplet qiApplet, TraderAgent traderAgent) { this.qiApplet = qiApplet; this.trader = traderAgent; } protected void setup() { /* listen for messages */ //ReceiverBehaviour receiverBehaviour = new ReceiverBehaviour(this, -1, MessageTemplate.MatchPerformative(ACLMessage.INFORM_REF)); //addBehaviour(receiverBehaviour); /* add main behaviour */ //addBehaviour(new AppletAgentQIBehaviour(this, receiverBehaviour)); createSPARQLParserAgent(); addBehaviour(new AppletAgentQIBehaviourFSM()); qiApplet.qi.jButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sendQuery(); } }); } private void createSPARQLParserAgent() { addBehaviour(new CreateAgent("SPARQLParser-Agent","client.SPARQLParser")); } public void sendQuery() { ACLMessage inform = new ACLMessage(ACLMessage.INFORM_REF); inform.setSender(this.getAID()); inform.addReceiver(this.getAID()); inform.setContent("query"); this.send(inform); //addBehaviour(new AppletAgentQIBeheviourSend()); } public void setInterfaceQuery(String interfaceQuery) { this.interfaceQuery = interfaceQuery; } public String getInterfaceQuery() { return interfaceQuery; } }