org.jscience.linguistics.kif
Class KBmanager

java.lang.Object
  extended by org.jscience.linguistics.kif.KBmanager

public class KBmanager
extends java.lang.Object

This is a class that manages a group of knowledge bases. It should only have one instance, contained in its own static member variable.


Constructor Summary
KBmanager()
          Constructor which reads in a configuration from a file.
 
Method Summary
 void addKB(java.lang.String name)
          Create a new empty KB with a name.
static java.lang.String escapeFilename(java.lang.String fname)
          Double the backslash in a filename so that it can be saved to a text file and read back properly.
 boolean existsKB(java.lang.String name)
          Returns true if a KB with the given name exists.
 KB getKB(java.lang.String name)
          Get the KB that has the given name.
 java.util.Set getKBnames()
          Get the Set of KB names in this manager.
static KBmanager getMgr()
          Get the one instance of KBmanager from its class variable.
 java.lang.String getPref(java.lang.String key)
          Get the preference corresponding to the given kef.
 void initializeOnce()
          Read in any KBs defined in the configuration.
static void main(java.lang.String[] args)
          A test method.
 void remove(java.lang.String name)
          Remove the KB that has the given name.
 void removeKB(java.lang.String name)
          Remove a knowledge base.
 void setPref(java.lang.String key, java.lang.String value)
          Set the preference to the given value.
 void writeConfiguration()
          Write the current configuration of the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KBmanager

public KBmanager()
Constructor which reads in a configuration from a file.

Method Detail

initializeOnce

public void initializeOnce()
                    throws java.io.IOException,
                           java.text.ParseException
Read in any KBs defined in the configuration.

Throws:
java.io.IOException - DOCUMENT ME!
java.text.ParseException - DOCUMENT ME!

escapeFilename

public static java.lang.String escapeFilename(java.lang.String fname)
Double the backslash in a filename so that it can be saved to a text file and read back properly.

Parameters:
fname - DOCUMENT ME!
Returns:
DOCUMENT ME!

addKB

public void addKB(java.lang.String name)
Create a new empty KB with a name.

Parameters:
name - - the name of the KB

removeKB

public void removeKB(java.lang.String name)
Remove a knowledge base.

Parameters:
name - - the name of the KB

writeConfiguration

public void writeConfiguration()
                        throws java.io.IOException
Write the current configuration of the system. Call writeConfiguration() on each KB object to write its manifest.

Throws:
java.io.IOException - DOCUMENT ME!

getKB

public KB getKB(java.lang.String name)
Get the KB that has the given name.

Parameters:
name - DOCUMENT ME!
Returns:
DOCUMENT ME!

existsKB

public boolean existsKB(java.lang.String name)
Returns true if a KB with the given name exists.

Parameters:
name - DOCUMENT ME!
Returns:
DOCUMENT ME!

remove

public void remove(java.lang.String name)
Remove the KB that has the given name.

Parameters:
name - DOCUMENT ME!

getMgr

public static KBmanager getMgr()
Get the one instance of KBmanager from its class variable.

Returns:
DOCUMENT ME!

getKBnames

public java.util.Set getKBnames()
Get the Set of KB names in this manager.

Returns:
DOCUMENT ME!

getPref

public java.lang.String getPref(java.lang.String key)
Get the preference corresponding to the given kef.

Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

setPref

public void setPref(java.lang.String key,
                    java.lang.String value)
Set the preference to the given value.

Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!

main

public static void main(java.lang.String[] args)
A test method.

Parameters:
args - DOCUMENT ME!