package server; import java.io.BufferedReader; import java.io.FileReader; import agent.core.onto.Ontology; import jade.core.behaviours.OneShotBehaviour; import lookup.Lookup_ontology; public class TraderAgentBehaviourFSM_ObtainBehaviour extends OneShotBehaviour { int transition = 1; public void action() { TraderAgent myAgentTA = (TraderAgent)myAgent; Lookup_ontology lookup = myAgentTA.getLookup(); lookup = new Lookup_ontology(); String uri_file = "D:/jade/add-ons/jadeapplets/files/lookup.xml"; lookup.load_properties(uri_file); String query_source = lookup.getQueryForm().getSource(); String query_uri = lookup.getQueryForm().getUri(); System.out.println("\n The message received comes from: " + query_source); System.out.println("\n The uri of the query file is: " + query_uri); String query_content = ""; try { FileReader fr = new FileReader(query_uri); BufferedReader br = new BufferedReader(fr); query_content = br.readLine(); } catch(Exception e) {} if(query_content.equals(Ontology.SPARQL)) { System.out.println("\n The query is written in SPARQL"); } else { System.out.println("\n The query is not written in SPARQL"); } myAgentTA.setLastQuery(Ontology.SPARQL_PREFIX + query_content); myAgentTA.setLastSource(query_source); } public int onEnd() { return transition; } }