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:
up/down/att <name> <value> e.g: Next command: down MOVIE * Next command: up SCENE * Next command: down CASTNAME THREEPIOIn all the above commands, only the value is case sensitive.
-----------------------------------------------
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:
root = doelement(fline, fp)
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 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.