public class KB
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
_cacheFileSuffix
The String constant that is the suffix for files of cached assertions.
|
static java.lang.String |
_userAssertionsString
The String constant that is the suffix for files of user assertions.
|
CELT |
celt
The instance of the CELT process.
|
java.util.ArrayList<java.lang.String> |
constituents
An ArrayList of Strings that are the full
canonical pathnames of the files that comprise the KB.
|
EProver |
eprover
The inference engine process for this KB.
|
java.util.TreeSet<java.lang.String> |
errors
Errors and warnings found during loading of the KB constituents.
|
java.util.HashMap<java.lang.String,Formula> |
formulaMap
A Map of all the Formula objects in the KB.
|
java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> |
formulas
A HashMap of ArrayLists of String formulae, containing all the
formulae in the KB.
|
KBcache |
kbCache |
java.lang.String |
kbDir
The location of preprocessed KIF files, suitable for loading into EProver.
|
java.lang.String |
language
The natural language in which axiom paraphrases should be presented.
|
protected java.util.ArrayList<java.lang.String> |
loadFormatMapsAttempted
This List is used to limit the number of warning messages
logged by loadFormatMaps(lang).
|
boolean |
modifiedContents
Future: If true, the contents of the KB have been modified without updating the caches
|
java.lang.String |
name
The name of the knowledge base.
|
java.util.SortedSet<java.lang.String> |
terms
A synchronized SortedSet of Strings, which are all the terms in the KB.
|
Constructor and Description |
---|
KB(KB kbIn)
Perform a deep copy of the kb input
|
KB(java.lang.String n)
Constructor
|
KB(java.lang.String n,
java.lang.String dir)
Constructor which takes the name of the KB and the location
where KBs preprocessed for EProver should be placed.
|
KB(java.lang.String n,
java.lang.String dir,
boolean visibility) |
Modifier and Type | Method and Description |
---|---|
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<java.lang.String> |
ask(java.lang.String suoKifFormula,
int timeout,
int maxAnswers)
Submits a query to the inference engine.
|
java.util.ArrayList<Formula> |
ask(java.lang.String kind,
int argnum,
java.lang.String term)
Returns an ArrayList containing the Formulas that match the
request.
|
java.lang.String |
askEngine(java.lang.String suoKifFormula,
int timeout,
int maxAnswers,
InferenceEngine engine)
Submits a query to specified InferenceEngine object.
|
java.lang.String |
askLEO(java.lang.String suoKifFormula,
int timeout,
int maxAnswers,
java.lang.String flag)
Submits a query to the LEO inference engine.
|
java.util.ArrayList<java.lang.String> |
askNoProof(java.lang.String suoKifFormula,
int timeout,
int maxAnswers)
Submits a query to the inference engine.
|
java.lang.String |
askSInE(java.lang.String suoKifFormula,
int timeout,
int maxAnswers)
Submits a query to the SInE inference engine.
|
java.util.ArrayList<Formula> |
askWithLiteral(Formula queryLit)
This method retrieves formulas by asking the query expression
queryLit, and returns the results, if any, in an ArrayList.
|
java.util.ArrayList<Formula> |
askWithLiteral(java.util.List<java.lang.String> queryLit)
This method retrieves Formulas by asking the query expression
queryLit, and returns the results, if any, in an ArrayList.
|
java.util.ArrayList<Formula> |
askWithPredicateSubsumption(java.lang.String relation,
int idxArgnum,
java.lang.String idxTerm)
Returns an ArrayList containing the Formulae retrieved,
possibly via multiple asks that recursively use relation and
all of its subrelations.
|
java.util.ArrayList<Formula> |
askWithRestriction(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2) |
java.util.ArrayList<Formula> |
askWithTwoRestrictions(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2,
int argnum3,
java.lang.String term3)
Returns an ArrayList of Formulas in which the two terms
provided appear in the indicated argument positions.
|
java.util.ArrayList<java.lang.String> |
availableLanguages()
Get an ArrayList of Strings containing the language identifiers
of available natural language formatting templates.
|
void |
checkArity()
Arity errors should already have been trapped in addConstituent()
unless a relation is used before it is defined.
|
boolean |
childOf(java.lang.String child,
java.lang.String parent)
Determine whether a particular class or instance "child" is a
child of the given "parent".
|
protected void |
clearFormatMaps()
Clears all loaded format and termFormat maps, for all
languages.
|
java.util.ArrayList<java.lang.String> |
collectPredicates() |
boolean |
containsFormula(java.lang.String formula)
Takes a formula string and returns true if the corresponding
Formula occurs in the KB.
|
boolean |
containsRE(java.lang.String term)
Takes a term (interpreted as a Regular Expression) and returns true
if any term in the KB has a match with the RE.
|
boolean |
containsTerm(java.lang.String term)
Takes a term and returns true if the term occurs in the KB.
|
InferenceEngine |
createInferenceEngine(InferenceEngine.EngineFactory factory)
Creates InferenceEngine and loads all of the constituents into it.
|
void |
deleteUserAssertions()
Deletes user assertions, both in the files and in the constituents list.
|
void |
deleteUserAssertionsAndReload()
Deletes the user assertions key in the constituents map, and then reloads the KBs.
|
java.lang.String |
formatDocumentation(java.lang.String href,
java.lang.String documentation,
java.lang.String language)
Hyperlink terms identified with '&%' to the URL that brings up
that term in the browser.
|
static java.util.ArrayList<java.util.ArrayList<java.lang.String>> |
formulasToArrayLists(java.util.List<Formula> formulaList)
Converts all Formula objects in the input List to ArrayList
tuples.
|
java.util.TreeSet<java.lang.String> |
getAllInstances(java.lang.String className)
This method retrieves all instances of the class named in the
input String.
|
protected java.util.TreeSet<java.lang.String> |
getAllInstances(java.util.TreeSet<java.lang.String> classNames)
This method retrieves all instances of the classes named in the
input set.
|
java.util.Set<java.lang.String> |
getAllSuperClasses(java.util.Set<java.lang.String> classNames)
This method retrieves the upward transitive closure of all Class
names contained in the input set.
|
java.lang.String |
getAlphaAfter(java.lang.String term,
int num)
Get the alphabetically num higher neighbor of this initial term, which
must exist in the current KB otherwise an empty string is returned.
|
java.lang.String |
getAlphaBefore(java.lang.String term,
int num)
Get the alphabetically num lower neighbor of this initial term, which
must exist in the current KB otherwise an empty string is returned.
|
java.lang.String |
getArgType(java.lang.String reln,
int argPos)
Returns the type (SUO-KIF SetOrClass name) for any argument in
argPos position of an assertion formed with the SUO-KIF
Relation reln.
|
java.lang.String |
getArgTypeClass(java.lang.String reln,
int argPos)
Returns the type (SUO-KIF SetOrClass name) for any argument in
argPos position of an assertion formed with the SUO-KIF
Relation reln.
|
static java.util.regex.Pattern |
getCompiledPattern(java.lang.String key)
This method returns a compiled regular expression Pattern
object indexed by key.
|
int |
getCountAxioms()
Count the number of formulas in the knowledge base in order to
present statistics to the user.
|
int |
getCountRelations()
Count the number of relations 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.lang.String |
getFirstTermViaAskWithRestriction(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2,
int targetArgnum)
Returns the first term found that corresponds to targetArgnum
in the Formulas obtained from the method call
askWithRestriction(argnum1, term1, argnum2, term2).
|
java.lang.String |
getFirstTermViaAWTR(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2,
int argnum3,
java.lang.String term3,
int targetArgnum)
Returns the first SUO-KIF terms that matches the request, or
null.
|
java.lang.String |
getFirstTermViaPredicateSubsumption(java.lang.String relation,
int idxArgnum,
java.lang.String idxTerm,
int targetArgnum,
boolean useInverses)
Returns the first SUO-KIF constant found via asks using
relation and its subrelations.
|
java.util.HashMap<java.lang.String,java.lang.String> |
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.
|
Formula |
getFormulaByKey(java.lang.String key)
An accessor providing a Formula
|
java.util.TreeSet<java.lang.String> |
getFormulas()
An accessor providing a TreeSet of un-preProcessed String
representations of Formulae.
|
java.util.ArrayList<java.lang.String> |
getLoadFormatMapsAttempted() |
static java.util.ArrayList<java.lang.String> |
getMatches(java.lang.String input,
java.lang.String patternKey)
This method finds regular expression matches in an input string
using a compiled Pattern and binding group index retrieved with
patternKey, and returns the results, if any, in an ArrayList.
|
static java.util.ArrayList<java.lang.String> |
getMatches(java.lang.String input,
java.lang.String patternKey,
java.util.ArrayList<java.lang.String> accumulator)
This method finds regular expression matches in an input string
using a compiled Pattern and binding group index retrieved with
patternKey.
|
java.util.ArrayList<java.lang.String> |
getNearestNonRelations(java.lang.String term)
Get the neighbors of this initial lowercase term (relation).
|
java.util.ArrayList<java.lang.String> |
getNearestRelations(java.lang.String term)
Get the neighbors of this initial uppercase term (class or function).
|
static int |
getPatternGroupIndex(java.lang.String key)
This method returns the int value that identifies the regular
expression binding group to be returned when there is a match.
|
java.util.ArrayList<java.lang.String> |
getREMatch(java.lang.String term)
Takes a term (interpreted as a Regular Expression) and returns an ArrayList
containing every term in the KB that has a match with the RE.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getTermFormatMap(java.lang.String lang)
This method creates a dictionary (Map) of SUO-KIF term symbols
-- the keys -- and a natural language string for each key that
is the preferred name for the term -- the values -- in the
context denoted by lang.
|
java.util.SortedSet<java.lang.String> |
getTerms()
Returns a SortedSet of Strings, which are all
the terms in the KB.
|
java.util.ArrayList<java.lang.String> |
getTermsViaAsk(int knownArgnum,
java.lang.String knownArg,
int targetArgnum)
Returns an ArrayList containing the terms (Strings) that
correspond to targetArgnum in the ground atomic Formulae in
which knownArg is in the argument position knownArgnum.
|
java.util.ArrayList<java.lang.String> |
getTermsViaAskWithRestriction(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2,
int targetArgnum)
Returns an ArrayList containing the terms (Strings) that
correspond to targetArgnum in the Formulas obtained from the
method call askWithRestriction(argnum1, term1, argnum2, term2).
|
java.util.ArrayList<java.lang.String> |
getTermsViaAskWithRestriction(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2,
int targetArgnum,
java.util.Set<java.lang.String> predicatesUsed)
Returns an ArrayList containing the terms (Strings) that
correspond to targetArgnum in the Formulas obtained from the
method call askWithRestriction(argnum1, term1, argnum2, term2).
|
java.util.ArrayList<java.lang.String> |
getTermsViaAWTR(int argnum1,
java.lang.String term1,
int argnum2,
java.lang.String term2,
int argnum3,
java.lang.String term3,
int targetArgnum)
Returns an ArrayList containing the SUO-KIF terms that match
the request.
|
java.util.ArrayList<java.lang.String> |
getTermsViaPredicateSubsumption(java.lang.String relation,
int idxArgnum,
java.lang.String idxTerm,
int targetArgnum,
boolean useInverses)
Returns an ArrayList containing SUO-KIF constants, possibly
retrieved via multiple asks that recursively use relation and
all of its subrelations.
|
java.util.ArrayList<java.lang.String> |
getTermsViaPredicateSubsumption(java.lang.String relation,
int idxArgnum,
java.lang.String idxTerm,
int targetArgnum,
boolean useInverses,
java.util.Set predicatesUsed)
Returns an ArrayList containing SUO-KIF constants, possibly
retrieved via multiple asks that recursively use relation and
all of its subrelations.
|
java.util.ArrayList<java.lang.String> |
getTransitiveClosureViaPredicateSubsumption(java.lang.String relation,
int idxArgnum,
java.lang.String idxTerm,
int targetArgnum,
boolean useInverses)
Returns an ArrayList containing the transitive closure of
relation starting from idxTerm in position idxArgnum.
|
int |
getValence(java.lang.String relnName)
This method tries to find or compute a valence for the input
relation.
|
java.util.ArrayList<Formula> |
instancesOf(java.lang.String term)
Determine whether a particular term is an immediate instance,
which has a statement of the form (instance term otherTerm).
|
boolean |
isChildOf(java.lang.String i,
java.lang.String c)
Returns true if i is c, is an instance of c, or is subclass of c,
or is subAttribute of c,
else returns false.
|
static boolean |
isCommutative(java.lang.String obj)
A static utility method.
|
static boolean |
isEmptyList(java.lang.Object obj) |
boolean |
isInstance(java.lang.String term) |
boolean |
isInstanceOf(java.lang.String i,
java.lang.String c)
Returns true if i is an instance of c, else returns false.
|
static boolean |
isQuantifier(java.lang.String obj)
A static utility method.
|
static boolean |
isRelationInAnyKB(java.lang.String i)
Returns true if i is an instance of c in any loaded KB, else
returns false.
|
boolean |
isSubAttribute(java.lang.String c1,
java.lang.String c2)
Returns true if the KB cache supports the conclusion that
c1 is a subAttribute of c2, else returns false.
|
boolean |
isSubclass(java.lang.String c1,
java.lang.String c2)
Returns true if the subclass cache supports the conclusion that
c1 is a subclass of c2, else returns false.
|
static boolean |
isVariable(java.lang.String obj)
A static utility method.
|
boolean |
isVisible() |
static Formula |
literalListToFormula(java.util.List<java.lang.String> lit)
Converts a literal (List object) to a Formula.
|
static java.lang.String |
literalListToString(java.util.List<java.lang.String> literal)
Converts a literal (List object) to a String.
|
void |
loadEProver()
Starts EProver and collects, preprocesses and loads all of the
constituents into it.
|
void |
loadFormatMaps(java.lang.String lang)
Populates the format maps for language lang.
|
static void |
main(java.lang.String[] args) |
java.util.TreeSet<java.lang.String> |
preProcess(java.util.HashSet<java.lang.String> forms)
Preprocess the knowledge base to TPTP.
|
java.lang.String |
reload()
Reload all the KB constituents.
|
java.util.Set<java.lang.String> |
removeSuperClasses(java.util.Set<java.lang.String> set)
Remove from the given set any item which is a superclass of another item in the set.
|
void |
rename(java.lang.String term2,
java.lang.String term1)
Rename term2 as term1 throughout the knowledge base.
|
java.lang.String |
REswitch(java.lang.String term)
REswitch determines if a String is a RegEx or not based on its use of RE metacharacters.
|
void |
setTerms(java.util.SortedSet<java.lang.String> newTerms)
Sets the synchronized SortedSet of all the terms in the
KB to be kbTerms.
|
java.lang.String |
simplifyTerm(java.lang.String term)
Only called in BrowseBody.jsp when a single match is found.
|
static java.util.ArrayList<Formula> |
stringsToFormulas(java.util.List<java.lang.String> strings)
Converts all Strings in the input List to Formula objects.
|
java.lang.String |
tell(java.lang.String input)
Adds a formula to the knowledge base.
|
SimpleElement |
writeConfiguration()
Create the XML configuration element.
|
void |
writeFile(java.lang.String fname)
Write a KIF file consisting of all the formulas in the
knowledge base.
|
java.lang.String |
writeInferenceEngineFormulas(java.util.TreeSet<java.lang.String> forms)
Save the contents of the current KB to a file.
|
void |
writeTerms()
Writes all the terms in the knowledge base to a file
|
public EProver eprover
public java.lang.String name
public java.util.ArrayList<java.lang.String> constituents
public java.lang.String language
public java.lang.String kbDir
public CELT celt
public java.util.SortedSet<java.lang.String> terms
public static final java.lang.String _userAssertionsString
public static final java.lang.String _cacheFileSuffix
public java.util.HashMap<java.lang.String,Formula> formulaMap
public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> formulas
public java.util.TreeSet<java.lang.String> errors
public boolean modifiedContents
public KBcache kbCache
protected java.util.ArrayList<java.lang.String> loadFormatMapsAttempted
public KB(java.lang.String n, java.lang.String dir)
public KB(java.lang.String n, java.lang.String dir, boolean visibility)
public KB(KB kbIn) throws java.io.IOException
kbIn
- java.io.IOException
public KB(java.lang.String n)
public boolean isVisible()
public java.util.SortedSet<java.lang.String> getTerms()
public java.lang.String REswitch(java.lang.String term)
term
- A Stringpublic java.lang.String simplifyTerm(java.lang.String term)
term
- a Stringpublic boolean containsRE(java.lang.String term)
term
- A Stringpublic java.util.ArrayList<java.lang.String> getREMatch(java.lang.String term)
term
- A Stringpublic void setTerms(java.util.SortedSet<java.lang.String> newTerms)
public java.util.ArrayList<java.lang.String> availableLanguages()
public java.util.Set<java.lang.String> removeSuperClasses(java.util.Set<java.lang.String> set)
set
- public void checkArity()
public java.lang.String getArgType(java.lang.String reln, int argPos)
reln
- A String denoting a SUO-KIF RelationargPos
- An int denoting an argument position, where 0 is
the position of reln itselfpublic java.lang.String getArgTypeClass(java.lang.String reln, int argPos)
reln
- A String denoting a SUO-KIF RelationargPos
- An int denoting an argument position, where 0 is
the position of reln itselfpublic java.util.ArrayList<Formula> instancesOf(java.lang.String term)
public boolean isInstanceOf(java.lang.String i, java.lang.String c)
i
- A String denoting an instance.c
- A String denoting a Class.public boolean isChildOf(java.lang.String i, java.lang.String c)
i
- A String denoting an instance.c
- A String denoting a Class.public static boolean isRelationInAnyKB(java.lang.String i)
i
- A String denoting an instance.public boolean isInstance(java.lang.String term)
public boolean childOf(java.lang.String child, java.lang.String parent)
child
- A String, the name of a term.parent
- A String, the name of a term.public boolean isSubclass(java.lang.String c1, java.lang.String c2)
c1
- A String, the name of a SetOrClass.c2
- A String, the name of a SetOrClass.public boolean isSubAttribute(java.lang.String c1, java.lang.String c2)
c1
- A String, the name of a SetOrClass.c2
- A String, the name of a SetOrClass.public static java.util.ArrayList<java.util.ArrayList<java.lang.String>> formulasToArrayLists(java.util.List<Formula> formulaList)
formulaList
- A list of Formulas.public static java.util.ArrayList<Formula> stringsToFormulas(java.util.List<java.lang.String> strings)
strings
- A list of Strings.public static java.lang.String literalListToString(java.util.List<java.lang.String> literal)
literal
- A List representing a SUO-KIF formula.public static Formula literalListToFormula(java.util.List<java.lang.String> lit)
literal
- A List representing a SUO-KIF formula.public java.util.ArrayList<java.lang.String> getTermsViaAskWithRestriction(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2, int targetArgnum, java.util.Set<java.lang.String> predicatesUsed)
predicatesUsed
- A Set to which will be added the
predicates of the ground assertions
actually used to gather the terms
returnedpublic java.util.ArrayList<java.lang.String> getTermsViaAskWithRestriction(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2, int targetArgnum)
public java.lang.String getFirstTermViaAskWithRestriction(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2, int targetArgnum)
public java.util.ArrayList<Formula> askWithRestriction(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2)
public java.util.ArrayList<Formula> askWithTwoRestrictions(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2, int argnum3, java.lang.String term3)
public java.util.ArrayList<java.lang.String> getTermsViaAWTR(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2, int argnum3, java.lang.String term3, int targetArgnum)
public java.lang.String getFirstTermViaAWTR(int argnum1, java.lang.String term1, int argnum2, java.lang.String term2, int argnum3, java.lang.String term3, int targetArgnum)
public java.util.ArrayList<java.lang.String> getTermsViaAsk(int knownArgnum, java.lang.String knownArg, int targetArgnum)
knownArgnum
- The argument position of knownArgknownArg
- The term that appears in the argument
knownArgnum of the ground atomic Formulae in
the KBtargetArgnum
- The argument position of the terms being soughtpublic java.util.ArrayList<Formula> ask(java.lang.String kind, int argnum, java.lang.String term)
kind
- May be one of "ant", "cons", "stmt", or "arg"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".KIF.createKey()
public java.util.ArrayList<Formula> askWithPredicateSubsumption(java.lang.String relation, int idxArgnum, java.lang.String idxTerm)
relation
- The name of a predicate, which is assumed to be
the 0th argument of one or more atomic
formulaeidxArgnum
- The argument position occupied by idxTerm in
each ground Formula to be retrievedidxTerm
- A constant that occupied idxArgnum position in
each ground Formula to be retrievedpublic java.util.ArrayList<java.lang.String> getTermsViaPredicateSubsumption(java.lang.String relation, int idxArgnum, java.lang.String idxTerm, int targetArgnum, boolean useInverses, java.util.Set predicatesUsed)
relation
- The name of a predicate, which is assumed to be
the 0th argument of one or more atomic
FormulaeidxArgnum
- The argument position occupied by term in the
ground atomic Formulae that will be retrieved
to gather the target (answer) termsidxTerm
- A constant that occupies idxArgnum position in
each of the ground atomic Formulae that will be
retrieved to gather the target (answer) termstargetArgnum
- The argument position of the answer terms
in the Formulae to be retrieveduseInverses
- If true, the inverses of relation and its
subrelations will be also be used to try to
find answer termspredicatesUsed
- A Set to which will be added the
predicates of the ground assertions
actually used to gather the terms
returnedpublic java.util.ArrayList<java.lang.String> getTermsViaPredicateSubsumption(java.lang.String relation, int idxArgnum, java.lang.String idxTerm, int targetArgnum, boolean useInverses)
relation
- The name of a predicate, which is assumed to be
the 0th argument of one or more atomic
FormulaeidxArgnum
- The argument position occupied by term in the
ground atomic Formulae that will be retrieved
to gather the target (answer) termsidxTerm
- A constant that occupies idxArgnum position in
each of the ground atomic Formulae that will be
retrieved to gather the target (answer) termstargetArgnum
- The argument position of the answer terms
in the Formulae to be retrieveduseInverses
- If true, the inverses of relation and its
subrelations will be also be used to try to
find answer termspublic java.lang.String getFirstTermViaPredicateSubsumption(java.lang.String relation, int idxArgnum, java.lang.String idxTerm, int targetArgnum, boolean useInverses)
relation
- The name of a predicate, which is assumed to be
the 0th argument of one or more atomic
Formulae.idxArgnum
- The argument position occupied by term in the
ground atomic Formulae that will be retrieved
to gather the target (answer) terms.idxTerm
- A constant that occupies idxArgnum position in
each of the ground atomic Formulae that will be
retrieved to gather the target (answer) terms.targetArgnum
- The argument position of the answer terms
in the Formulae to be retrieved.useInverses
- If true, the inverses of relation and its
subrelations will be also be used to try to
find answer terms.public java.util.ArrayList<java.lang.String> getTransitiveClosureViaPredicateSubsumption(java.lang.String relation, int idxArgnum, java.lang.String idxTerm, int targetArgnum, boolean useInverses)
relation
- The name of a predicate, which is assumed to be
the 0th argument of one or more atomic
FormulaeidxArgnum
- The argument position occupied by term in the
ground atomic Formulae that will be retrieved
to gather the target (answer) termsidxTerm
- A constant that occupies idxArgnum position in
the first "level" of ground atomic Formulae that
will be retrieved to gather the target (answer)
termstargetArgnum
- The argument position of the answer terms
in the Formulae to be retrieveduseInverses
- If true, the inverses of relation and its
subrelations will be also be used to try to
find answer termspublic void rename(java.lang.String term2, java.lang.String term1)
public void writeTerms() throws java.io.IOException
java.io.IOException
public java.lang.String tell(java.lang.String input)
input
- The String representation of a SUO-KIF Formula.public java.util.ArrayList<java.lang.String> ask(java.lang.String suoKifFormula, int timeout, int maxAnswers)
suoKifFormula
- The String representation of the SUO-KIF
query.timeout
- The number of seconds after which the inference
engine should give up.maxAnswers
- The maximum number of answers (binding sets)
the inference engine should return.public java.util.ArrayList<java.lang.String> askNoProof(java.lang.String suoKifFormula, int timeout, int maxAnswers)
suoKifFormula
- The String representation of the SUO-KIF
query.public java.lang.String askEngine(java.lang.String suoKifFormula, int timeout, int maxAnswers, InferenceEngine engine)
suoKifFormula
- The String representation of the SUO-KIF
query.timeout
- The number of seconds after which the underlying inference
engine should give up. (Time taken by axiom selection doesn't count.)maxAnswers
- The maximum number of answers (binding sets)
the inference engine should return.engine
- InferenceEngine object that will be used for the inference.public java.lang.String askSInE(java.lang.String suoKifFormula, int timeout, int maxAnswers)
suoKifFormula
- The String representation of the SUO-KIF
query.timeout
- The number of seconds after which the underlying inference
engine should give up. (Time taken by axiom selection doesn't count.)maxAnswers
- The maximum number of answers (binding sets)
the inference engine should return.public java.lang.String askLEO(java.lang.String suoKifFormula, int timeout, int maxAnswers, java.lang.String flag)
suoKifFormula
- The String representation of the SUO-KIF
query.timeout
- The number of seconds after which the underlying inference
engine should give up. (Time taken by axiom selection doesn't count.)maxAnswers
- The maximum number of answers (binding sets)
the inference engine should return.public boolean containsTerm(java.lang.String term)
term
- A String.public boolean containsFormula(java.lang.String formula)
formula
- A String.public int getCountTerms()
public int getCountRelations()
public int getCountAxioms()
public java.util.TreeSet<java.lang.String> getFormulas()
public Formula getFormulaByKey(java.lang.String key)
public int getCountRules()
public java.util.ArrayList<java.lang.String> getNearestRelations(java.lang.String term)
public java.util.ArrayList<java.lang.String> getNearestNonRelations(java.lang.String term)
public java.lang.String getAlphaBefore(java.lang.String term, int num)
public java.lang.String getAlphaAfter(java.lang.String term, int num)
public void loadFormatMaps(java.lang.String lang)
is a HashMap of language keys and HashMap
values. The interior HashMaps are term keys and format
string values.
,
is the same but for relation format strings.
protected void clearFormatMaps()
public java.util.HashMap<java.lang.String,java.lang.String> getTermFormatMap(java.lang.String lang)
public java.util.HashMap<java.lang.String,java.lang.String> getFormatMap(java.lang.String lang)
public void deleteUserAssertions() throws java.io.IOException
java.io.IOException
public void deleteUserAssertionsAndReload()
public void addConstituent(java.lang.String filename)
filename
- - The full path of the file being addedbuildCachesP
- - If true, forces the assertion caches to be rebuilt - deprecatedperformArity
- - Perform arity check - deprecated since this can't be dont until all relations are definedloadEProverP
- - If true, destroys the old EProver process and
starts a new one - deprecatedpublic java.lang.String 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.IOException
public SimpleElement writeConfiguration()
public static java.util.regex.Pattern getCompiledPattern(java.lang.String key)
key
- A String that is the retrieval key for a compiled
regular expression Pattern.public static int getPatternGroupIndex(java.lang.String key)
key
- A String that is the retrieval key for the binding
group index associated with a compiled regular expression
Pattern.public static java.util.ArrayList<java.lang.String> getMatches(java.lang.String input, java.lang.String patternKey, java.util.ArrayList<java.lang.String> accumulator)
input
- The input String in which matches are sought.patternKey
- A String used as the retrieval key for a
regular expression Pattern object, and an int index identifying
a binding group.accumulator
- An optional ArrayList to which matches are
added. Note that if accumulator is provided, it will be the
return value even if no new matches are found in the input
String.public static java.util.ArrayList<java.lang.String> getMatches(java.lang.String input, java.lang.String patternKey)
input
- The input String in which matches are sought.patternKey
- A String used as the retrieval key for a
regular expression Pattern object, and an int index identifying
a binding group.public java.util.ArrayList<Formula> askWithLiteral(java.util.List<java.lang.String> queryLit)
queryLit
- The query, which is assumed to be a List
(atomic literal) consisting of a single predicate and its
arguments. The arguments could be variables, constants, or a
mix of the two, but only the first constant encountered in a
left to right sweep over the literal will be used in the actual
query.public java.util.ArrayList<Formula> askWithLiteral(Formula queryLit)
queryLit
- The query, which is assumed to be an atomic
literal consisting of a single predicate and its arguments.
The arguments could be variables, constants, or a mix of the
two, but only the first constant encountered in a left to right
sweep over the literal will be used in the actual query.public java.util.Set<java.lang.String> getAllSuperClasses(java.util.Set<java.lang.String> classNames)
classNames
- A Set object containing SUO-KIF class names
(Strings).protected java.util.TreeSet<java.lang.String> getAllInstances(java.util.TreeSet<java.lang.String> classNames)
classNames
- A Set of String, containing SUO-KIF class namespublic java.util.TreeSet<java.lang.String> getAllInstances(java.lang.String className)
className
- The name of a SUO-KIF Class.public int getValence(java.lang.String relnName)
relnName
- A String, the name of a SUO-KIF Relation.public java.util.ArrayList<java.lang.String> collectPredicates()
public static boolean isEmptyList(java.lang.Object obj)
obj
- Any objectpublic static boolean isVariable(java.lang.String obj)
obj
- Presumably, a String.public static boolean isQuantifier(java.lang.String obj)
obj
- A String.public static boolean isCommutative(java.lang.String obj)
obj
- Presumably, a String.public java.lang.String formatDocumentation(java.lang.String href, java.lang.String documentation, java.lang.String language)
public java.lang.String writeInferenceEngineFormulas(java.util.TreeSet<java.lang.String> forms)
public InferenceEngine createInferenceEngine(InferenceEngine.EngineFactory factory)
factory
- Factory object used to create new InferenceEngine.public void loadEProver()
public java.util.TreeSet<java.lang.String> preProcess(java.util.HashSet<java.lang.String> forms)
public java.util.ArrayList<java.lang.String> getLoadFormatMapsAttempted()
public static void main(java.lang.String[] args)