270 likes | 447 Views
Department of Distributed Systems. MTA SZTAKI. Hogyan mixeljünk össze webszolgáltatásokat, ontológiákat és ágenseket?. Micsik András. Phase 1: normal SOA. Using web services, we have interoperability, and supporting standards, such as WS-Addressing or WS-Security
E N D
Department of Distributed Systems MTA SZTAKI Hogyan mixeljünk össze webszolgáltatásokat, ontológiákatés ágenseket? MicsikAndrás
Phase 1: normal SOA • Using web services, we have interoperability, and supporting standards, such as WS-Addressing or WS-Security • But web services are a bit `dumb`: • They work in ‘imperative’ mode • No semantic explanation of what parameters mean Environment 1 Environment 2 WS WS SOAP WS WS WS WS
Phase 2: SOA with agents Environment 1 Environment 2 • So we start using agents, to exploit behaviours, richer communications, proactivity, etc. • But: agents and web services speak different protocols and languages! WS WS SOAP WS WS WS WS Agent Agent ACL Agent Agent Agent Agent
Phase 3: SOA and agents using common message bus Environment 1 Environment 2 • Agents and web services use the same message bus for communication, which simplifies network administration and enhances security. WS WS WS WS WS WS Message Bus Agent Agent Agent Agent Agent Agent
Phase 4: Enhanced Agent-WS communication Environment 1 Environment 2 • Agent communication is often limited within the agent community • Agents and web services can now communicate with each other: • Agents can open WS APIs • Agents can easily call web services WS WS WS WS WS WS Message Bus Agent Agent Agent Agent Agent Agent
Phase 5: Ontologies are used as common language Environment 1 Environment 2 • Agents and web services communicate using the same OWL ontologies: • Connects them to the Semantic Web standards • Provides common language • Provides reasoning facilities WS WS WS WS WS WS Message Bus Agent Agent Ontologies Agent Agent Agent Agent
Phase 6: Adding BDI paradigm to agents Environment 1 Environment 2 • BDI (Beliefs, desires, intentions) paradigm adds useful planning and goal-orientation features to agents WS WS WS WS WS WS Message Bus BDIAgent BDIAgent Ontologies BDIAgent BDI Agent BDIAgent BDI Agent
Now we start to build up the environment, from phase 3 to phase 6
Realization of phase 3 Environment 1 Environment 2 WS WS WS WS WS WS Message Bus Agent Agent Agent Agent Agent Agent
About Jade • Jade is a platform for multi-agent system development • Jade adheres to FIPA standards • Jade agents can • Use an Agent Communication Language (ACL) to send messages to each other • Implement coordination protocols such as contract net
About SOAP MTP add-on for Jade • SOAP Message Transport Protocol implemented for Jade as an add-on • Software available from: http://brein.dsd.sztaki.hu/ • Transports agent messages via SOAP • Benefits • Enhanced interoperability between agents and WS • Homogeneous message transfer framework • Secure transport of agent messages • Uniform management of communication • Service virtualization 14/10/2014 AAMAS 2009 Page 11
How SOAP MTP add-on works • It is a JADE core service, no extra agents are needed • SOAP encapsulation is transparent for agents • SOAP headers are not used by agents, so they can be used freely by the message bus SOAP Headers Virtual endpoint address Business info Encryption details Enterprise communication framework Agent message as SOAP Body (PROPOSE :sender ( agent-identifier :name da0@MANO1:1099/JADE ….. )) Multi-agent platform 14/10/2014 AAMAS 2009 Page 12
Use case of SOAP MTP add-on for Jade • Messages traveling across organizational boundaries are encrypted (WS-Security) • WS-Addressing is used to convey business context information • Virtual addressing is also used (via Service Instance Registry) Consumer 1 Service Provider 1 Secure Token Service Secure Token Service Jade 2 Jade 1 MessagingService MessagingService SOAP MTP SOAP MTP Client Gateway Gateway Agent 4 Agent 1 Client Endpoint Endpoint Agent 5 Agent 2 ServiceInstanceRegistry ServiceInstanceRegistry Agent 6 Agent 3 14/10/2014 AAMAS 2009 Page 13
Realization of phase 4 Environment 1 Environment 2 WS WS WS WS WS WS Message Bus Agent Agent Agent Agent Agent Agent
Example for agent-WS communication • Using SOAP MTP add-on, an agent can easily provide a WS endpoint: public class SoapServiceAgent extends Agent { protected void setup() { MessageTransportProtocol mtp = MessageTransportProtocol.getInstance(); mtp.registerSoapService("ping", new MyAgentWsImpl(this)); } public static class MyAgentWsImpl extends BaseAgentWs { public MyAgentWsImpl(Agent a) {super(a);} public String ping(String s) {return s;} } } • And also, an agent can easily call external WS: SOAPClient client = SOAPClient.createFromWsdl(remoteWs + "?wsdl"); Object[] results = client.invoke("methodName", "param1", "param2");
Head-body architecture 12/11/2008 BREIN – 2nd Year Review, Stuttgart Page 16
Realization of phase 5 Environment 1 Environment 2 WS WS WS WS WS WS Message Bus Agent Agent Ontologies Agent Agent Agent Agent
About Jena • Jena is a Java framework for building Semantic Web applications, supporting • Manipulation of RDF and OWL • Persistent storage of RDF and OWL • SPARQL queries • ... • Jena is easy to embed into Java code, and easy to customize
Reasoning in agent or WS • A customized version of Jena is embedded into components • The component may use • Basic ontologies • Rules • Persistence model (e.g. MySQL or file) • Agent or WS can access information • Directly through the OWL API • Via SPARQL queries • Agent or WS can exchange information using RDF/OWL
Example for using Jena [detectMaintNeeded: (?C breinReasoning:unMaintedEvents ?NUM), ge(?NUM, 10), noValue(?C brein:isMaintenanceNeeded 'true') -> (?C brein:isMaintenanceNeeded 'true') ]
Realization of phase 6 Environment 1 Environment 2 WS WS WS WS WS WS Message Bus BDIAgent BDIAgent Ontologies BDIAgent BDI Agent BDIAgent BDI Agent
About BDI • Belief-desire-intention (BDI) architecture is a model for describing rational agents Agents that decide based on the agent’s beliefs, which action to perform to reach the agent‘s goals • It consists of the following concepts: • Belief: Beliefs capture informational attitudes realized as a data structure containing current facts about the world • Desire: Desires capture the motivational attitudes realized as goals that represent the concrete motivation • Intention: Intentions capture the deliberative attitudes realized by reasoning mechanisms in order to select appropriate actions to achieve given goals or to react to particular situations 2008-09-03 BREIN – General Assembly Budapest Page 22
BDI Architecture Semantic BDI Agent Desires Intentions Jadex is a BDI implementation for Jade Pellet is full OWL DL reasoner used inside Jena Beliefs Embedded Knowledge Base Base ontologies Jadex Pellet Jade Jena 2008-09-03 BREIN – General Assembly Budapest Page 23
The BDI cycle Beliefs maintenance_state resource_state Desires (Goals) keep_maintained OWL reasoninglast_maintenance... Plans Intentions maintain 2008-09-03 Page 24
Example for OWL-based beliefs • The first belief initializes the reasoner, which loads the relevant ontology, and also sets up the Jena semantic web framework and the Pellet OWL reasoner: <belief name="kb" class="JadexReasoner"> <fact> new JadexReasoner(„http://../url/for/ontology”, $beliefbase) </fact> </belief> • Then we can map facts in the ontology to beliefs of the agent: <belief name="availability" class="Float" exported="true"> <fact evaluationmode="dynamic"> $beliefbase.kb.getPropFloatValue($agent.getName(), "#avail") </fact> </belief>
Example for Jadex goals and plans • The goal is to keep a resource maintained: <maintaingoal name="keep_maintained" retry="true„exclude="never" retrydelay="10000"> <contextcondition> ($beliefbase.state == Constants.RESOURCE_STATE_MAINTENANCE) </contextcondition> <maintaincondition> !$beliefbase.is_maintenance_needed </maintaincondition> </maintaingoal> • The plan is activated whenever maintenance is needed: <plan name="maintain"> <body class="ResourceMaintenancePlan" /> <trigger> <goal ref="keep_maintained" /> </trigger> </plan>
We are finished! Environment 1 Environment 2 • Further information:http://www.eu-brein.comhttp://brein.dsd.sztaki.hu • Any questions? WS WS WS WS WS WS Message Bus BDIAgent BDIAgent Ontologies BDIAgent BDI Agent BDIAgent BDI Agent