Integrating Ontology Support within AgentService Christian Vecchiola, Alberto Grosso, Antonio Boccalatte DIST – Department of Communications Computer and System Sciences University of Genova {christian, agrosso, nino}@dist.unige.it Abstract dialogue among two entities. Hence, a good support for This paper describes the software infrastructure ontology design, development, and management, introduced within the AgentService framework in order to definitely gives an added value to agent programming provide support for ontology design, development, and frameworks since it simplifies and empowers the activity management. Ontology enriches and normalizes the of MAS engineers. interaction among agents by establishing a domain and a This paper presents the collection of software set of relation among objects populating that domain. A abstractions and tools integrated into AgentService [2] good support for ontology definitely adds value to the which provides the framework with ontology design, design and the implementation of software agents: development, and management (hereafter ontology software engineers can take advantages of the services service). The ontology service has been designed by offered by the framework to produce new ontologies and following the specifications provided by FIPA [3]. In the rely on them to quickly define interaction protocols which next sections we will give a brief description of are automatically translated into state machines used by AgentService and the agent model it proposes (Section 2), software agents. then we will mostly concentrate on the entire process of defining, implementing an ontology and using it to support interaction protocol design and implementation 1. Introduction (Section 3 and 4). Conclusions will follow. In computer science the word ontology refers to “a 2. AgentService data model that represents a domain and is used to reason about the objects in that domain and the relations between In this section we will give a brief overview of the them” [1]. Software ontologies are used in different fields AgentService framework by pointing out only those of computer science such as information architecture, aspects which are relevant to understand how the semantic web, and knowledge representation. In ontology service is integrated into the framework. particular, the adoption of software ontologies for Basically, we will describe the components of the knowledge representation is very attractive: ontologies framework and we will present the agent model. For a contribute to provide a structure, a collection of well more detailed introduction please see [2]. identified concepts along with their properties, and relations among them to a given knowledge base. For 2.1. The Framework these reasons, they are very useful for software agents that base their activity mainly on the interaction with AgentService is a framework to implement distributed peers and on reasoning about the environment. multi-agent systems. It provides support for agent design Ontologies provide a structured and efficient way to and implementation, multi-agent system implementation perform these tasks. management and monitoring. The components which The translation of software ontology into a collection constitute the framework are the following: of software artifacts representing it delivers to MAS engineers a high level of abstraction helping them in • a flexible agent model through which different agent defining the interactions among agents. From a practical architectures can be implemented; point of view, a given software ontology establishes the • a library which defines the core of the system and the content of messages exchanged among agents and basic services of the framework; provides facilities to validate them. Moreover, ontologies • a software environment that hosts multi-agent are a good starting point for defining interaction protocols systems and controls their life-cycle; which are the most common way to define a structured 166 • a set of programming language extensions Agents can interpret roles into a given communication simplifying the implementation of software agents; protocol and they can publish this service through the DF • a collection of tools supporting users in designing which makes this information available to the entire and implementing multi-agent systems; community of agents. Interpreting a role makes the agent • complete support for ontology definition and able to participate into the communication protocol which development; defines that role. This feature is implemented by • automatic code generation for interaction protocols providing the agent with a behaviour object which with ontology integration; automatically executes the state machine defining the • a software infrastructure allowing agents to migrate role. This issue will be further detailed in the next section. among different instances of the AgentService platform; 3. Ontology Support in AgentService • a set of support programs through which users can maintain and monitor multi-agent systems. AgentService provides a complete support to ontology design, implementation, and management. These three The core of the framework relies on the Common functionalities are collectively referred as the ontology Language Infrastructure (hereafter CLI) [4] and makes service. The ontology service is based on the following the framework portable over different implementations of framework components: this specification like Mono, Rotor, and .NET. The key • a set of classes representing the object model features of the framework are the agent platform which is defining all the elements required to represent an a modular hosting environment for software agents and ontology (classes, concepts, instances, attributes, the agent model which will be investigated in the next constraints, validation, etc); paragraph. • a set of tools that can be used to automatically generate the specific classes for a given ontology by 2.2. The Agent Model starting from its visual or textual representation; • an Ontology Agent (OA) which maintains the The framework defines a software agent an knowledge about all the ontologies registered in the autonomous software entity whose activity is constituted hosting agent platform and about the agent which are by a set of concurrent tasks and whose state is defined by able to communicate by using the concepts defined a set of shared objects. Concurrent tasks are referred as into a given ontology; behaviour objects while the term knowledge object is used to identify the components of the agent state. • FIPA SL0 [5] ACL message support. Behaviour objects encapsulates all the computational activity of a given software agent while knowledge As we can notice, from the previous list the framework objects define the elements composing its knowledge does not directly provide any facility to visually design base. The formers can be considered as simple little software ontologies. We decided to rely on a very well programs which have their execution stack and can know and established tool that is Protégé [6] a software communicate each other by using the shared knowledge projects maintained by the KSI lab the Stanford objects. Behaviour objects can access the runtime services University. Protégé, when equipped with Jambalaya [7], of the agent platform and query the FIPA management provides all the required features to quickly design a agents (AMS, MTS, DF, and Ontology Agent) in order to given ontology. In the following we will briefly illustrate obtain information about the environment, the community the object model designed to support ontology definitions of agents and the services they offer; for example they in AgentService, the role of the Ontology Agent, and the can query the Ontology Agent in order to know which ontology development process. ontologies are registered in the platform and which agents are able to understand messages belonging to a given 3.1. Ontology Object Model ontology. Knowledge objects are data structures containing items The design and the implementation of the object model which are exposed as properties. They resemble a C struct defining the ontology reflects the specifications outlined or a Pascal record, but are designed with a built support in the corresponding FIPA standards [3] and has been for persistence and concurrent multiple accesses. inspired by the type system designed in JADE [8] to Knowledge objects define the knowledge base of a given support ontologies. The object model defined within software agent and the collection of their properties along AgentService defines a meta-ontology which contains all with the execution state of each agent define the state of the concepts and the elements which are required to an agent instance. compose user defined ontologies. The meta-ontology 167 defines the following entities: predicate, term, concept, exchange messages which contains SL0 objects and a query, action, variable, primitive, and aggregate. Figure specific message content has been designed (the 1 describes how these elements are connected each other. ACLMessageBody class) in order to transport SL0 statements. The joint use of the ontology API and of SL0 as a vehicle allows agents to easily communicate each other. 3.2. The Ontology Agent In order to be compliant with the specification provided by FIPA we have introduced the Ontology Agent which is responsible of maintaining the catalog of all the ontologies registered with the system and of providing useful information to software agents. The entire list of task that should be performed by the ontology agent is the following: Figure 1. Ontology elements hierarchy • ontology discovery and publishing; The elements depicted in figure 1 define the domain in • ontology maintenance; which every communication based on a given ontology • ontology mapping and translation; takes place. User defined ontologies will provide specific • shared ontology discovery. instances of these elements and MAS engineers will have to specialize the abstract classes representing the entities The ontology agent provided with the framework defined by the meta-ontology: the new classes will implements only the two features of the previous list represents the concepts, the queries, the actions, the which are also the most important. We think that the terms, etc. which are pertaining to the specific problem ontology mapping service is a very difficult task to domain. Ontologies are also described using schemas implement and requires some sort of inductive knowledge which are generic objects used to describe any ontology in order to detect similarities among different knowledge element and provides all the information to represent a representations. specific ontology without using ontologies specific In order to be available to the community of agents the classes. Ontology schemas are used internally by the Ontology Agent registers its service to the DF. Since we framework in order to maintain a catalog of all the have implemented a reduced set of task of the ontology ontologies registered, while ontologies specific classes agent we decided to embed these functionalities directly constitute the API used by software agents to hard-code into the Directory Facilitator, by adding a specific the communication based on a specific ontology. Agents behaviour which performs these tasks. The community of which can dynamically learn to use a given ontology by agents asks to the DF which agent provides the ontology exploiting the services of the OntologyDescriptor class service and the directory facilitator returns its own agent which automatically extracts all the useful information identifier. Hence, the implementation of this feature is about a given ontology. It retrieves all the schemas completely transparent to the community of agents which defining the specific entities of the ontology and provides only expect to obtain the address of the Ontology Agent also other useful information such as assembly location, in order to query it. file versioning and type names. The implemented solution is very flexible since it provides an efficient way of using 3.3. Ontology Development Process ontologies when they are statically identified, while, at the same time, provides facilities to dynamically reflect1 In order to make users feel at ease and increase their ontologies. productivity we adopt, as written above, Protégé in AgentService also provides support for SL0 which is a conjunction with Jambalaya for defining AgentService minimal subset of the FIPA ACL message specification. ontologies. Figure 2 describes the entire process that by The framework defines a set of classes able to represent starting from the Protégé editor generates the assembly all the elements of SL0 plus the = (equals) predicate. In containing the type definitions for the ontology which are order to communicate with a given ontology agents required by the AgentService framework. Projects designed in Protégé can be exported into the 1 The verb reflect is used in the sense of type reflection XML format and a tool provided with AgentService which identifies a well know set of operation aimed to automatically generates the corresponding object model, extract information about the class type of a given object. writes the source code and compiles it into an assembly 168 which can be easily deployed into the agent platform or • design agents interpreting the roles through dedicated used by the protocol designer. After the compilation behaviours. process takes place MAS engineers are provided with the The plug-in introduces a new stencil in the Visio entire object model describing the ontology they designed environment which contains all the elements to visually with Protégé. The assembly can be included into a generic compose the protocol, and a toolbar which allows to software project and used as a library, directly deployed automatically generate the code implementing the state into the agent platform, or, as showed in figure 2, used machines for the protocols. Such state machines can be within the protocol designer. embedded into specific behaviour objects which are then able to participate in the interaction protocol. The next paragraphs analyze more in details how the tool works, in particular some extensions of the AUML basic elements are introduced and the code generation process is explained. 4.1 Designing AUML elements Agent UML proposes extensions to UML and idioms within UML in particular for sequence e collaboration diagrams. Sequence diagrams seem to be the best way to design and represent agent in order to capture inter-agent dynamics [10]. Two fundamental parts constitute the diagram model a frame, which delimits the sequence diagram, and the message flow between roles through a set of lifelines and messages [11]. Hence the frame element contains lifelines, sets of messages, and AUML operators commonly called combined fragments. In addition to the basic elements proposed by AUML specification (lifeline, message, alternative, optional, Figure 2. Ontology code generation break, loop), we introduce some new features in order to make the model effective from the AgentService point of view. 4. Protocol Design and Implementation Since the definition of the protocol is designed in order to generate running code for AgentService platform, the AgentService provide facilities to design, to tool provides features for inserting lines of .NET code for implement, and to integrate interaction protocols into each role. In particular designers can write code in order multi-agent systems. Interaction protocols rely on the to manage exceptions during protocol execution or reply ability of agents of communicate each other by using the to an error message received from a peer. services offered by the MTS and the messaging Messages are obviously the core of protocol subsystem. The development of a protocol for interactions; the tool provides two kinds of messages: AgentService can be enhanced by using ontologies which ontological messages and native messages. The designer give a sound meaning and a well defined structure to the is integrated with the AgentService ontology system; in messages exchanged during the interaction. AgentService order to adopt an ontology it is only necessary to indicate relies on the Microsoft Visio visual modeling the assembly containing it. Hence if a user wants to use environment and provides a plug-in which allows users to an ontology within a protocol, he has to select an SL0 define interaction protocols by following the AUML operator and then choose the ontological elements standard [9]. contained within the previously loaded ontology. In the In particular by using protocol designer developers case the user does not adopt an ontology, he has to define can: the fields composing the body of the message, specifying • design protocol steps for each agent role involved; the name and the type of the message element (the • adopt previously defined ontology for message message content of AgentService is strongly typed). content; The tool allows developer to design peer-to-peer or • export the protocol in a format usable by client-server communications defining the cardinality of AgentService; the agent roles involved in a protocol. AgentService messages are asynchronous; in client-server protocol the 169 reception by the server is time-outed and the server the most important since it actually allows the use of manages client interaction by adopting a round-robin protocols inside the framework. Given an XML or a approach. visual representation of the interaction protocol, the The AUML tool for AgentService allows users to protocol compiler generates an assembly containing the define guard conditions (for alternative and optional following entities: statements) as Boolean expressions which very often • the definition of the protocol object model; involve elements contained within messages previously • the definition of state machines implementing the received. Hence the guard condition is not a simple label but it is a fundamental element involved in the generation roles defined in the interaction protocol; of the code modeling the protocol. • the definition of the interfaces types used by the state Finally the AUML Loop operator is extended in order machines to customize the execution flow of the to be able to clearly indicate the agent role that manages protocol. the loop. Software agents, in order to participate into a protocol, 4.2 Code generation and execution of interaction have to interpret one of the roles defined in the protocol. This role is interpreted by adding a behaviour object protocols which executes the state machine defining the role; such behaviour object has to implement the interface required Starting from the model representing the interaction by the state machine and through the methods exposed by protocol it is import to be able to generate agents playing this interface interacts and controls, when possible, the roles within the protocol and then execute them. The execution of the state machine. The customization level designer only defines the structure of the protocol and provided by interface is required, for example, in order to creates classes targeting the AgentService object model let the agent choose among different alternatives and then which represent the state machine executing the drive the execution of the protocol. interaction protocol. It is up to the agent playing a The state machines automatically handle all the specific role to complete the state machine generated by exceptions that can occur while executing the protocol the tool with all the information it needs. (i.e. wrong or malformed messages, etc.) and the behaviour objects running the state machine can be informed about these exceptions through specific events. 4.2 Related works There are some interesting works based on Agent UML involving the definition of design tools. Ehrler and Cranefield propose a Plug-in for Agent UML Linking (PAUL) [12] based on the FIPA-compliant agent platform Opal [13] and the Eclipse Modeling Framework. In particular this tool uses the UML Object Constraint Language (OCL) [14] in order to define the input and output of the operations an agent can perform within a protocol. Our design tool does not require the definition of I/O data for protocol operations; agents playing a protocol role have access to all the content of the messages received during the interaction and of course can consult their knowledge base. Winikoff [15] precisely defines the syntax of a subset of AUML by using a textual notation; he provides a tool Figure 3. Protocol development process for designing diagrams in order to support the notation. Figure 3 describes the protocol development process: This tool cannot generate code for the models that have to interaction protocols can either be exported into XML be implemented manually. format or into assemblies which can be directly used to Viper [16] is a graphical editor based on the earlier program software agents. Both of the two representations version of AUML that can generate code for contain the same information: the first is mainly used to AgentFactory [17]. The tool, in the implementation phase, maintain a textual representation of the protocol and to involves users for populating the protocol with export it to third party applications, while the second is customized agent code, which together with code 170 automatically generated to reflect the protocol semantics ontology agent has to be implemented in order to be is compiled into useable agent designs. Hence the tool completely compliant with the FIPA specifications. generates a skeleton of code implementing the protocol and users have to complete and compile it. Instead the 6. References AgentService protocol designer generates an assembly containing the classes representing the state machine of [1] Wikipedia, definition of software ontology, available at the protocol and a programming interface that users can http://en.wikipedia.org/wiki/Ontology (computer sci-ence). implement in order to customize agent operations. Viper is not provided with an ontology system. [2] C. Vecchiola, A. Grosso, A.Gozzi, and A. Boccalatte, “AgentService”, Proceedings of the 16th International Conference on Software Enginnering and Knowledge 5. Conclusions Engineering (SEKE04), Banff, Alberta Canada, KSI Publisher, 2004. In this paper we presented the software infrastructure introduced into the AgentService framework in order to [3] FIPA, “FIPA Ontology Service Specification”, 2001, support ontology design, implementation, and [Online document], Availabe at management. Software ontologies are a high level HTTP:http://www.fipa.org/specs/fipa00086/XC00086D.pdf. abstraction which is very useful for identifying the concepts of a problem domain, to define their relation, [4] Standard ISO/IEC 23271:2003: Common Language Infrastructure, March 28, 2003, ISO. and to reason about them. Ontologies give an added value to the interaction among software agents since they [5] FIPA, “FIPA SL Content Language Specification”, [Online provide facilities to define a communication and to document] available at HTTP: validate messages. http://www.fipa.org/specs/fipa00008/SC00008I.html. The support provided by AgentService covers, either directly or not, all the activities previously cited: [6] J. Gennari, M. A. Musen, R. W. Fergerson, W. E. Grosso, AgentService relies on Protégé in order to define a new M. Crubezy, H. Eriksson, N. F. Noy, and S. W. Tu, “The ontology and translates the representation provided by Evolution of Protégé: An Environment for Knowledge-Based Protégé into a collection of classes fitting the object Systems Development”, Stanford Knowledge System Lab, 2002. model defined into the framework. These classes can be easily used to define a conversation among software [7] M. Storey, M. Musen, J. Silva, C. Best, N. Ernst, R. agents: messages can be verified against a specific Fergerson, and N. Noy, “Jambalaya: Interactive visualization to ontology and eventually discarded if spurious. By enhance ontology authoring and knowledge acquisition in querying the ontology agent we can dynamically inspect Protégé”, Workshop on Interactive Tools for Knowledge the ontology catalog maintained in every multi-agent Capture, Victoria, BC, Canada, 2001. system and extract useful information about their structure, such information can be easily used in order to [8] G. Caire, “Jade Tutorial – Application-defined Content start a communication with agents which know that Languages and Ontologies”, 2002. ontology. [9] J. Odell, H. V.D. Parunak, and B. Bauer, “Extending UML Software ontologies can also be useful to define for agents”, Proceedings of Agent-Oriented Information Systems structured conversations among agents since they Workshop (AOIS-00), 2000. completely define the content of the exchanged messages. AgentService provides a useful tool to visually define [10] J. Odell, H. V.D. Parunak, and B. Bauer, “Representing interaction protocol integrated with the ontology service: agent interaction protocols in uml”, Paolo Ciancarini and it is then possible to start from the definition of the Michael J. Wooldridge Editors, Agent-Oriented Software problem domain with Protégé, translate that Engineering, No. 1957 in LNCS, pp. 121–140, Springer Verlag, representation into a software ontology, build an 2000. interaction protocol based on those concepts, and produce a state machine which can be directly used by software [11] FIPA. “FIPA Interaction Protocol Library Specification”, 2001. [Online document], Availabe at HTTP: agents to interpret roles. All this process can be http://www.fipa.org/specs/fipa00025/XC00025E.pdf. performed without writing a line of code thanks to the supports provide by the framework. [12] L. Ehrler and S. Cranefield, “Executing agent UML Nonetheless, the ontology service can be improved: diagrams”, Proceedings of the third international conference on now AgentService provides support only for the SL0 Autonomous Agents and Multi-Agent Systems (AAMAS), pp. subset of the FIPA ACL specification while a complete 906–913, 2004. implementation of the SL2 specification is still to come. Moreover, a more complete service provided by the 171 [13] M. Purvis, S. Cranefield, M. Nowostawski, and D. Carter, [16] C. Rooney, R. Collier, and G. M. P. O’Hare, “VIPER: “Opal: A Multi-Level Infrastructure for Agent-Oriented Visual Protocol EditoR”, 6th International Conference on Software Development”, Information Science Discussion Paper Coordination Languages and Models (COORDINATION 2004), Series, No. 2002. 2004. [14] J. B. Warmer and A. G. Kleppe, “The Object Constraint [17] R. Collier, “Agent Factory: A Framework for the Language: Getting your models ready for MDA”, Addison- Engineering of Agent-Oriented Applications”, Ph.D. Thesis, Wesley, 2nd edition, 2003. Department of Computer Science, University College Dublin, Ireland, 2001. [15] M. Winikoff, “Towards Making Agent UML Practical: A Textual Notation and a Tool”, First international workshop on Integration of Software Engineering and Agent Technology (ISEAT 2005), Melbourne, Australia, 2005. 172