|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.linguistics.kif.KB
public class KB
**************************************************************** Contains methods for reading, writing knowledge bases and their configurations. Also contains the inference engine process for the knowledge base.
| Field Summary | |
|---|---|
CELT |
celt
The instance of the CELT process. |
java.util.HashMap |
children
A HashMap of ArrayLists, which contain all the child classes of a given class. |
java.util.ArrayList |
constituents
An ArrayList of Strings which are the full path file names of the files which comprise the KB. |
java.util.HashMap |
disjoint
A HashMap of ArrayLists, which contain all the disjoint classes of a given class. |
Vampire |
inferenceEngine
The inference engine process for this KB. |
java.lang.String |
kbDir
The location of preprocessed KIF files, suitable for loading into Vampire. |
java.lang.String |
language
The natural language in which axiom paraphrases should be presented. |
java.lang.String |
name
The name of the knowledge base. |
java.util.HashMap |
parents
A HashMap of ArrayLists, which contain all the parent classes of a given class. |
java.util.TreeSet |
terms
A Set of Strings, which are all the terms in the KB. |
| Constructor Summary | |
|---|---|
KB(java.lang.String n,
java.lang.String dir)
************************************************************ Constructor which takes the name of the KB and the location where KBs preprocessed for Vampire should be placed. |
|
| Method Summary | |
|---|---|
void |
addConstituent(java.lang.String filename)
************************************************************ Add a new KB constituent by reading in the file, and then merging the formulas with the existing set of formulas. |
java.util.ArrayList |
ask(java.lang.String kind,
int argnum,
java.lang.String term)
************************************************************ Get an ArrayList which are the Formulas the match the request. |
java.util.ArrayList |
askWithRestriction(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2)
************************************************************ Get an ArrayList of Formulas in which the two terms provided appear in the indicated argument positions. |
java.util.ArrayList |
availableLanguages()
************************************************************ Get an ArrayList of Strings containing the language identifiers of available natural language formatting templates. |
void |
cache()
************************************************************ Cache subclass and instance statements in the knowledge base. |
boolean |
containsTerm(java.lang.String term)
************************************************************** Take a term and return whether the term exists in the knowledge base. |
void |
deleteUserAssertions()
************************************************************** Delete the user assertions file. |
java.lang.String |
formatDocumentation(java.lang.String href,
java.lang.String documentation)
************************************************************ Hyperlink terms identified with '&%' to the URL that brings up that term in the browser. |
int |
getCountAxioms()
************************************************************** Count the number of formulas in the knowledge base in order to present statistics to the user. |
int |
getCountRules()
************************************************************** Count the number of rules in the knowledge base in order to present statistics to the user. |
int |
getCountTerms()
************************************************************** Count the number of terms in the knowledge base in order to present statistics to the user. |
java.util.HashMap |
getFormatMap(java.lang.String lang)
************************************************************** This method creates an association list (Map) of the natural language format string and the relation name for which that format string applies. |
java.util.TreeSet |
getFormulas()
************************************************************** an accessor providing a TreeSet of un-preProcess-ed Formula. |
java.util.ArrayList |
getNearestNonRelations(java.lang.String term)
************************************************************** Get the neighbors of this initial lowercase term (relation). |
java.util.ArrayList |
getNearestRelations(java.lang.String term)
************************************************************** Get the neighbors of this initial uppercase term (class or function). |
java.util.HashMap |
getTermFormatMap(java.lang.String lang)
************************************************************** This method creates an association list (Map) of the natural language string and the term for which that format string applies. |
static void |
main(java.lang.String[] args)
************************************************************ A test method. |
java.util.TreeSet |
preProcess(java.util.TreeSet forms)
************************************************************** Preprocess a the knowledge base to work with Vampire. |
void |
reload()
************************************************************** Reload all the KB constituents. |
java.lang.String |
tell(java.lang.String formula)
************************************************************ Add a formula to the knowledge base. |
void |
writeConfiguration(java.io.PrintWriter pw)
************************************************************ Write the XML configuration file. |
void |
writeFile(java.lang.String fname)
************************************************************** Write a KIF file. |
java.lang.String |
writeInferenceEngineFormulas(java.util.TreeSet forms)
************************************************************ Save the contents of the current KB to a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Vampire inferenceEngine
public java.lang.String name
public java.util.ArrayList constituents
public java.lang.String language
public java.lang.String kbDir
public java.util.HashMap parents
public java.util.HashMap children
public java.util.HashMap disjoint
public CELT celt
public java.util.TreeSet terms
| Constructor Detail |
|---|
public KB(java.lang.String n,
java.lang.String dir)
| Method Detail |
|---|
public java.util.ArrayList availableLanguages()
public void cache()
public java.util.ArrayList askWithRestriction(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2)
public java.util.ArrayList ask(java.lang.String kind,
int argnum,
java.lang.String term)
kind - - May be one of "ant", "cons", "stmt", or "arg", @see KIF.createKey()term - - The term that appears in the statements being requested.argnum - - The argument position of the term being asked for. The
first argument after the predicate is "1". This parameter is ignored if
the kind is "ant", "cons" or "stmt".
public java.lang.String tell(java.lang.String formula)
public boolean containsTerm(java.lang.String term)
public int getCountTerms()
public int getCountAxioms()
public java.util.TreeSet getFormulas()
public int getCountRules()
public java.util.ArrayList getNearestRelations(java.lang.String term)
public java.util.ArrayList getNearestNonRelations(java.lang.String term)
public java.util.HashMap getFormatMap(java.lang.String lang)
public void deleteUserAssertions()
public java.util.HashMap getTermFormatMap(java.lang.String lang)
public void addConstituent(java.lang.String filename)
throws java.io.IOException,
java.text.ParseException
filename - - the full path of the file being added.
java.io.IOException
java.text.ParseExceptionpublic void reload()
public void writeFile(java.lang.String fname)
throws java.io.IOException
fname - - the name of the file to write, including full path.
java.io.IOExceptionpublic void writeConfiguration(java.io.PrintWriter pw)
public java.lang.String formatDocumentation(java.lang.String href,
java.lang.String documentation)
public java.lang.String writeInferenceEngineFormulas(java.util.TreeSet forms)
throws java.io.IOException
java.io.IOExceptionpublic java.util.TreeSet preProcess(java.util.TreeSet forms)
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||