ThoughtTreasure Java-based client API

Version 0.00022

by Erik T. Mueller
The ThoughtTreasure Java-based client API allows a Java program to communicate with the ThoughtTreasure natural language/commonsense server. It consists of a collection of Java classes (see especially TTConnection) that implement the ThoughtTreasure Server Protocol (TTSP). (A Python client API is also provided in the ThoughtTreasure distribution and Perl and Tcl client APIs are in progress.)

Here is a simple Java program that uses ThoughtTreasure:

/* Tell Java to use the ThoughtTreasure Java-based client API. */
import com.signiform.tt.*;
public class Example {
public static void main(String args[])
{
  try {
    /* Create a connection to the ThoughtTreasure server running
     * on the machine "somehost" and listening on the TTSP
     * port number 1832.
     */
    TTConnection tt = new TTConnection("somehost");

    /* Ask ThoughtTreasure whether Evian is a beverage and print
     * the response.
     */
    System.out.println(tt.ISA("beverage", "Evian"));

    /* Close the connection. */
    tt.close();
  } catch (Exception e) {
  }
}
}

See also the longer example program and the article on adding common sense to applications using the API.

The Java-based client API is provided in the java directory of the ThoughtTreasure distribution.


Classes | Index | Download

Questions or comments? webmaster@signiform.com
Copyright © 2000 Signiform. All Rights Reserved. Terms of use.