MTA SZTAKI Department of Distributed Systems Hogyan mixeljünk össze webszolgáltatásokat, ontológiákat és ágenseket? Micsik András
DSD Department of Distributed Systems MTA SZTAKI 2 Environment 2 Phase 1: normal SOA Environment 1 WS SOAP 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
DSD Department of Distributed Systems MTA SZTAKI 3 Environment 2 Phase 2: SOA with agents Environment 1 Agent WS Agent WS SOAP ACL So we start using agents, to exploit behaviours, richer communications, proactivity, etc. But: agents and web services speak different protocols and languages!
DSD Department of Distributed Systems MTA SZTAKI 4 Environment 2 Phase 3: SOA and agents using common message bus Environment 1 Agent WS Agent WS Message Bus Agents and web services use the same message bus for communication, which simplifies network administration and enhances security.
DSD Department of Distributed Systems MTA SZTAKI 5 Environment 2 Phase 4: Enhanced Agent-WS communication Environment 1 Agent WS Agent WS Message Bus 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
DSD Department of Distributed Systems MTA SZTAKI 6 Environment 2 Phase 5: Ontologies are used as common language Environment 1 Agent WS Agent WS Message Bus Ontologies Agents and web services communicate using the same OWL ontologies: Connects them to the Semantic Web standards Provides common language Provides reasoning facilities
DSD Department of Distributed Systems MTA SZTAKI 7 Environment 2 Phase 6: Adding BDI paradigm to agents Environment 1 BDI Agent WS BDI Agent WS Message Bus Ontologies BDI (Beliefs, desires, intentions) paradigm adds useful planning and goal-orientation features to agents
DSD Department of Distributed Systems MTA SZTAKI 8 Now we start to build up the environment, from phase 3 to phase 6
DSD Department of Distributed Systems MTA SZTAKI 9 Environment 2 Realization of phase 3 Environment 1 Agent WS Agent WS Message Bus
DSD Department of Distributed Systems MTA SZTAKI 10 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
DSD Department of Distributed Systems MTA SZTAKI 11 12/03/2016AAMAS 2009Page 11 About SOAP MTP add-on for Jade SOAP Message Transport Protocol implemented for Jade as an add-on Software available from: 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
DSD Department of Distributed Systems MTA SZTAKI 12 12/03/2016AAMAS 2009Page 12 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 Agent message as SOAP Body (PROPOSE :sender ( agent- identifier :name ….. )) SOAP Headers Virtual endpoint address Business info Encryption details Enterprise communication framework Multi-agent platform
DSD Department of Distributed Systems MTA SZTAKI 13 Consumer 1 Gateway Service Instance Registry Secure Token Service Service Provider 1 Jade 2 Gateway Agent 5 Agent 6 Agent 4 Secure Token Service Service Instance Registry Jade 1 Agent 2 Agent 3 SOAP MTP Agent 1 Endpoint Client SOAP MTP Client Endpoint Messaging Service 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) 12/03/2016AAMAS 2009Page 13
DSD Department of Distributed Systems MTA SZTAKI 14 Environment 2 Realization of phase 4 Environment 1 Agent WS Agent WS Message Bus
DSD Department of Distributed Systems MTA SZTAKI 15 Example for agent-WS communication SOAPClient client = SOAPClient.createFromWsdl(remoteWs + "?wsdl"); Object[] results = client.invoke("methodName", "param1", "param2"); 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; } } Using SOAP MTP add-on, an agent can easily provide a WS endpoint: And also, an agent can easily call external WS:
DSD Department of Distributed Systems MTA SZTAKI 16 BREIN – 2nd Year Review, StuttgartPage 1612/11/2008 Head-body architecture
DSD Department of Distributed Systems MTA SZTAKI 17 Environment 2 Realization of phase 5 Environment 1 Agent WS Agent WS Message Bus Ontologies
DSD Department of Distributed Systems MTA SZTAKI 18 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
DSD Department of Distributed Systems MTA SZTAKI 19 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
DSD Department of Distributed Systems MTA SZTAKI 20 Example for using Jena [detectMaintNeeded: (?C breinReasoning:unMaintedEvents ?NUM), ge(?NUM, 10), noValue(?C brein:isMaintenanceNeeded 'true') -> (?C brein:isMaintenanceNeeded 'true') ]
DSD Department of Distributed Systems MTA SZTAKI 21 Environment 2 Realization of phase 6 Environment 1 BDI Agent WS BDI Agent WS Message Bus Ontologies
DSD Department of Distributed Systems MTA SZTAKI 22 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 BREIN – General Assembly BudapestPage 22
DSD Department of Distributed Systems MTA SZTAKI 23 BDI Architecture BREIN – General Assembly BudapestPage 23 Semantic BDI Agent Desires Intentions Beliefs Embedded Knowledge Base Base ontologies JadexPellet JadeJena Jadex is a BDI implementation for Jade Pellet is full OWL DL reasoner used inside Jena
DSD Department of Distributed Systems MTA SZTAKI 24 The BDI cycle Beliefs maintenance_state resource_state Desires (Goals) keep_maintained Intentions maintain Plans Page 24 OWL reasoning last_maintenance...
DSD Department of Distributed Systems MTA SZTAKI 25 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: new JadexReasoner(„ $beliefbase) $beliefbase.kb.getPropFloatValue($agent.getName(), "#avail") Then we can map facts in the ontology to beliefs of the agent:
DSD Department of Distributed Systems MTA SZTAKI 26 Example for Jadex goals and plans ($beliefbase.state == Constants.RESOURCE_STATE_MAINTENANCE) !$beliefbase.is_maintenance_needed The goal is to keep a resource maintained: The plan is activated whenever maintenance is needed:
DSD Department of Distributed Systems MTA SZTAKI 27 Environment 2 We are finished! Environment 1 BDI Agent WS BDI Agent WS Message Bus Ontologies Further information: Any questions?