public void createAgent() { Debug.Log(atIndex); foreach (AgentTemplate entry in templateList) { if (entry.label.Equals(atList[atIndex])) { AJANTemplate = entry.uri; break; } } Debug.Log(AJANTemplate); if (AJANTemplate != null) { TTransport transport = new TSocket(AJANServer, AJANPort); TProtocol protocol = new TBinaryProtocol(transport); MAJANService.Client client = new MAJANService.Client(protocol); transport.Open(); try { MRDFGraph knowledge = new MRDFGraph(); knowledge.ContentType = "text/turtle"; knowledge.Graph = InitializeGraph(); AgentURI = client.CreateAgent(name, AJANTemplate, knowledge); } finally { transport.Close(); } } }
public void executeAgent() { TTransport transport = new TSocket(AJANServer, AJANPort); TProtocol protocol = new TBinaryProtocol(transport); MAJANService.Client client = new MAJANService.Client(protocol); transport.Open(); Debug.Log(caIndex); AJANExecute = caList[caIndex]; try { MRDFGraph knowledge = new MRDFGraph(); knowledge.ContentType = "text/turtle"; string graph = getTaskList(); if (graph == "") graph = "_:test <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource> ."; knowledge.Graph = graph; AgentURI = client.ExecuteAgent(name, AJANExecute, knowledge); } finally { transport.Close(); } }
protected override void GUIBehaviorInput() { this.ajan = this.GetComponent <AJANAgent>(); if (GUI.Button(new Rect(270, 10, 120, 50), "Send Event")) { if (ajan) { MRDFGraph knowledge = new MRDFGraph(); knowledge.ContentType = "text/turtle"; knowledge.Graph = "_:test <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource> ."; Debug.Log("Send a new Event to AJANAgent capability: " + capability); ajan.sendEvent(capability, knowledge); } } }
public void sendEvent(string endpoint, MRDFGraph knowledge) { TTransport transport = new TSocket(AJANServer, AJANPort); TProtocol protocol = new TBinaryProtocol(transport); MAJANService.Client client = new MAJANService.Client(protocol); transport.Open(); try { AgentURI = client.ExecuteAgent(name, endpoint, knowledge); } finally { transport.Close(); } }