public class KBmanager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CONFIG_FILE |
boolean |
initializing |
protected java.util.HashMap<java.lang.String,KB> |
kbs |
static int |
USE_CACHE
A numeric (bitwise) constant used to signal whether the closure
of instance and subclass relastions should be "cached out" for
use by the inference engine.
|
static int |
USE_HOLDS_PREFIX
A numeric (bitwise) constant used to signal whether holds
prefixes should be added during formula preprocessing.
|
static int |
USE_TPTP
A numeric (bitwise) constant used to signal whether formulas
should be translated to TPTP format during the processing of KB
constituent files.
|
static int |
USE_TYPE_PREFIX
A numeric (bitwise) constant used to signal whether type
prefixes (sortals) should be added during formula
preprocessing.
|
Constructor and Description |
---|
KBmanager() |
Modifier and Type | Method and Description |
---|---|
void |
addKB(java.lang.String name)
Create a new empty KB with a name.
|
void |
addKB(java.lang.String name,
boolean isVisible) |
java.util.ArrayList<java.lang.String> |
allAvailableLanguages()
Get the the complete list of languages available in all KBs
|
static java.lang.String |
ccheckResults(java.lang.String kbName) |
static CCheckManager.CCheckStatus |
ccheckStatus(java.lang.String kbName) |
static void |
copyFile(java.io.File in,
java.io.File out)
Read an XML-formatted configuration file.
|
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.
|
java.lang.String |
getError()
Get the error string for file loading.
|
int |
getInferenceBitValue()
Returns an int value, the bitwise interpretation of which
indicates the current configuration of inference parameter
(preference) settings.
|
KB |
getKB(java.lang.String name)
Get the KB that has the given name.
|
java.util.HashSet<java.lang.String> |
getKBnames()
Get the Set of KB names in this manager.
|
static KBmanager |
getMgr()
Get the one instance of KBmanager from its class variable.
|
int |
getOldInferenceBitValue()
Returns the last cached inference bit value setting.
|
java.lang.String |
getPref(java.lang.String key)
Get the preference corresponding to the given kef.
|
boolean |
initializeOnce()
Reads in the KBs and other parameters defined in the XML
configuration file, or uses the default parameters.
|
boolean |
initializeOnce(java.lang.String configFileDir)
Reads in the KBs and other parameters defined in the XML
configuration file, or uses the default parameters.
|
static CCheckManager.CCheckStatus |
initiateCCheck(KB kb,
java.lang.String chosenEngine,
java.lang.String systemChosen,
java.lang.String location,
java.lang.String language,
int timeout) |
boolean |
loadKB(java.lang.String kbName,
java.util.List<java.lang.String> constituents) |
static void |
main(java.lang.String[] args)
A test method.
|
static KBmanager |
newMgr(java.lang.String username)
Reset the one instance of KBmanager from its class variable.
|
protected SimpleElement |
readConfiguration(java.lang.String configDirPath)
Reads an XML configuration file from the directory
configDirPath, and tries to find a configuration file elsewhere
if configDirPath is null.
|
void |
remove(java.lang.String name)
Remove the KB that has the given name.
|
java.lang.String |
removeKB(java.lang.String name)
Remove a knowledge base.
|
void |
setError(java.lang.String er)
Set an error string for file loading.
|
void |
setOldInferenceBitValue(int bv)
Sets the value of the private variable oldInferenceBitValue.
|
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.
|
public static final int USE_TYPE_PREFIX
public static final int USE_HOLDS_PREFIX
public static final int USE_CACHE
public static final int USE_TPTP
protected static final java.lang.String CONFIG_FILE
protected java.util.HashMap<java.lang.String,KB> kbs
public boolean initializing
public void setError(java.lang.String er)
public java.lang.String getError()
public static CCheckManager.CCheckStatus initiateCCheck(KB kb, java.lang.String chosenEngine, java.lang.String systemChosen, java.lang.String location, java.lang.String language, int timeout)
public static java.lang.String ccheckResults(java.lang.String kbName)
public static CCheckManager.CCheckStatus ccheckStatus(java.lang.String kbName)
public boolean loadKB(java.lang.String kbName, java.util.List<java.lang.String> constituents)
public static void copyFile(java.io.File in, java.io.File out)
protected SimpleElement readConfiguration(java.lang.String configDirPath)
public boolean initializeOnce()
public boolean initializeOnce(java.lang.String configFileDir)
public static java.lang.String escapeFilename(java.lang.String fname)
public void addKB(java.lang.String name)
name
- - the name of the KBpublic void addKB(java.lang.String name, boolean isVisible)
public java.lang.String removeKB(java.lang.String name)
name
- - the name of the KBpublic void writeConfiguration() throws java.io.IOException
java.io.IOException
public KB getKB(java.lang.String name)
public boolean existsKB(java.lang.String name)
public void remove(java.lang.String name)
public static KBmanager getMgr()
public static KBmanager newMgr(java.lang.String username)
public java.util.HashSet<java.lang.String> getKBnames()
public java.util.ArrayList<java.lang.String> allAvailableLanguages()
public java.lang.String getPref(java.lang.String key)
public void setPref(java.lang.String key, java.lang.String value)
public int getInferenceBitValue()
public int getOldInferenceBitValue()
public void setOldInferenceBitValue(int bv)
public static void main(java.lang.String[] args)