The Text Track Users' Manual

Contents

Manual for the Interactive Session

The interactive session is a simple demonstrable application for the Text Track Porject. This user in this session can type in simple commands in a command interpretor to formulate queries using the text index previously created. The commands are kept simple and easy to use, and sufficient displaying capabilities are given in order to look at the current results. The basic architecture of this interactive session is very much like a simple microprocessor, using one accumulator and a number of registers (in the present implementation, the number of registers are set to 10, numbered from 0 through 9).

In the current implementation, the interactive session is ran by running the executable (see the section on deliverables to know how exactly this is done.) The executable program is coded to read in the SGML file and the DTD, parse it using sgmls, and build the index using the parsed output produced by sgmls. Once the index is built, it starts the interactive session with the prompt "New Command:" as shown below:

Whats up doc?<~/mmdb/src>a.out
Parsing....
done.
building index.....
done.
Ready for query input .....
Next command:

The commands available at this prompt are shown as follows:

-----------------------------------------------

Manual for the API

The API or the Application Programming Interface is essentially a set of C++ classes and public methods therein which can be used to do all the above functions from within another C++ program. The class structure can be obtained from the Class declarations. All programs written in this API must follow some particular stages and guidelines. The basic stages and the functions therein are shown below:

  1. Parsing:Parsing is done normally by calling the SGMLS parser by John Clark. This is to be done by calling the sgmls parser using a system command. The system command should take care of the input file either passed in as a command-line parameter or defaulted to a particular file. See the man pages for sgmls for command line syntaxes. Remember to put the output of sgmls into a temporary file, since this file would be used to build the index.
  2. Index building:Index is built by calling the helper procedure do_element. To successfully use this procedure, use the following stages:
    1. Initialize: Initialize a variable, say root, to the type Element and set it to NULL.
    2. File open: In this stage, the file that was used to put the sgmls output is opened. Use fopen to open the file, and put the file handle in a variable, say fp.
    3. Read first line: This stage is necessary in order to make the do_element procedure start up. Just use fgets C procedure to get the first line from the file, in a string variable, say, fline.
    4. Call do_element with root, fline, and fp, in the following manner:
      root = doelement(fline, fp)
    See the example file main.C to get an idea on how this whole thing is done. It does the parsing, index building, and then calls the interpret routine to invoke the command line interpreter
  3. Querying:The querying is left completely to the programmer - the structures for traversal are only provided - the programmer can use these as well as the other public methods in classes.H to do traversing, comparing, or printing. One complete query stage, including initialization, query, display is shown below:
    Element_list *do_query(Element_list *input, int query_type, char *command)
    {
      char name[15], value[1024];
      Element_list *result = NULL, *temp = NULL;
      strtok(command," ");
      strcpy(name, strtok(NULL," "));
      strcpy(value, strtok(NULL," "));
      
      pass_no++;
      if (input != NULL)
        result = input->map(name,value,temp,1);
      else cout << "Empty accumulator" << endl;
      return result;
    }
    The above procedure, do_query, available as a public procedure in interp.H is called with an input element list (a temporary accumulator), the type of query (UP: 1, DOWN: 2, ATT: 3), and the command string in the interpreter syntax given in the Interactive interface.

Future Extensions

Future extensions to this system are presently being thought out. This would include making the index persistent, giving a better interactive interface, possibly with a GUI, and connecting it with the Kiosk movie players to actually play movie clips based on the result of the query.