Reference Manual

| Table of Contents |

Object Modeler

The Object Modeler tool is used to describe an object model in an ontology. The Object Modeler provides a canvas where you draw figures representing classes and links representing the relationship between classes. The icons in the Object Modeler represent classes that will be instantiated by the agent to store domain information or perform actions in the domain. The links are used to show the relationships between classes. The classes defined in the object model can be mapped automatically into Java source files, which can then be compiled into Java class files (some source files may require editing, the Object Modeler cannot provide the code for user-defined methods). Note that all Project Accessory Classes (PACs) must first be defined in the Object Modeler before they can be imported into the PAC Editor (See PAC Editor). The Object Modeler is used to define the data attributes and the APIs of all classes that will be used in the agent's mental model. Java class files can be directly imported into an object model, thus saving you the effort of specifying the API for classes that are already coded.

The Object Modeler uses the notation from the Unified Modeling Language (UML). While UML method defines a very rich set of notation for modeling large complex systems, this tool implements a subset of the complete notation. See the UML Resource Center at http://www.rational.com/uml for more information.

Overview

The Object Modeler contains a menu bar with five items: File , Edit , Map , Windows and Help . The File menu allows you to open previous object models as well as save the current models. The File menu also allows you to import class files and update the objects. You can also Print the object model to obtain a hard copy. The Edit menu allows you to Cut , Copy , Paste , and Delete the selected class or link. The Map menu allows you to modify the current object model by adding new class or links, or to clear the entire drawing canvas. The Windows menu allows you to quickly and easily switch between the various open AgentBuilder tools. The Help menu gives you access to the AgentBuilder help system. Figure 18 illustrates a model constructed with the Object Modeler.

Figure 18. Object Modeler

The main feature of the Object Modeler is the canvas on which you can construct an arbitrarily complex structure of classes and relations between classes. Utilizing the menus discussed above as well as context-sensitive pop-up menus you can construct simple or complex object models as needed. In addition, the tool allows you to edit a classes' properties. It is easy to rearrange classes to simplify the structure and minimize overlap of links. Three types of class links are supported: generalization, aggregation, and association. Each link has a different symbol that represents the type of relationship between the two connected classes.

Operation

Creating a New Class

You can create a new rectangular figure representing the new class by right-clicking on an unoccupied region of the canvas and selecting New Object from the pop-up menu. This will cause AgentBuilder to display the dialog shown in Figure 19 in which you can enter a name for the class being represented, a description of the class, and method and attribute information. From this dialog you also specify the methods and attributes of the class. The methods are the API of the class. It is important for you to specify all constructors that might be used. It is only necessary to enter the attributes which you are going to read or write; private attributes that are not accessed need not be included. If the type you desire for an attribute is not in the Types pull-down menu, you can enter the class in the combo-box text area and then press the Enter key on the keyboard after typing the class name.

Figure 19. Class Properties Dialog

There are a couple of things to keep in mind when creating a new Class. A global class table keeps track of all classes in the ontologies. Therefore, all classes used in the object model need to specify their fully qualified class name in order to avoid ambiguity. Different objects cannot use the same name, even if they exist in different ontologies. Any classes used as an attribute or parameter must either be a primitive, basic Java type, or defined in the same object model. The basic Java types supported are arrays, hashtables, enumeration, and objects. By default, all classes created in the Object Model will implement the Serializable and Cloneable interfaces. The tool automatically generates read/write routines for each attribute. Each attribute specified must have read/write methods that follow the Java Bean convention. The Java Bean convention is specified more precisely in the Java literature and requires a "set" and "get" routine for each attribute. For example, if you specify an attribute named price, the tool will generate the methods setPrice and getPrice.

Clicking the OK button will create a new rectangular figure on the canvas representing the new class. Note that the point where you right-click is where the figure will be drawn. If you decide not to create this new class, you can press the Cancel button and the object model will remain unchanged. You can also use the Map menu in order to create a new class in an identical manner.

Cutting, Copying and Pasting a Class

Classes can be cut, copied, or pasted. There are two ways to use the clipboard functions for a class. The first way is to use the Edit menu's Cut , Copy and Paste menu items. The other method is to use the class's pop-up menus for cut and copy, and the map's pop-up menu for paste. Whichever method is used, a class must be selected before a cut or copy operation. If the model being pasted into already contains the name of the class being pasted, the class to be pasted will recursively have CopyOf prepended to its name.

Viewing and Altering the Properties of an Existing Class

You can view and modify the name and description of an existing class by right-clicking on the desired class. You can then select the Properties item from the pop-up menu. AgentBuilder will then display a dialog which will allow you to see and alter the name and properties of the selected class. By clicking on the OK button you can enter the changes; clicking on the Cancel button will revert to the original unaltered properties.

Creating a New Link

You can create a new link by right-clicking on any unoccupied region of the canvas and selecting between generalization, aggregation and binary association link types. Once again, this can also be initiated by selecting one of the link types from the Map menu.

  • Associations. A group of classes with common structure and common semantics are associates of one another. For example, an association link could be Joe Smith works-at IBM. An association is something like, person works-at company. Associations are always bi-directional and there can be rolenames given for each direction. Also cardinality (UML calls this multiplicity) can be denoted as well as a specific ordering of objects of a Class.
  • Aggregation (Whole-Part relationship). This relationship relates an assembly class to one component class. For example: Engine is-part-of Car. The aggregation relationship is transitive and it is possible to use the aggregation relationship recursively.
  • Generalization (Inheritance). Generalization is a relationship between a class (superclass) and one or more refined versions of it (subclass) who share attributes and operations. These are denoted in the superclass from which the subclasses inherits. A subclass may override features defined in a superclass like methods of operations and values of attributes. In this way the subclass is an extension and a restriction of the superclass. A class can inherit from one other class (single inheritance) as well as from several other classes (multiple inheritance). It is mentioned that this can cause conflicts among attributes or methods with the same names that are defined in the different superclasses.

Once you have selected one of the link types, the cursor will change to a cross-hair and you can then click-and-drag on the initial class and join it to the other desired class. Note that the order of connection does matter. The aggregation and generalization links are directed and need to be selected in the appropriate manner: For generation, the first class clicked on is the parent class; for aggregation, the first class must be the class that contains the second.

Moving an Existing Class

You can freely move a class anywhere on the canvas that you desire. Do this by clicking on the desired class and dragging the class to the new location. Links will adjust themselves in order to maintain the connection with the moved class.

Moving Multiple Classes

You can move multiple classes in a single operation. First, select the class you wish to move. To do this, hold the Control key down and select the classes with the mouse. Once you have a groupof selected classes and while holding the Control key down and dragging one of the selected classes to a new location. You will notice that all the selected classes move with the mouse cursor. To deselect the classes, simply click on the canvas.

Deleting an Existing Class

You can delete an existing class by clicking on that class (e.g. selecting it) and then right-clicking and selecting the Delete item from the pop-up menu. Likewise, a selected class can be deleted using the Delete item in the Edit menu. Note that when an class is deleted, all links to that class are also deleted.

Deleting an Existing Link

You can delete an existing link either by selecting a link (a selected link is red in color) and then right-clicking and selecting Delete from the pop-up menu or using Delete in the Edit menu.

Changing the Link Type of an Existing Link

You can change the properties of a link by selecting that link and right-clicking to bring up the pop-up menu. You can then select the link (turning it red) and change the link type by selecting one of the types from the Link Type hierarchical menu.

Viewing and Altering the Properties of an Existing Link

You can view and modify the link label, description and type of a selected link by right-clicking on the selected (red) link. You can then select the Properties item from the pop-up menu. AgentBuilder will then display the Link Properties dialog that will allow you to see and alter the name, description, and link type of the selected link. Figure 20 shows this dialog for viewing and editing link properties.

Figure 20. Link Properties Dialog

Saving a Object Model

You can save an object model by selecting Save in the File menu. You can then close the Object Modeler and return to it at a later time. The Save action will save the classes and links as well as their locations relative to each other.

Saving the Object Model to a File

The object model can be saved to a text file by selecting File < Generate Printable . Selecting this menu item will display a file dialog for saving the object model to a file. By default, the directory is set to the current working directory, and the filename is set to object-model-name.txt .The text file that is generated will contain a text description of all of the classes in the object model. Currently, no information is being printed about class links. Default Ontology Object Model (Printable) shows the contents of the DefaultOntology object model.

Clearing an Object Model

If you wish to delete everything from the current object model and start over, you can do so by selecting Clear under the Map menu. Note that this will remove all classes and links that have been entered. AgentBuilder will ask you to confirm this by displaying a confirmation dialog window. You can either select Yes if you are sure that you want to clear the current object model, or select No if you decide not to clear the canvas. Note that if the you later decide you want to use the previous object model and have not saved the current object model since clearing it you can close the Object Modeler and not save the changes. However, if you Save after clearing the object model, there is no way to revert to the previous object model.

Importing Class Files

You can import class files into your object model. This allows you to automatically create classes in your object model by simply importing selected classes. Figure 21 shows the Object Modeler's Import Dialog .

Figure 21. Object Modeler Import Dialog

The Import Dialog is accessed through the File < Import Class Files menu item. To import class files, you must first enter the full package and class name in the class text field. The package name is required, because the Java reflection API can only look up fully qualified class names. Once the package name has been entered into the Package text field, the class name must be entered into the Class text field.

To add the class to the list, you must either press the Enter key while the cursor is inside the Class text field, or click on the Add button. The new item in the list will be a fully qualified class name. As a convenience, the contents of the Package list contains the package names for the classes already defined; this makes it easy to enter additional classes from those packages.

Once you have finished adding classes to the list, you have the option of importing the inherited attributes and methods by clicking on the checkbox labeled Import inherited attributes and methods . Keep in mind that any class being used as a parameter or return value must be a primitive, basic Java type (arrays, hashtables, enumeration, and objects), or defined in the same object model. If this is not the case, a warning dialog will be displayed with a list of undefined classes. You can now click on the OK button to import the classes. Any classes that are not included in your classpath will generate a warning and will not get imported into the object model. Clicking on the Cancel button will cancel importing classes.

Updating Objects

If at any time the class files for the objects defined in the object model are modified, you will need to recompile the class and update them in the Object Modeler. To update the objects in the object model, you need to select the Update Objects menu item from the File menu. This will bring up the Update Dialog , see Figure 22. You will see the list of objects defined in the object model. You will need to select the objects that you wish to update. The Select All button will select all classes listed in the objects pane. Once you have selected the classes to update, you must click on the OK button to update the classes. If the new changes of the object include a class that's not defined, it will generate a warning. If you click on the Cancel button, no classes will get updated.

Figure 22. Update Dialog

Listing Undefined Classes

Once you have imported objects into the object modeler, you can easily view which classes, if any, need to be defined using the Undefined Types dialog. You won't be able to import any objects into the PAC Editor if they contain undefined types.

To access the Undefined Types dialog, you need to select the File < List Undefined Classes menu item. The dialog will provide a list of types that are undefined and point to the class objects using them. Once you have defined all types in the current object model, selecting the File < List Undefined menu item will bring up a different dialog informing you that all types have been defined.

Exporting Java Files

Once your object model contains classes, you can export the classes into Java files. Figure 23 shows the Object Modeler's Export Dialog .

Figure 23. Object Modeler Export Dialog

The Export Dialog is accessed through the File < Generate Java Files menu item. To export Java files, you must select the classes you want to export. You can make your selections in one of three ways. If you just want to select a single class, you can do so by selecting the class from the list using the left mouse button. To select multiple classes, hold down the Control key while selecting classes with the left mouse button. To select all of the classes in the list, click on the Select All button.

Once the classes to be exported are selected, you must specify a directory to which the Java files will be exported. The default directory is your current working directory. To change the export directory, click on the Select Directory button. Clicking on the Select Directory button will display the Directory Dialog shown in Figure 24.

Figure 24. Directory Dialog

Once a directory has been specified, you can click on the OK button to export the selected classes into Java files. Alternatively, you can click on the Cancel button to cancel the operation. After the selected classes have been exported, Java files will appear in the directory that you specified. The file names will be the class names with the .java extension appended to the name.

Switching Windows

The Windows menu is a dynamic menu that contains a list of all AgentBuilder tools that are open. This menu facilitates switching between the tools when multiple tools are open. To switch to the desired tool, select the tool from the Windows menu. The selected tool will then be brought to the top of the display.

Accessing Help

The help system can be accessed using the Help menu item. The About menu item allows you to read the help information for the current tool. The Index menu item will display an index to the help system's contents. The Tutorial menu item will display the Quick Tour of the AgentBuilder toolkit. The About AgentBuilder menu item will display the AgentBuilder logo along with the version number and copyright information. The AgentBuilder Home Page menu item will display the home page for the AgentBuilder product.

Closing the Object Modeler

You close the Object Modeler by selecting the Close item in the File menu. If necessary, AgentBuilder will query whether you want to save your changes. Selecting Yes will save all changes since the previous Save . Selecting No will revert to the object model configuration last saved.

Exiting AgentBuilder

To exit from AgentBuilder, select the Exit from the File menu. AgentBuilder will then display a dialog asking whether you are sure you want to exit. If so, then click on Yes button; if you do not wish to exit, click on the No button.

| Table of Contents |


AgentBuilder is a registered trademark of Reticular Systems, Inc.
Copyright © 1998-2001 Reticular Systems, Inc.