Java Based Agent Communication in Information Visualization
                                              --Yu Ju
                                     yju2@cs.umbc.edu
                               Computer Science Department
                        University of Maryland, Baltimore County
 
  This paper describes the agent communication used in a volumetric interactive system for information visualization. The system uses glyph-based volume rendering enhanced by an agent talking with outside world.  We employ a three tier architecture with the middle ware agent acting as the communication channel between the front
end viewer client and the back end server. The agent talks with outside world in Jackal, which is a high-level agent communication language implemented in Java. The purpose of the agent is to provide a standard interface so that the viewer can get data from any server that supports Jackal.
  • Introduction
  • In this part, I am going to briefly describe the functionalities of the front end viewer and the backend server, and how they communicate through the middle ware agent.

    SFA -- the viewer

    The viewer, which is called SFA, is an interactive information visualization system. There have been several previous approaches to the interactive display of volumetric data. Many research systems and several commercial systems allow interactive viewing of data using traditional 2D interfaces. These systems fail to capitalize on the human perception system's ability to understand full 3D volumetric space. SFA utilizes full volumetric space for visualizing information through glyph rendering.

    Glyph, or iconic, visualization [1][3] is an attempt to encode more information in a comprehensible format and allow multiple values to be encoded in the parameters of the icons. The shape, color, transparency, orientation, etc. of the glyph can be used to visualize data values. Careful data value mapping to glyph rendering attributes allows better comprehension of the multivariate data than can be achieved using direct volume rendering.

    SFA not only can analyze data stored on local disk, but also can analysis live data received from network through an agent. This makes it possible for real time visulation of interesting data. This feature is made possible by an intelligent agent.

    Rendering within SFA

    SFA provides both a traditional 2D mouse-keyboard interface and a two-handed direct manipulation interface using 3D magnetic trackers with buttons, allowing scene specification and examination. The simultaneous use of these trackers takes advantage of the user's knowledge of his/her hands' location in space and allows both hands to be employed in parallel to quickly achieve the desired operation. The non-dominant(left) hand manipulates the position and orientation of the entire scene while the dominant(right) hand selects the 3D volume subset using three-space subsetting and picks glyphs for value displaying.

    By mapping a data dimension to one of the glyph's attributes, SFA can display up to seven dimensions of a data set. The glyph's attributes can be location(3D), size, shape, color, and opacity. The mapping can be done dynamically after the data is loaded.

    Subset is a further aid in reducing visual clutter. The user may choose to concentrate on a particular subset of the volume, culling the unwanted glyphs. This control serve to reduce the number of glyphs drawn, thereby reducing the amount of time taken to draw the scene.
     

    Telltale -- the server

    Telltale[7] provides full-text information retrieval from text corpora. Text documents are represented as multi-dimentional vectors in n-gram document analysis technique. The document is broken down into unique grams. The frequencies of these grams are used as the components of the vector representing that document. The vector representation allow us to use the cosine of the angle between the two vectors as a similarity measure between the two documents. When the document retrieval engine receives a user query, it calculates the similarity between the query and every document in the corpus.
    The similarity vector is mapped to one dimension of the document glyphs. A document glyph can support up to 7 dimensions, including (x,y,z) position, size, shape, color, opacity. This multi-dimensional data is sent to the agent which in turn sends it to SFA for display.

    The agent

    The agent is the communication channel between SFA and Telltale. It uses Jackal[9] to communicate with Telltale. Jackal is a Java package, which allows applications written in Java to communicate via KQML. KQML is a high level Agent Communication Language, a language for programs to use to communicate attitudes about information, such as query, stating, believing, requiring, achieving, subscribing and offering. KQML is indifferent to the format of the information itself.

    A KQML message consists of a performative, and several attribute-value pairs.
    For example:

    (ask-one: content (what's KQML?)
                   : language English
                   : sender professor
                   : receiver student
                   : reply-with ID123
                   : ontology real-world-ontology
    )

    Jackal is a Java implementation of KQML. It provides an API for easy construction of agents. Some of the features of Jackal are:

        1) Facilitates the sending and receiving of KQML messages.
        2) Supports the use of multiple transport protocols, such as http or smtp.
        3) Implements a complete scheme for universal agent naming and address resolution.
     

    To better understand the Jackal API, we need to have the following knowledge of Jackal.

    1. The Message class -- how a KQML message is represented in Jackal.
        - A hashable, indexed by slot name.
            . one entry represents a KQML slot(field);
            . the key(index) is the field name;
            . the data is the content of the field;
        - Several important methods:
             containsKey(String)
            Determine whether this message contains the named slot.
            get(String)
            Retrieve the value of the given slot.
            put (String, Object)
            set the value of a slot.

         - Creating an instance of Message:
            creat an empty/incomplete message, then set some fields.
            e.g,
            msg = new Message(intercom); //an empty message
              msg.put("performative", "ask-one");
              msg.put("content", "(what's your name)");
              msg.put("language", "English");

    2. The Intercom class: sending/receiving KQML messages

       - The Intercom class provides the primary interface between the user's agent code and the J3 support mechanisms. An agent needs to get an instance of the Intercom class before it can use Jackal for communication.
        . Initializing communication environment
        . Providing methods to send/receive KQML messages

      - sending a message and get queue of reply(s):
         FIFO queue =
                  attend(Message msg, //message to send out
                              String template,      //set to null
                              String sid,        // set to null
                              int priority,      // request rpi, set to 5
                              boolean dedete,  // set to false
                              boolean write,   // set to true
                              int life,               // # of matches before remove request
                              boolean in,  //catch only incoming messages
                              boolean out) //catch only outgoing messages

           e.g,
           queue = intercom.attend(msg, null,null, 5, false, true, 0, true, false);
           non-blocking call

    3. the FIFO(queue)

    When an agent wants to catch incoming messages, or send out a request and wait for replys, it can call attend(...) method and this method returns a queue without blocking; the matched incoming messages/replies will be put into this queue by Jackal. All the agent needs to do is to check the queue and picks the message out when available.

       - Most oftenly used methods of FIFO class:
         dequeue()
         dequeue and  return the object at the head of the buffer(queue); block if the queue is empty. Return data type is Object, casting ot appropriate type is necessary.
         e.g,
         queue = attend(...);
          msg = (Message)queue.dequeue(); //block until data available
          //   do a loop to catch successive incoming messages/replies:
          while(true) {
           msg = (Message) queue.dequeue();
           //process the message;
         }

        empty()
        true if the queue is empty; false otherwise. non-blocking;

        size()
        return number of elements in the queue, non-blocking.

    4. FQAN, the fully qualified agent name
        - achieve the uniqueness of agent name in a multi-agent system
        - creating an instance of FQAN:
           fqn = new FQAN(agentname);
           //creat a new instance of FQAN, where agentname
           //is the string format of the fully qualified agent name.
       - Jackal accepts FQAN in object format, not is string format
       - can transform between Object format and string fromat.
        . from object format to string format:
          stringname = fqan.toString();
        . from string format to object format
          FQAN fqan = new FQAN(stringname);

        e.g. when sending an "advertise" message to broker,
        adv = new Message("(advertise: content(I can program Java))");
         FQAN fqan = newFQAN("ba.ans");
         adv.put("receiver", fqan);
     

    Currently, the communication between SFA and Telltale is implemened by using a middleware intelligent agent that will communicate with Telltale using Jackal and communicate with SFA using TCP/IP sockets. A seperate thread is started in SFA that waits for a data set coming from the middleware agent. In this agent,  a queue is opened first to hold the communication content between the agent and Telltale.
    Then the data set will be retrieved from the queue and sent to SFA, as the following code shows.
     

            try {
                 Message query_tell;
                 if (ds_queue.empty()) {
                   query_tell = (Message) ds_queue.dequeue();

                   DataSet t = new DataSet();
                   t = (DataSet) query_tell.get("content");
                   System.out.println("sfaserver: Got content.");
                   System.out.println("sfaserver: Incoming message length:" + t.data[0].length);
                   /* connecting to SFA */
                   InetAddress addr=InetAddress.getByName("zambezi.cs.umbc.edu");
                   System.out.println("addr = " + addr);
                   Socket socket = new Socket(addr, 8080);
                   DataOutputStream out3 = new DataOutputStream(
                                               socket.getOutputStream());
                   t.SendOut(out3);
                    socket.close();
                   /* Finish Sending dataset to SFA */

                   Message reply2;
                   reply2 = new Message("(tell :content (received))");
                   reply2.put("language", "english");
                   reply2.put("receiver", query_tell.get("sender"));
                   reply2.put("in-reply-to", query_tell.get("reply-with"));

                   _intercom.send_message(reply2);
                }

    The following code shows the method DataSet.SendOut() that is used to send that data set to SFA.

    class DataSet implements Serializable {
           ... // some data member declarations and method definations

         public void SendOut(DataOutputStream out)
         throws IOException {
           int i;
           try{
               out.writeInt(ID.length());
               out.writeBytes(ID);
               out.writeInt(dim);
               out.writeInt(data_length);
               out.writeInt(time_steps);

               for(i=0; i<dim; i++)
               {   out.writeInt(dim_filename[i].length());
                   out.writeBytes(dim_filename[i]);
               }

               for(i=0; i<dim; i++)
               {   out.writeInt(dim_name[i].length());
                   out.writeBytes(dim_name[i]);
               }

               for(i=0; i<dim; i++)
               {   out.writeInt(maps[i].length());
                   out.writeBytes(maps[i]);
               }

               for(i=0; i<dim; i++)
                   out.write(data[i],0,data_length*4+12);

               out.flush();
           } catch (Exception e) {
             e.printStackTrace();
          }
       }
     

    On the other side, the Telltale will first check if the middleware agent is ready for receiving data. If it is ready, then it will construct the data set and send it over. Telltale uses Jackal for the communication work as showed in the following:
     

      public boolean check_sfa ()
        try {
          Message query = new Message("(ask-one :content (sfa on))");

          query.put("receiver", serverName);
          Message reply = _intercom.attend(query); // blocked until get a reply message
          System.out.println("sfaclient: reply received...");
          String response = (String)reply.get("content");
          if (response == "(ready)") {
            sfa_status = true;
          }
          else if (response == "(not ready)") {
            sfa_status = false;
          }
          return(sfa_status);
        }
     

    With a simple Java program that simulates the role of Telltale, the middleware agent performs its part of work between SFA and Telltale. Between the agent and Telltale, Jackal is used for handshaking and data sending. Between the agent and SFA, data set is sent over TCP/IP sockets.
      Jackal provides a high level communication language that can be used to send messages back and forth between two processes, even the process are on different hosts. It is easy to set up a hand shaking between two agents and send data in different formats. A more elaborate filtering process can be added in the middleware agent so that it can receive only the kind of data set that it is interested in. This means that serveral round trip negeotiations are necessary before a data set is sent from Telltale to the agent. [1] Shaw, C., Kukla, J., Ebert, D., Nicholas, C., Zwa, A., Miller, E., Roberts, D. "Interactive Volumetric Information Visualization for Document Corpus Management," Journal of Digital Libraries, to appear 1999.

    [2] Ebert, D., Nicholas, C. Proceedings of CIKM 97 Workshop on New Paradigms in Information Visualization and Manipulation, (editors) November 13-14, 1997, ACM Press 1998.

    [3] Ebert, D, Kukla, J., Shaw, C., Zwa, A., Soboroff, I., and Roberts, DA., "Automatic Shape Interpolation for Glyph-based Information Visualization," IEEE Visualization 97 Late Breaking Hot Topics, October 1997, Phoenix, AZ.

    [4] Ebert, D., "Volume Visualization for Document Corpus Management," CIKM '96 Workshop on New Paradigms in Information Visualization and Manipulation, Rockville, MD, November 1996.

    [5] David S. Ebert, Christopher D. Shaw. Two-handed interactive stereoscopic visualization.  IEEE Visualization '96 Conference.

    [6] Ebert, D., Shaw, C., Zwa, A., Miller, E., and Roberts, D. A. "Minimally-immersive Volumetric Information Visualization," IEEE Information Visualization '96 1996.

    [7] Ethan L. Miller, Dan Shen, Junli Liu,  and Charles Nicholas, "Performance  and Scalability of a Large-Scale N-gram Based Information Retrieval System," to appear in the Journal of Digital Information.

    [8] A Proposal for a new KQML Specification, Yannis Labrou and Tim Finin, TR CS-97-03, February 1997, Computer Science and Electrical Engineering Department, University of Maryland Baltimore County

    [9] http://jackal.cs.umbc.edu/cost/projects/jackal/default.htm