org.opencyc.api
Class CycAccess

java.lang.Object
  |
  +--org.opencyc.api.CycAccess

public class CycAccess
extends java.lang.Object

Provides wrappers for the OpenCyc API.

Collaborates with the CycConnection class which manages the api connections.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Field Summary
static CycConstant and
          Convenient reference to #$and.
protected  org.apache.oro.util.Cache askCache
          Least Recently Used Cache of ask results.
static CycConstant baseKB
          Convenient reference to #$BaseKb.
static CycConstant binaryPredicate
          Convenient reference to #$binaryPredicate.
static CycConstant collection
          Convenient reference to #$Collection.
static CycConstant comment
          Convenient reference to #$comment.
protected  int communicationMode
           
protected  org.apache.oro.util.Cache countAllInstancesCache
          Least Recently Used Cache of countAllInstances results.
protected  CycConnectionInterface cycConnection
          Reference to CycConnection object which manages the api connection to the OpenCyc server.
static boolean DEFAULT_CONNECTION
          Default value indicating that the OpenCyc api should use one TCP socket for the entire session.
 boolean deferObjectCompletion
          Parameter indicating whether the OpenCyc binary api defers the completion of CycConstant attributes until used for the first time.
static CycConstant different
          Convenient reference to #$different.
static CycConstant elementOf
          Convenient reference to #$elementOf.
static CycConstant genlMt
          Convenient reference to #$genlMt.
static CycConstant genls
          Convenient reference to #$genls.
static CycConstant isa
          Convenient reference to #$isa.
protected  org.apache.oro.util.Cache isCollectionCache
          Least Recently Used Cache of isCollection results.
protected  org.apache.oro.util.Cache isGenlOfCache
          Least Recently Used Cache of isGenlOf results.
static CycConstant not
          Convenient reference to #$not.
static CycConstant numericallyEqual
          Convenient reference to #$numericallyEqual.
static CycConstant or
          Convenient reference to #$or.
static boolean PERSISTENT_CONNECTION
          Value indicating that the OpenCyc api should use one TCP socket for the entire session.
 boolean persistentConnection
          Parameter indicating whether the OpenCyc api should use one TCP socket for the entire session, or if the socket is created and then closed for each api call.
static CycConstant plusFn
          Convenient reference to #$PlusFn.
protected  int saveTrace
          Parameter that, when true, causes a trace of the messages to and from the server.
static CycConstant thing
          Convenient reference to #$Thing.
static boolean TRANSIENT_CONNECTION
          Value indicating that the OpenCyc api socket is created and then closed for each api call.
 
Constructor Summary
CycAccess()
          Constructs a new CycAccess object.
CycAccess(java.lang.String hostName, int basePort, int communicationMode, boolean persistentConnection)
          Constructs a new CycAccess object given a host name, port, communication mode and persistence indicator.
CycAccess(java.lang.String myAgentName, java.lang.String cycProxyAgentName, int agentCommunity)
          Constructs a new CycAccess object to the given CycProxyAgent in the given agent community.
 
Method Summary
 boolean areAssertedCoextensional(CycFort collection1, CycFort collection2)
          Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are asserted coextensional.
 boolean areDisjoint(CycFort collection1, CycFort collection2)
          Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are disjoint.
 boolean areHierarchical(CycFort collection1, CycFort collection2)
          Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are in a hierarchy.
 boolean areIntersecting(CycFort collection1, CycFort collection2)
          Returns true if CycFort COLLECION1 and CycFort COLLECTION2 intersect with regard to all-specs.
 boolean areTacitCoextensional(CycFort collection1, CycFort collection2)
          Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are tacitly coextensional via mutual genls of each other.
 CycList askWithVariable(CycList query, CycVariable variable, CycFort mt)
          Returns a list of bindings for a query with a single unbound variable.
 CycList askWithVariables(CycList query, java.util.ArrayList variables, CycFort mt)
          Returns a list of bindings for a query with unbound variables.
 void assertComment(CycConstant cycConstant, java.lang.String comment, CycFort mt)
          Assert a comment for the specified CycConstant in the specified microtheory MT.
 void assertGaf(CycFort mt, CycConstant predicate, CycFort arg1, CycFort arg2)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGaf(CycFort mt, CycConstant predicate, CycFort arg1, CycFort arg2, CycFort arg3)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGaf(CycFort mt, CycConstant predicate, CycFort arg1, CycList arg2)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGaf(CycFort mt, CycConstant predicate, CycFort arg1, int arg2)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGaf(CycFort mt, CycConstant predicate, CycFort arg1, java.lang.String arg2)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGaf(CycList gaf, CycFort mt)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGenls(CycFort specCollection, CycFort genlsCollection, CycFort mt)
          Assert that the CycConstant GENLS is a genls of CycFort SPEC, in the specified defining microtheory MT.
 void assertIsa(CycFort cycFort, CycFort aCollection, CycFort mt)
          Assert that the CycFort GENLS isa CycFort ACOLLECTION, in the specified defining microtheory MT.
 void assertIsaBinaryPredicate(CycConstant cycConstant, CycFort mt)
          Assert that the specified CycConstant is a #$BinaryPredicate in the specified defining microtheory MT.
 void assertIsaCollection(CycConstant cycConstant, CycFort mt)
          Assert that the specified CycConstant is a collection in the specified defining microtheory MT.
 void close()
          Closes the CycConnection object.
protected  void commonInitialization()
          Provides common local and remote CycAccess object initialization.
 CycAssertion completeCycAssertion(CycAssertion cycAssertion)
          Completes the instantiation of a CycAssertion returned by the binary api.
 CycConstant completeCycConstant(CycConstant cycConstant)
          Completes the instantiation of CycConstant returned by the binary api.
 CycList completeCycList(CycList cycList)
          Completes the instantiation of objects contained in the given CycList.
 CycNart completeCycNart(CycNart cycNart)
          Completes the instantiation of a CycNart returned by the binary api.
 CycVariable completeCycVariable(CycVariable cycVariable)
          Completes the instantiation of HL CycVariable returned by the binary api.
 java.lang.Object completeObject(java.lang.Object object)
          Completes the instantiation of objects contained in the given CycList.
protected  java.lang.Object[] converse(java.lang.Object command)
          Converses with Cyc to perform an API command.
 boolean converseBoolean(java.lang.Object command)
          Converses with Cyc to perform an API command whose result is returned as a boolean.
 int converseInt(java.lang.Object command)
          Converses with Cyc to perform an API command whose result is returned as an int.
 CycList converseList(java.lang.Object command)
          Converses with Cyc to perform an API command whose result is returned as a list.
 java.lang.Object converseObject(java.lang.Object command)
          Converses with Cyc to perform an API command whose result is returned as an object.
 java.lang.String converseString(java.lang.Object command)
          Converses with Cyc to perform an API command whose result is returned as a String.
 void converseVoid(java.lang.Object command)
          Converses with Cyc to perform an API command whose result is void.
 int countAllInstances_Cached(CycFort collection, CycFort mt)
          Returns the count of the instances of the given collection, implements a cache to avoid asking the same question twice from the KB.
 int countAllInstances(CycFort collection, CycFort mt)
          Returns the count of the instances of the given collection.
 int countUsingBestIndex(CycList formula, CycFort mt)
          Returns the count of the assertions indexed according to the given pattern, using the best index (from among the predicate and argument indices).
 CycConstant createMicrotheory(java.lang.String mtName, java.lang.String comment, CycFort isaMt, java.util.ArrayList genlMts)
          Create a microtheory MT, with a comment, isa and CycFort genlMts.
 CycConstant[] createMicrotheorySystem(java.lang.String mtRootName, java.lang.String comment, java.util.ArrayList genlMts)
          Create a microtheory system for a new mt.
 CycConstant createNewPermanent(java.lang.String constantName)
          Creates a new permanent Cyc constant in the KB with the specified name.
static CycAccess current()
          Returns the CycAccess object for this thread.
 java.lang.Integer findNartId(CycNart cycNart)
          Finds the id of a CycNart given its formula.
 CycList generateDisambiguationPhraseAndTypes(CycList objects)
          Returns a list of disambiguation expressions, corresponding to each of the terms in the given list of objects.
 CycList getAllDependentSpecs(CycFort cycFort)
          Gets a list of all of the dependent specs for a CycFort collection.
 CycList getAllGenlPreds(CycConstant predicate)
          Gets a list of all of the genlPreds for a CycConstant predicate, using an upward closure.
 CycList getAllGenls(CycFort cycFort)
          Gets a list of all of the direct and indirect genls for a CycFort collection.
 CycList getAllGenlsWrt(CycFort spec, CycFort genl)
          Gets a list of all of the direct and indirect genls for a CycFort SPEC which are also specs of CycFort GENL.
 CycList getAllInstances(CycFort cycFort)
          Gets a list of all the direct and indirect instances (individuals) for a CycFort collection.
 CycList getAllIsa(CycFort cycFort)
          Gets a list of the collections of which the CycFort is directly and indirectly an instance.
 CycList getAllSpecs(CycFort cycFort)
          Gets a list of all of the direct and indirect specs for a CycFort collection.
 CycList getArg1Formats(CycConstant predicate)
          Gets a list of the arg1Formats for a CycConstant predicate.
 CycList getArg1Isas(CycConstant predicate)
          Gets a list of the arg1Isas for a CycConstant predicate.
 CycList getArg2Formats(CycConstant predicate)
          Gets a list of the arg2Formats for a CycConstant predicate.
 CycList getArg2Isas(CycConstant predicate)
          Gets a list of the arg2Isas for a CycConstant predicate.
 CycList getArgNGenls(CycConstant predicate, int argPosition)
          Gets a list of the argNGenls for a CycConstant predicate.
 CycList getArgNIsas(CycConstant predicate, int argPosition)
          Gets a list of the argNIsas for a CycConstant predicate.
 int getArity(CycFort predicate)
          Returns the arity of the given predicate.
 CycAssertion getAssertionById(java.lang.Integer id)
          Gets a CycAssertion by using its id.
 CycList getBackchainImplicationRules(CycConstant predicate, CycList formula, CycFort mt)
          Gets a list of the backchaining implication rules which might apply to the given rule.
 CycList getBackchainRules(CycConstant predicate, CycFort mt)
          Gets a list of the backchaining implication rules which might apply to the given predicate.
 CycList getCoExtensionals(CycFort cycFort)
          Gets a list of the coExtensionals for a CycFort.
 CycList getCollectionLeaves(CycFort cycFort)
          Gets a list of the collection leaves (most specific of the all-specs) for a CycFort collection.
 java.lang.String getComment(CycConstant cycConstant)
          Gets the comment for a CycConstant.
 int getCommunicationMode()
          Returns the communication mode.
 CycConstant getConstantByGuid(Guid guid)
          Gets a CycConstant by using its GUID.
 CycConstant getConstantById(java.lang.Integer id)
          Gets a CycConstant by using its ID.
 CycConstant getConstantByName(java.lang.String constantName)
          Gets a CycConstant by using its constant name.
 Guid getConstantGuid(CycConstant cycConstant)
          Gets the Guid for the given CycConstant, raising an exception if the constant does not exist.
 Guid getConstantGuid(java.lang.Integer id)
          Gets the Guid for the given constant id.
 Guid getConstantGuid(java.lang.String constantName)
          Gets the Guid for the given constant name, raising an exception if the constant does not exist.
 java.lang.Integer getConstantId(CycConstant cycConstant)
          Gets the ID for the given CycConstant.
 java.lang.Integer getConstantId(java.lang.String constantName)
          Gets the ID for the given constant name.
 java.lang.String getConstantName(java.lang.Integer id)
          Gets the name for the given constant id.
 CycConnectionInterface getCycConnection()
          Returns the CycConnection object.
 CycNart getCycNartById(java.lang.Integer id)
          Gets a CycNart by using its id.
 CycNart getCycNartFromCons(CycList elCons)
          Gets a CycNart object from a Cons object that lists the names of its functor and its arguments.
 CycList getDisjointWiths(CycFort cycFort)
          Gets a list of the disjointWiths for a CycFort.
 CycList getForwardChainRules(CycConstant predicate, CycFort mt)
          Gets a list of the forward chaining implication rules which might apply to the given predicate.
 CycList getForwardChainRules(CycConstant predicate, CycList formula, CycFort mt)
          Gets a list of the forward chaining implication rules which might apply to the given rule.
 java.lang.String getGeneratedPhrase(CycFort cycFort)
          Gets the default generated phrase for a CycFort (intended for predicates).
 CycList getGenlPreds(CycConstant predicate)
          Gets a list of the genlPreds for a CycConstant predicate.
 CycList getGenls(CycFort cycFort)
          Gets a list of the directly asserted true genls for a CycFort collection.
 CycList getGenlSiblings(CycFort cycFort)
          Gets a list of the direct genls of the direct specs for a CycFort collection.
 java.lang.String getImpreciseParaphrase(CycList assertion)
          Gets the imprecise paraphrase for a Cyc assertion.
 java.lang.String getImprecisePluralGeneratedPhrase(CycFort cycFort)
          Gets the imprecise plural generated phrase for a CycFort (intended for collections).
 java.lang.String getImpreciseSingularGeneratedPhrase(CycFort cycFort)
          Gets the imprecise singular generated phrase for a CycFort (intended for individuals).
 CycList getInstances(CycFort cycFort)
          Gets a list of the instances (who are individuals) of a CycFort collection.
 CycList getInstanceSiblings(CycFort cycFort)
          Gets a list of the instance siblings of a CycFort, for all collections of which it is an instance.
 CycList getIsas(CycFort cycFort)
          Gets a list of the isas for a CycFort.
 CycList getKbSubset(CycFort cycKbSubsetCollection)
          Gets a list of the elements of the given CycKBSubsetCollection.
 CycConstant getKnownConstantByGuid(Guid guid)
          Gets a known CycConstant by using its GUID.
 CycConstant getKnownConstantByGuid(java.lang.String guidString)
          Gets a known CycConstant by using its GUID string.
 CycConstant getKnownConstantByName(java.lang.String constantName)
          Gets a known CycConstant by using its constant name.
 CycList getLocalDisjointWith(CycFort cycFort)
          Gets a list of the collections asserted to be disjoint with a CycFort collection.
 CycList getMaxSpecs(CycFort cycFort)
          Gets a list of the least specific specs for a CycFort collection.
 CycList getMinGenls(CycFort cycFort)
          Gets a list of the minimum (most specific) genls for a CycFort collection.
 CycList getMinGenls(CycFort cycFort, CycFort mt)
          Gets a list of the minimum (most specific) genls for a CycFort collection.
 CycList getMinIsas(CycFort cycFort)
          Gets a list of the most specific collections (having no subsets) which contain a CycFort term.
 java.lang.String getParaphrase(CycList assertion)
          Gets the paraphrase for a Cyc assertion.
 java.lang.String getPluralGeneratedPhrase(CycFort cycFort)
          Gets the plural generated phrase for a CycFort (intended for collections).
 CycList getPublicConstants()
          Gets a list of the public Cyc constants.
 CycList getSampleLeafSpecs(CycFort cycFort, int numberOfSamples)
          Gets a list with the specified number of sample specs of a CycFort collection.
 CycList getSiblings(CycFort cycFort)
          Gets a list of the siblings (direct specs of the direct genls) for a CycFort collection.
 java.lang.String getSingularGeneratedPhrase(CycFort cycFort)
          Gets the singular generated phrase for a CycFort (intended for individuals).
 CycList getSpecs(CycFort cycFort)
          Gets a list of the directly asserted true specs for a CycFort collection.
 CycList getSpecSiblings(CycFort cycFort)
          Gets a list of the siblings (direct specs of the direct genls) for a CycFort collection.
 java.lang.Object getSymbolValue(CycSymbol cycSymbol)
          Gets the value of a given KB symbol.
 java.lang.String getVariableName(java.lang.Integer id)
          Gets the name for the given variable id.
 CycList getWhyCollectionsIntersect(CycFort collection1, CycFort collection2)
          Gets a list of the justifications of why CycFort COLLECTION1 and a CycFort COLLECTION2 intersect.
 java.util.ArrayList getWhyCollectionsIntersectParaphrase(CycFort collection1, CycFort collection2)
          Gets an English parapharse of the justifications of why CycFort COLLECTION1 and a CycFort COLLECTION2 intersect.
 CycList getWhyGenl(CycFort spec, CycFort genl)
          Gets a list of the justifications of why CycFort SPEC is a SPEC of CycFort GENL.
 java.util.ArrayList getWhyGenlParaphrase(CycFort spec, CycFort genl)
          Gets an English parapharse of the justifications of why CycFort SPEC is a SPEC of CycFort GENL.
 CycList getWhyIsa(CycFort spec, CycFort genl)
          Gets a list of the justifications of why CycFort TERM is an instance of CycFort COLLECTION.
 java.util.ArrayList getWhyIsaParaphrase(CycFort spec, CycFort genl)
          Gets an English parapharse of the justifications of why CycFort TERM is an instance of CycFort COLLECTION.
 boolean hasSomePredicateUsingTerm(CycConstant predicate, CycFort term, java.lang.Integer argumentPosition, CycFort mt)
          Returns true iff any ground formula instances exist having the given predicate, and the given term in the given argument position.
 int importMucExpression(CycList mucExpression, java.lang.String mtName)
          Imports a MUC (Message Understanding Conference) formatted symbolic expression into cyc via the function which parses the expression and creates assertions for the contained concepts and relations between them.
 boolean isa(CycFort term, CycFort collection)
          Returns true if CycFort TERM is a instance of CycFort COLLECTION, defaulting to all microtheories.
 boolean isa(CycFort term, CycFort collection, CycFort mt)
          Returns true if CycFort TERM is a instance of CycFort COLLECTION, using the given microtheory.
 boolean isBackchainDiscouraged(CycConstant predicate, CycFort mt)
          Returns true iff backchain inference on the given predicate is discouraged.
 boolean isBackchainEncouraged(CycConstant predicate, CycFort mt)
          Returns true iff backchain inference on the given predicate is encouraged.
 boolean isBackchainForbidden(CycConstant predicate, CycFort mt)
          Returns true iff backchain inference on the given predicate is forbidden.
 boolean isBackchainRequired(CycConstant predicate, CycFort mt)
          Returns true iff backchain inference on the given predicate is required.
 boolean isBinaryPredicate(CycConstant cycConstant)
          Returns true if cycConstant is a BinaryPredicate.
 boolean isCollection_Cached(CycFort cycFort)
          Returns true if cycConstant is a Collection, implements a cache to avoid asking the same question twice from the KB.
 boolean isCollection(CycFort cycFort)
          Returns true if cycConstant is a Collection.
 boolean isEvaluatablePredicate(CycConstant predicate)
          Returns true if cycConstant is an evaluatable predicate.
 boolean isFunction(CycConstant cycConstant)
          Returns true if cycConstant is a Function.
 boolean isGenlOf_Cached(CycFort genl, CycFort spec)
          Returns true if CycFort GENL is a genl of CycFort SPEC, implements a cache to avoid asking the same question twice from the KB.
 boolean isGenlOf(CycFort genl, CycFort spec)
          Returns true if CycFort GENL is a genl of CycFort SPEC.
 boolean isIndividual(CycFort cycFort)
          Returns true if cycConstant is an Individual.
 boolean isIrreflexivePredicate(CycConstant predicate, CycFort mt)
          Returns true iff the predicate has the irreflexive property: (#$isa ?PRED #$IrreflexsiveBinaryPredicate).
 boolean isPredicate(CycFort cycFort)
          Returns true if cycFort is a Predicate.
 boolean isPublicConstant(CycConstant cycConstant)
          Returns true if cycConstant is a PublicConstant.
 boolean isQueryTrue_Cached(CycList query, CycFort mt)
          Returns true iff the query is true in the knowledge base, implements a cache to avoid asking the same question twice from the KB.
 boolean isQueryTrue(CycList query, CycFort mt)
          Returns true iff the ground query is true in the knowledge base.
 boolean isQuotedCollection(CycFort cycFort)
          Returns true if term is a quotedCollection, in any microtheory
 boolean isQuotedCollection(CycFort cycFort, CycFort mt)
          Returns true if term is a quotedCollection is a quotedCollection.
 boolean isSpecOf(CycFort spec, CycFort genl)
          Returns true if CycFort SPEC is a spec of CycFort GENL.
 boolean isUnaryPredicate(CycConstant cycConstant)
          Returns true if cycConstant is a UnaryPredicate.
 boolean isValidConstantName(java.lang.String candidateName)
          Returns true if the candidate name is a valid CycConstant name.
 boolean isWellFormedFormula(CycList cycList)
          Returns true iff CycList represents a well formed formula.
 void kill(java.util.ArrayList cycConstants)
           
 void kill(CycConstant cycConstant)
          Kills a Cyc constant.
 void kill(CycConstant[] cycConstants)
           
 void kill(CycFort cycFort)
          Kills a Cyc NART (Non Atomic Reified Term).
 CycConstant makeCycConstant(java.lang.String name)
          Constructs a new CycConstant object using the constant name.
 CycList makeCycList(java.lang.String string)
          Constructs a new CycList object by parsing a string.
 boolean predicateRelates(CycConstant binaryPredicate, CycFort arg1, CycFort arg2)
          Returns true if CycConstant BINARYPREDICATE relates CycFort ARG1 and CycFort ARG2.
 CycList rkfPhraseReader(java.lang.String text, CycFort parsingMt, CycFort domainMt)
          Returns a list of parsing expressions, each consisting of a parsing span expression, and a list of parsed terms.
 void setCyclist(CycConstant cyclist)
           
 void setCyclist(java.lang.String cyclistName)
          Sets the value of the Cyclist, whose identity will be attached via #$myCreator bookkeeping assertions to new KB entities created in this session.
 void setKePurpose(CycConstant project)
           
 void setKePurpose(java.lang.String projectName)
          Sets the value of the KE purpose, whose project name will be attached via #$myCreationPurpose bookkeeping assertions to new KB entities created in this session.
 void setReadableNarts(java.lang.String guid)
          Sets the *print-readable-narts* feature on.
static void setSharedCycAccessInstance(CycAccess sharedCycAccessInstance)
          Sets the shared CycAccess instance.
 void setSymbolValue(CycSymbol cycSymbol, java.lang.Object value)
          Sets a KB symbol to have the specified value.
 java.lang.String toString()
          Returns a string representation of this object.
 void traceOff()
          Turns off the diagnostic trace of socket messages.
 void traceOn()
          Turns on the diagnostic trace of socket messages.
 void traceOnDetailed()
          Turns on the detailed diagnostic trace of socket messages.
 void unassertGaf(CycList gaf, CycFort mt)
          Unasserts the given ground atomic formula (gaf) in the specified microtheory MT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRANSIENT_CONNECTION

public static final boolean TRANSIENT_CONNECTION
Value indicating that the OpenCyc api socket is created and then closed for each api call.

PERSISTENT_CONNECTION

public static final boolean PERSISTENT_CONNECTION
Value indicating that the OpenCyc api should use one TCP socket for the entire session.

DEFAULT_CONNECTION

public static final boolean DEFAULT_CONNECTION
Default value indicating that the OpenCyc api should use one TCP socket for the entire session.

deferObjectCompletion

public boolean deferObjectCompletion
Parameter indicating whether the OpenCyc binary api defers the completion of CycConstant attributes until used for the first time.

persistentConnection

public boolean persistentConnection
Parameter indicating whether the OpenCyc api should use one TCP socket for the entire session, or if the socket is created and then closed for each api call.

communicationMode

protected int communicationMode

saveTrace

protected int saveTrace
Parameter that, when true, causes a trace of the messages to and from the server. This variable preserves the value of the CycConnection trace between instantiations when the connection is transient.

baseKB

public static CycConstant baseKB
Convenient reference to #$BaseKb.

isa

public static CycConstant isa
Convenient reference to #$isa.

genls

public static CycConstant genls
Convenient reference to #$genls.

genlMt

public static CycConstant genlMt
Convenient reference to #$genlMt.

comment

public static CycConstant comment
Convenient reference to #$comment.

collection

public static CycConstant collection
Convenient reference to #$Collection.

binaryPredicate

public static CycConstant binaryPredicate
Convenient reference to #$binaryPredicate.

elementOf

public static CycConstant elementOf
Convenient reference to #$elementOf.

and

public static CycConstant and
Convenient reference to #$and.

or

public static CycConstant or
Convenient reference to #$or.

not

public static CycConstant not
Convenient reference to #$not.

numericallyEqual

public static CycConstant numericallyEqual
Convenient reference to #$numericallyEqual.

plusFn

public static CycConstant plusFn
Convenient reference to #$PlusFn.

different

public static CycConstant different
Convenient reference to #$different.

thing

public static CycConstant thing
Convenient reference to #$Thing.

askCache

protected org.apache.oro.util.Cache askCache
Least Recently Used Cache of ask results.

countAllInstancesCache

protected org.apache.oro.util.Cache countAllInstancesCache
Least Recently Used Cache of countAllInstances results.

isCollectionCache

protected org.apache.oro.util.Cache isCollectionCache
Least Recently Used Cache of isCollection results.

isGenlOfCache

protected org.apache.oro.util.Cache isGenlOfCache
Least Recently Used Cache of isGenlOf results.

cycConnection

protected CycConnectionInterface cycConnection
Reference to CycConnection object which manages the api connection to the OpenCyc server.
Constructor Detail

CycAccess

public CycAccess()
          throws java.io.IOException,
                 java.net.UnknownHostException,
                 CycApiException
Constructs a new CycAccess object.

CycAccess

public CycAccess(java.lang.String myAgentName,
                 java.lang.String cycProxyAgentName,
                 int agentCommunity)
          throws java.io.IOException,
                 CycApiException
Constructs a new CycAccess object to the given CycProxyAgent in the given agent community.
Parameters:
myAgentName - the name of the local agent
cycProxyAgentName - the name of the cyc proxy agent
agentCommunity - the agent community to which the cyc proxy agent belongs

CycAccess

public CycAccess(java.lang.String hostName,
                 int basePort,
                 int communicationMode,
                 boolean persistentConnection)
          throws java.io.IOException,
                 java.net.UnknownHostException,
                 CycApiException
Constructs a new CycAccess object given a host name, port, communication mode and persistence indicator.
Parameters:
hostName - the host name
basePort - the base (HTML serving) TCP socket port number
communicationMode - either ASCII_MODE or BINARY_MODE
persistentConnection - when true keep a persistent socket connection with the OpenCyc server
Method Detail

commonInitialization

protected void commonInitialization()
                             throws java.io.IOException,
                                    CycApiException
Provides common local and remote CycAccess object initialization.

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object

current

public static CycAccess current()
Returns the CycAccess object for this thread.
Returns:
the CycAccess object for this thread

setSharedCycAccessInstance

public static void setSharedCycAccessInstance(CycAccess sharedCycAccessInstance)
Sets the shared CycAccess instance.
Parameters:
the - shared CycAccess instance

traceOn

public void traceOn()
Turns on the diagnostic trace of socket messages.

traceOnDetailed

public void traceOnDetailed()
Turns on the detailed diagnostic trace of socket messages.

traceOff

public void traceOff()
Turns off the diagnostic trace of socket messages.

getCycConnection

public CycConnectionInterface getCycConnection()
Returns the CycConnection object.
Returns:
the CycConnection object

close

public void close()
Closes the CycConnection object.

getCommunicationMode

public int getCommunicationMode()
Returns the communication mode.
Returns:
the communication mode

converse

protected java.lang.Object[] converse(java.lang.Object command)
                               throws java.io.IOException,
                                      java.net.UnknownHostException,
                                      CycApiException
Converses with Cyc to perform an API command. Creates a new connection for this command if the connection is not persistent.
Parameters:
command - the command string or CycList

converseObject

public java.lang.Object converseObject(java.lang.Object command)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Converses with Cyc to perform an API command whose result is returned as an object.
Parameters:
command - the command string or CycList
Returns:
the result of processing the API command

converseList

public CycList converseList(java.lang.Object command)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Converses with Cyc to perform an API command whose result is returned as a list. The symbol nil is returned as the empty list.
Parameters:
command - the command string or CycList
Returns:
the result of processing the API command

converseString

public java.lang.String converseString(java.lang.Object command)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Converses with Cyc to perform an API command whose result is returned as a String.
Parameters:
command - the command string or CycList
Returns:
the result of processing the API command

converseBoolean

public boolean converseBoolean(java.lang.Object command)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Converses with Cyc to perform an API command whose result is returned as a boolean.
Parameters:
command - the command string or CycList
Returns:
the result of processing the API command

converseInt

public int converseInt(java.lang.Object command)
                throws java.io.IOException,
                       java.net.UnknownHostException,
                       CycApiException
Converses with Cyc to perform an API command whose result is returned as an int.
Parameters:
command - the command string or CycList
Returns:
the result of processing the API command

converseVoid

public void converseVoid(java.lang.Object command)
                  throws java.io.IOException,
                         java.net.UnknownHostException,
                         CycApiException
Converses with Cyc to perform an API command whose result is void.
Parameters:
command - the command string or CycList

setReadableNarts

public void setReadableNarts(java.lang.String guid)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Sets the *print-readable-narts* feature on.

getKnownConstantByName

public CycConstant getKnownConstantByName(java.lang.String constantName)
                                   throws java.io.IOException,
                                          java.net.UnknownHostException,
                                          CycApiException
Gets a known CycConstant by using its constant name.
Parameters:
constantName - the name of the constant to be instantiated
Returns:
the complete CycConstant if found, otherwise throw an exception

getConstantByName

public CycConstant getConstantByName(java.lang.String constantName)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Gets a CycConstant by using its constant name.
Parameters:
constantName - the name of the constant to be instantiated
Returns:
the complete CycConstant if found, otherwise return null

getConstantId

public java.lang.Integer getConstantId(CycConstant cycConstant)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Gets the ID for the given CycConstant.
Parameters:
cycConstant - the CycConstant object for which the id is sought
Returns:
the ID for the given CycConstant, or null if the constant does not exist.

getConstantId

public java.lang.Integer getConstantId(java.lang.String constantName)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Gets the ID for the given constant name.
Parameters:
constantName - the name of the constant object for which the id is sought
Returns:
the ID for the given constant name, or null if the constant does not exist.

getConstantGuid

public Guid getConstantGuid(CycConstant cycConstant)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Gets the Guid for the given CycConstant, raising an exception if the constant does not exist.
Parameters:
cycConstant - the CycConstant object for which the id is sought
Returns:
the Guid for the given CycConstant

getConstantGuid

public Guid getConstantGuid(java.lang.String constantName)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Gets the Guid for the given constant name, raising an exception if the constant does not exist.
Parameters:
constantName - the name of the constant object for which the Guid is sought
Returns:
the Guid for the given CycConstant

getConstantGuid

public Guid getConstantGuid(java.lang.Integer id)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Gets the Guid for the given constant id.
Parameters:
id - the id of the CycConstant whose guid is sought
Returns:
the Guid for the given CycConstant

getConstantById

public CycConstant getConstantById(java.lang.Integer id)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Gets a CycConstant by using its ID.
Parameters:
id - the id of the CycConstant sought
Returns:
the CycConstant if found or null if not found

getConstantName

public java.lang.String getConstantName(java.lang.Integer id)
                                 throws java.io.IOException,
                                        java.net.UnknownHostException,
                                        CycApiException
Gets the name for the given constant id.
Parameters:
id - the id of the constant object for which the name is sought
Returns:
the name for the given CycConstant

getVariableName

public java.lang.String getVariableName(java.lang.Integer id)
                                 throws java.io.IOException,
                                        java.net.UnknownHostException,
                                        CycApiException
Gets the name for the given variable id.
Parameters:
id - the id of the variable object for which the name is sought
Returns:
the name for the given CycVariable

getKnownConstantByGuid

public CycConstant getKnownConstantByGuid(java.lang.String guidString)
                                   throws java.io.IOException,
                                          java.net.UnknownHostException,
                                          CycApiException
Gets a known CycConstant by using its GUID string.
Parameters:
guid - the globally unique ID string of the constant to be instantiated
Returns:
the complete CycConstant if found, otherwise throw an exception

getKnownConstantByGuid

public CycConstant getKnownConstantByGuid(Guid guid)
                                   throws java.io.IOException,
                                          java.net.UnknownHostException,
                                          CycApiException
Gets a known CycConstant by using its GUID.
Parameters:
guid - the globally unique ID of the constant to be instantiated
Returns:
the complete CycConstant if found, otherwise throw an exception

getConstantByGuid

public CycConstant getConstantByGuid(Guid guid)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Gets a CycConstant by using its GUID.
Parameters:
guid - the GUID from which to find the constant
Returns:
the complete CycConstant if found, otherwise return null

completeObject

public java.lang.Object completeObject(java.lang.Object object)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Completes the instantiation of objects contained in the given CycList. The binary api sends only constant ids, and the constant names and guids must be retrieved if the constant is not cached.
Parameters:
object - the CycConstant to be completed, or the Object whose embedded constants are to be completed
Returns:
the completed object, or a reference to a cached instance

completeCycConstant

public CycConstant completeCycConstant(CycConstant cycConstant)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Completes the instantiation of CycConstant returned by the binary api. The binary api sends only constant ids, and the constant names and guids must be retrieved if the constant is not cached.
Parameters:
cycConstant - the CycConstant whose name and guid are to be completed
Returns:
the completed CycConstant object, or a reference to the previously cached instance

completeCycVariable

public CycVariable completeCycVariable(CycVariable cycVariable)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Completes the instantiation of HL CycVariable returned by the binary api. The binary api sends only HL variable ids, and the variable name must be retrieved if the variable is not cached. The variable id is not used when sending variables to the binary api, instead the variable is output as a symbol. In the case where an EL variable is returned by the binary api, then then variable name is already present.
Parameters:
cycVariable - the CycVariable whose name is to be completed
Returns:
the completed CycVariable object, or a reference to the previously cached instance

completeCycList

public CycList completeCycList(CycList cycList)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Completes the instantiation of objects contained in the given CycList. The binary api sends only constant ids, and the constant names and guids must be retrieved if the constant is not cached.
Parameters:
cycList - the CycList whose constants are to be completed
the - completed CycList object

completeCycNart

public CycNart completeCycNart(CycNart cycNart)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Completes the instantiation of a CycNart returned by the binary api. The binary api sends only constant ids, and the constant names and guids must be retrieved if the constant is not cached. Also finds the id of the CycNart if the functor and arguments are instantiated.
Parameters:
cycNart - the CycNart whose constants are to be completed
the - completed CycNart object

completeCycAssertion

public CycAssertion completeCycAssertion(CycAssertion cycAssertion)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException,
                                         CycApiException
Completes the instantiation of a CycAssertion returned by the binary api. The binary api sends only constant ids, and the constant names and guids must be retrieved if the constant is not cached.
Parameters:
cycAssertion - the CycAssertion whose constants are to be completed
the - completed CycAssertion object

findNartId

public java.lang.Integer findNartId(CycNart cycNart)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    CycApiException
Finds the id of a CycNart given its formula.
Parameters:
cycNart - the CycNart object with functor and arguments instantiated
Returns:
the id of the nart if found in the KB, otherwise null

getCycNartById

public CycNart getCycNartById(java.lang.Integer id)
                       throws java.io.IOException,
                              java.net.UnknownHostException,
                              CycApiException
Gets a CycNart by using its id.

getAssertionById

public CycAssertion getAssertionById(java.lang.Integer id)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Gets a CycAssertion by using its id.

getCycNartFromCons

public CycNart getCycNartFromCons(CycList elCons)
Gets a CycNart object from a Cons object that lists the names of its functor and its arguments.

predicateRelates

public boolean predicateRelates(CycConstant binaryPredicate,
                                CycFort arg1,
                                CycFort arg2)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Returns true if CycConstant BINARYPREDICATE relates CycFort ARG1 and CycFort ARG2.

getImprecisePluralGeneratedPhrase

public java.lang.String getImprecisePluralGeneratedPhrase(CycFort cycFort)
                                                   throws java.io.IOException,
                                                          java.net.UnknownHostException,
                                                          CycApiException
Gets the imprecise plural generated phrase for a CycFort (intended for collections).

getPluralGeneratedPhrase

public java.lang.String getPluralGeneratedPhrase(CycFort cycFort)
                                          throws java.io.IOException,
                                                 java.net.UnknownHostException,
                                                 CycApiException
Gets the plural generated phrase for a CycFort (intended for collections).

getImpreciseSingularGeneratedPhrase

public java.lang.String getImpreciseSingularGeneratedPhrase(CycFort cycFort)
                                                     throws java.io.IOException,
                                                            java.net.UnknownHostException,
                                                            CycApiException
Gets the imprecise singular generated phrase for a CycFort (intended for individuals).

getSingularGeneratedPhrase

public java.lang.String getSingularGeneratedPhrase(CycFort cycFort)
                                            throws java.io.IOException,
                                                   java.net.UnknownHostException,
                                                   CycApiException
Gets the singular generated phrase for a CycFort (intended for individuals).

getGeneratedPhrase

public java.lang.String getGeneratedPhrase(CycFort cycFort)
                                    throws java.io.IOException,
                                           java.net.UnknownHostException,
                                           CycApiException
Gets the default generated phrase for a CycFort (intended for predicates).

getParaphrase

public java.lang.String getParaphrase(CycList assertion)
                               throws java.io.IOException,
                                      java.net.UnknownHostException,
                                      CycApiException
Gets the paraphrase for a Cyc assertion.

getImpreciseParaphrase

public java.lang.String getImpreciseParaphrase(CycList assertion)
                                        throws java.io.IOException,
                                               java.net.UnknownHostException,
                                               CycApiException
Gets the imprecise paraphrase for a Cyc assertion.

getComment

public java.lang.String getComment(CycConstant cycConstant)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Gets the comment for a CycConstant. Embedded quotes are replaced by spaces.

getIsas

public CycList getIsas(CycFort cycFort)
                throws java.io.IOException,
                       java.net.UnknownHostException,
                       CycApiException
Gets a list of the isas for a CycFort.

getGenls

public CycList getGenls(CycFort cycFort)
                 throws java.io.IOException,
                        java.net.UnknownHostException,
                        CycApiException
Gets a list of the directly asserted true genls for a CycFort collection.

getMinGenls

public CycList getMinGenls(CycFort cycFort,
                           CycFort mt)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the minimum (most specific) genls for a CycFort collection.
Parameters:
cycFort - the collection
mt - the microtheory in which to look
Returns:
a list of the minimum (most specific) genls for a CycFort collection

getMinGenls

public CycList getMinGenls(CycFort cycFort)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the minimum (most specific) genls for a CycFort collection.

getSpecs

public CycList getSpecs(CycFort cycFort)
                 throws java.io.IOException,
                        java.net.UnknownHostException,
                        CycApiException
Gets a list of the directly asserted true specs for a CycFort collection.

getMaxSpecs

public CycList getMaxSpecs(CycFort cycFort)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the least specific specs for a CycFort collection.

getGenlSiblings

public CycList getGenlSiblings(CycFort cycFort)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Gets a list of the direct genls of the direct specs for a CycFort collection.

getSiblings

public CycList getSiblings(CycFort cycFort)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the siblings (direct specs of the direct genls) for a CycFort collection.

getSpecSiblings

public CycList getSpecSiblings(CycFort cycFort)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Gets a list of the siblings (direct specs of the direct genls) for a CycFort collection.

getAllGenls

public CycList getAllGenls(CycFort cycFort)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of all of the direct and indirect genls for a CycFort collection.

getAllSpecs

public CycList getAllSpecs(CycFort cycFort)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of all of the direct and indirect specs for a CycFort collection.

getAllGenlsWrt

public CycList getAllGenlsWrt(CycFort spec,
                              CycFort genl)
                       throws java.io.IOException,
                              java.net.UnknownHostException,
                              CycApiException
Gets a list of all of the direct and indirect genls for a CycFort SPEC which are also specs of CycFort GENL.

getAllDependentSpecs

public CycList getAllDependentSpecs(CycFort cycFort)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    CycApiException
Gets a list of all of the dependent specs for a CycFort collection. Dependent specs are those direct and indirect specs of the collection such that every path connecting the spec to a genl of the collection passes through the collection. In a typical taxomonmy it is expected that all-dependent-specs gives the same result as all-specs.

getSampleLeafSpecs

public CycList getSampleLeafSpecs(CycFort cycFort,
                                  int numberOfSamples)
                           throws java.io.IOException,
                                  java.net.UnknownHostException,
                                  CycApiException
Gets a list with the specified number of sample specs of a CycFort collection. Attempts to return leaves that are maximally differet with regard to their all-genls.

isSpecOf

public boolean isSpecOf(CycFort spec,
                        CycFort genl)
                 throws java.io.IOException,
                        java.net.UnknownHostException,
                        CycApiException
Returns true if CycFort SPEC is a spec of CycFort GENL.

isGenlOf

public boolean isGenlOf(CycFort genl,
                        CycFort spec)
                 throws java.io.IOException,
                        java.net.UnknownHostException,
                        CycApiException
Returns true if CycFort GENL is a genl of CycFort SPEC.
Parameters:
genl - the collection for genl determination
spec - the collection for spec determination
Returns:
true if CycFort GENL is a genl of CycFort SPEC

isGenlOf_Cached

public boolean isGenlOf_Cached(CycFort genl,
                               CycFort spec)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Returns true if CycFort GENL is a genl of CycFort SPEC, implements a cache to avoid asking the same question twice from the KB.
Parameters:
genl - the collection for genl determination
spec - the collection for spec determination
Returns:
true if CycFort GENL is a genl of CycFort SPEC

areTacitCoextensional

public boolean areTacitCoextensional(CycFort collection1,
                                     CycFort collection2)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are tacitly coextensional via mutual genls of each other.

areAssertedCoextensional

public boolean areAssertedCoextensional(CycFort collection1,
                                        CycFort collection2)
                                 throws java.io.IOException,
                                        java.net.UnknownHostException,
                                        CycApiException
Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are asserted coextensional.

areIntersecting

public boolean areIntersecting(CycFort collection1,
                               CycFort collection2)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Returns true if CycFort COLLECION1 and CycFort COLLECTION2 intersect with regard to all-specs.

areHierarchical

public boolean areHierarchical(CycFort collection1,
                               CycFort collection2)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are in a hierarchy.

getWhyGenl

public CycList getWhyGenl(CycFort spec,
                          CycFort genl)
                   throws java.io.IOException,
                          java.net.UnknownHostException,
                          CycApiException
Gets a list of the justifications of why CycFort SPEC is a SPEC of CycFort GENL. getWhyGenl("Dog", "Animal") --> "(((#$genls #$Dog #$CanineAnimal) :TRUE) (#$genls #$CanineAnimal #$NonPersonAnimal) :TRUE) (#$genls #$NonPersonAnimal #$Animal) :TRUE))

getWhyGenlParaphrase

public java.util.ArrayList getWhyGenlParaphrase(CycFort spec,
                                                CycFort genl)
                                         throws java.io.IOException,
                                                java.net.UnknownHostException,
                                                CycApiException
Gets an English parapharse of the justifications of why CycFort SPEC is a SPEC of CycFort GENL. getWhyGenlParaphrase("Dog", "Animal") --> "a dog is a kind of canine" "a canine is a kind of non-human animal" "a non-human animal is a kind of animal"

getWhyCollectionsIntersect

public CycList getWhyCollectionsIntersect(CycFort collection1,
                                          CycFort collection2)
                                   throws java.io.IOException,
                                          java.net.UnknownHostException,
                                          CycApiException
Gets a list of the justifications of why CycFort COLLECTION1 and a CycFort COLLECTION2 intersect. see getWhyGenl

getWhyCollectionsIntersectParaphrase

public java.util.ArrayList getWhyCollectionsIntersectParaphrase(CycFort collection1,
                                                                CycFort collection2)
                                                         throws java.io.IOException,
                                                                java.net.UnknownHostException,
                                                                CycApiException
Gets an English parapharse of the justifications of why CycFort COLLECTION1 and a CycFort COLLECTION2 intersect. see getWhyGenlParaphrase

getCollectionLeaves

public CycList getCollectionLeaves(CycFort cycFort)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Gets a list of the collection leaves (most specific of the all-specs) for a CycFort collection.

getLocalDisjointWith

public CycList getLocalDisjointWith(CycFort cycFort)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    CycApiException
Gets a list of the collections asserted to be disjoint with a CycFort collection.

areDisjoint

public boolean areDisjoint(CycFort collection1,
                           CycFort collection2)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Returns true if CycFort COLLECION1 and CycFort COLLECTION2 are disjoint.

getMinIsas

public CycList getMinIsas(CycFort cycFort)
                   throws java.io.IOException,
                          java.net.UnknownHostException,
                          CycApiException
Gets a list of the most specific collections (having no subsets) which contain a CycFort term.

getInstances

public CycList getInstances(CycFort cycFort)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Gets a list of the instances (who are individuals) of a CycFort collection.

getInstanceSiblings

public CycList getInstanceSiblings(CycFort cycFort)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Gets a list of the instance siblings of a CycFort, for all collections of which it is an instance.

getAllIsa

public CycList getAllIsa(CycFort cycFort)
                  throws java.io.IOException,
                         java.net.UnknownHostException,
                         CycApiException
Gets a list of the collections of which the CycFort is directly and indirectly an instance.

getAllInstances

public CycList getAllInstances(CycFort cycFort)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Gets a list of all the direct and indirect instances (individuals) for a CycFort collection.

isa

public boolean isa(CycFort term,
                   CycFort collection)
            throws java.io.IOException,
                   java.net.UnknownHostException,
                   CycApiException
Returns true if CycFort TERM is a instance of CycFort COLLECTION, defaulting to all microtheories.
Parameters:
term - the term
collection - the collection
Returns:
true if CycFort TERM is a instance of CycFort COLLECTION

isa

public boolean isa(CycFort term,
                   CycFort collection,
                   CycFort mt)
            throws java.io.IOException,
                   java.net.UnknownHostException,
                   CycApiException
Returns true if CycFort TERM is a instance of CycFort COLLECTION, using the given microtheory. Method implementation optimised for the binary api.
Parameters:
term - the term
collection - the collection
mt - the microtheory in which the ask is performed
Returns:
true if CycFort TERM is a instance of CycFort COLLECTION

getWhyIsa

public CycList getWhyIsa(CycFort spec,
                         CycFort genl)
                  throws java.io.IOException,
                         java.net.UnknownHostException,
                         CycApiException
Gets a list of the justifications of why CycFort TERM is an instance of CycFort COLLECTION. getWhyIsa("Brazil", "Country") --> "(((#$isa #$Brazil #$IndependentCountry) :TRUE) (#$genls #$IndependentCountry #$Country) :TRUE))

getWhyIsaParaphrase

public java.util.ArrayList getWhyIsaParaphrase(CycFort spec,
                                               CycFort genl)
                                        throws java.io.IOException,
                                               CycApiException
Gets an English parapharse of the justifications of why CycFort TERM is an instance of CycFort COLLECTION. getWhyGenlParaphase("Brazil", "Country") --> "Brazil is an independent country" "an independent country is a kind of country"

getGenlPreds

public CycList getGenlPreds(CycConstant predicate)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Gets a list of the genlPreds for a CycConstant predicate.

getAllGenlPreds

public CycList getAllGenlPreds(CycConstant predicate)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Gets a list of all of the genlPreds for a CycConstant predicate, using an upward closure.
Returns:
a list of all of the genlPreds for a CycConstant predicate, using an upward closure

getArg1Isas

public CycList getArg1Isas(CycConstant predicate)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the arg1Isas for a CycConstant predicate.

getArg2Isas

public CycList getArg2Isas(CycConstant predicate)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the arg2Isas for a CycConstant predicate.

getArgNIsas

public CycList getArgNIsas(CycConstant predicate,
                           int argPosition)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the argNIsas for a CycConstant predicate.

getArgNGenls

public CycList getArgNGenls(CycConstant predicate,
                            int argPosition)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Gets a list of the argNGenls for a CycConstant predicate.

getArg1Formats

public CycList getArg1Formats(CycConstant predicate)
                       throws java.io.IOException,
                              java.net.UnknownHostException,
                              CycApiException
Gets a list of the arg1Formats for a CycConstant predicate.

getArg2Formats

public CycList getArg2Formats(CycConstant predicate)
                       throws java.io.IOException,
                              java.net.UnknownHostException,
                              CycApiException
Gets a list of the arg2Formats for a CycConstant predicate.

getDisjointWiths

public CycList getDisjointWiths(CycFort cycFort)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Gets a list of the disjointWiths for a CycFort.

getCoExtensionals

public CycList getCoExtensionals(CycFort cycFort)
                          throws java.io.IOException,
                                 java.net.UnknownHostException,
                                 CycApiException
Gets a list of the coExtensionals for a CycFort. Limited to 120 seconds.

isCollection

public boolean isCollection(CycFort cycFort)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Returns true if cycConstant is a Collection.

isCollection_Cached

public boolean isCollection_Cached(CycFort cycFort)
                            throws java.io.IOException,
                                   CycApiException
Returns true if cycConstant is a Collection, implements a cache to avoid asking the same question twice from the KB.
Parameters:
cycConstant - the constant for determination as a Collection
Returns:
true iff cycConstant is a Collection,

isIndividual

public boolean isIndividual(CycFort cycFort)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Returns true if cycConstant is an Individual.

isFunction

public boolean isFunction(CycConstant cycConstant)
                   throws java.io.IOException,
                          java.net.UnknownHostException,
                          CycApiException
Returns true if cycConstant is a Function.

isEvaluatablePredicate

public boolean isEvaluatablePredicate(CycConstant predicate)
                               throws java.io.IOException,
                                      java.net.UnknownHostException,
                                      CycApiException
Returns true if cycConstant is an evaluatable predicate.

isPredicate

public boolean isPredicate(CycFort cycFort)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Returns true if cycFort is a Predicate.
Parameters:
cycFort - the term for determination as a predicate
Returns:
true if cycFort is a Predicate

isUnaryPredicate

public boolean isUnaryPredicate(CycConstant cycConstant)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Returns true if cycConstant is a UnaryPredicate.

isBinaryPredicate

public boolean isBinaryPredicate(CycConstant cycConstant)
                          throws java.io.IOException,
                                 java.net.UnknownHostException,
                                 CycApiException
Returns true if cycConstant is a BinaryPredicate.

isValidConstantName

public boolean isValidConstantName(java.lang.String candidateName)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Returns true if the candidate name is a valid CycConstant name.

isQuotedCollection

public boolean isQuotedCollection(CycFort cycFort)
                           throws java.io.IOException,
                                  java.net.UnknownHostException,
                                  CycApiException
Returns true if term is a quotedCollection, in any microtheory
Parameters:
cycFort - the given CycFort term
Returns:
true if term is a quotedCollection

isQuotedCollection

public boolean isQuotedCollection(CycFort cycFort,
                                  CycFort mt)
                           throws java.io.IOException,
                                  java.net.UnknownHostException,
                                  CycApiException
Returns true if term is a quotedCollection is a quotedCollection.
Parameters:
cycFort - the given CycFort term
mt - the microtheory in which the query is made
Returns:
true if term is a quotedCollection

isPublicConstant

public boolean isPublicConstant(CycConstant cycConstant)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Returns true if cycConstant is a PublicConstant.
Parameters:
cycConstant - the given constant
Returns:
true if cycConstant is a PublicConstant

getPublicConstants

public CycList getPublicConstants()
                           throws java.io.IOException,
                                  java.net.UnknownHostException,
                                  CycApiException
Gets a list of the public Cyc constants.

getKbSubset

public CycList getKbSubset(CycFort cycKbSubsetCollection)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets a list of the elements of the given CycKBSubsetCollection.

kill

public void kill(CycConstant cycConstant)
          throws java.io.IOException,
                 java.net.UnknownHostException,
                 CycApiException
Kills a Cyc constant. If CYCCONSTANT is a microtheory, then all the contained assertions are deleted from the KB, the Cyc Truth Maintenance System (TML) will automatically delete any derived assertions whose sole support is the killed term(s).

kill

public void kill(CycConstant[] cycConstants)
          throws java.io.IOException,
                 java.net.UnknownHostException,
                 CycApiException

kill

public void kill(java.util.ArrayList cycConstants)
          throws java.io.IOException,
                 java.net.UnknownHostException,
                 CycApiException

kill

public void kill(CycFort cycFort)
          throws java.io.IOException,
                 java.net.UnknownHostException,
                 CycApiException
Kills a Cyc NART (Non Atomic Reified Term). If CYCFORT is a microtheory, then all the contained assertions are deleted from the KB, the Cyc Truth Maintenance System (TML) will automatically delete any derived assertions whose sole support is the killed term(s).

setCyclist

public void setCyclist(java.lang.String cyclistName)
                throws java.io.IOException,
                       java.net.UnknownHostException,
                       CycApiException
Sets the value of the Cyclist, whose identity will be attached via #$myCreator bookkeeping assertions to new KB entities created in this session.

setCyclist

public void setCyclist(CycConstant cyclist)

setKePurpose

public void setKePurpose(java.lang.String projectName)
                  throws java.io.IOException,
                         java.net.UnknownHostException,
                         CycApiException
Sets the value of the KE purpose, whose project name will be attached via #$myCreationPurpose bookkeeping assertions to new KB entities created in this session.

setKePurpose

public void setKePurpose(CycConstant project)

createNewPermanent

public CycConstant createNewPermanent(java.lang.String constantName)
                               throws java.io.IOException,
                                      java.net.UnknownHostException,
                                      CycApiException
Creates a new permanent Cyc constant in the KB with the specified name. The operation will be added to the KB transcript for replication and archive.

assertGaf

public void assertGaf(CycFort mt,
                      CycConstant predicate,
                      CycFort arg1,
                      CycFort arg2)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Asserts a ground atomic formula (gaf) in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive.
Parameters:
mt - the microtheory in which the assertion is made
predicate - the binary predicate of the assertion
arg1 - the first argument of the predicate
arg2 - the second argument of the predicate

assertGaf

public void assertGaf(CycFort mt,
                      CycConstant predicate,
                      CycFort arg1,
                      java.lang.String arg2)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Asserts a ground atomic formula (gaf) in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive.
Parameters:
mt - the microtheory in which the assertion is made
predicate - the binary predicate of the assertion
arg1 - the first argument of the predicate
arg2 - the second argument of the predicate, which is a string

assertGaf

public void assertGaf(CycFort mt,
                      CycConstant predicate,
                      CycFort arg1,
                      CycList arg2)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Asserts a ground atomic formula (gaf) in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive.
Parameters:
mt - the microtheory in which the assertion is made
predicate - the binary predicate of the assertion
arg1 - the first argument of the predicate
arg2 - the second argument of the predicate, which is a CycList

assertGaf

public void assertGaf(CycFort mt,
                      CycConstant predicate,
                      CycFort arg1,
                      int arg2)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Asserts a ground atomic formula (gaf) in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive.
Parameters:
mt - the microtheory in which the assertion is made
predicate - the binary predicate of the assertion
arg1 - the first argument of the predicate
arg2 - the second argument of the predicate, which is an int

assertGaf

public void assertGaf(CycFort mt,
                      CycConstant predicate,
                      CycFort arg1,
                      CycFort arg2,
                      CycFort arg3)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Asserts a ground atomic formula (gaf) in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive.
Parameters:
mt - the microtheory in which the assertion is made
predicate - the ternary predicate of the assertion
arg1 - the first argument of the predicate
arg2 - the second argument of the predicate
arg3 - the third argument of the predicate

assertGaf

public void assertGaf(CycList gaf,
                      CycFort mt)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Asserts a ground atomic formula (gaf) in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive. gaf the gaf in the form of a CycList
Parameters:
mt - the microtheory in which the assertion is made

unassertGaf

public void unassertGaf(CycList gaf,
                        CycFort mt)
                 throws java.io.IOException,
                        java.net.UnknownHostException,
                        CycApiException
Unasserts the given ground atomic formula (gaf) in the specified microtheory MT. gaf the gaf in the form of a CycList
Parameters:
mt - the microtheory in which the assertion is made

assertComment

public void assertComment(CycConstant cycConstant,
                          java.lang.String comment,
                          CycFort mt)
                   throws java.io.IOException,
                          java.net.UnknownHostException,
                          CycApiException
Assert a comment for the specified CycConstant in the specified microtheory MT. The operation will be added to the KB transcript for replication and archive.

createMicrotheory

public CycConstant createMicrotheory(java.lang.String mtName,
                                     java.lang.String comment,
                                     CycFort isaMt,
                                     java.util.ArrayList genlMts)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Create a microtheory MT, with a comment, isa and CycFort genlMts. An existing microtheory with the same name is killed first, if it exists.

createMicrotheorySystem

public CycConstant[] createMicrotheorySystem(java.lang.String mtRootName,
                                             java.lang.String comment,
                                             java.util.ArrayList genlMts)
                                      throws java.io.IOException,
                                             java.net.UnknownHostException,
                                             CycApiException
Create a microtheory system for a new mt. Given a root mt name, create a theory Mt, create a vocabulary VocabMt, and a data DataMt. Establish genlMt links for the theory mt and data mt. Assert that the theory mt is a genlMt of the WorldLikeOursCollectorMt. Assert that the data mt is a genlMt of the collector CurrentWorldDataMt.

assertIsaCollection

public void assertIsaCollection(CycConstant cycConstant,
                                CycFort mt)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Assert that the specified CycConstant is a collection in the specified defining microtheory MT. The operation will be added to the KB transcript for replication and archive.

assertGenls

public void assertGenls(CycFort specCollection,
                        CycFort genlsCollection,
                        CycFort mt)
                 throws java.io.IOException,
                        java.net.UnknownHostException,
                        CycApiException
Assert that the CycConstant GENLS is a genls of CycFort SPEC, in the specified defining microtheory MT. The operation will be added to the KB transcript for replication and archive.

assertIsa

public void assertIsa(CycFort cycFort,
                      CycFort aCollection,
                      CycFort mt)
               throws java.io.IOException,
                      java.net.UnknownHostException,
                      CycApiException
Assert that the CycFort GENLS isa CycFort ACOLLECTION, in the specified defining microtheory MT. The operation will be added to the KB transcript for replication and archive.

assertIsaBinaryPredicate

public void assertIsaBinaryPredicate(CycConstant cycConstant,
                                     CycFort mt)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Assert that the specified CycConstant is a #$BinaryPredicate in the specified defining microtheory MT. The operation will be added to the KB transcript for replication and archive.

makeCycList

public CycList makeCycList(java.lang.String string)
                    throws CycApiException
Constructs a new CycList object by parsing a string.
Parameters:
string - the string in CycL external (EL). For example:
(#$isa #$Dog #$TameAnimal)

makeCycConstant

public CycConstant makeCycConstant(java.lang.String name)
                            throws java.net.UnknownHostException,
                                   java.io.IOException,
                                   CycApiException
Constructs a new CycConstant object using the constant name.
Parameters:
name - Name of the constant. If prefixed with "#$", then the prefix is removed for canonical representation.

askWithVariable

public CycList askWithVariable(CycList query,
                               CycVariable variable,
                               CycFort mt)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Returns a list of bindings for a query with a single unbound variable.
Parameters:
query - the query to be asked in the knowledge base
variable - the single unbound variable in the query for which bindings are sought
mt - the microtheory in which the query is asked
Returns:
a list of bindings for the query

askWithVariables

public CycList askWithVariables(CycList query,
                                java.util.ArrayList variables,
                                CycFort mt)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Returns a list of bindings for a query with unbound variables.
Parameters:
query - the query to be asked in the knowledge base
variables - the list of unbound variables in the query for which bindings are sought
mt - the microtheory in which the query is asked
Returns:
a list of bindings for the query

isQueryTrue

public boolean isQueryTrue(CycList query,
                           CycFort mt)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Returns true iff the ground query is true in the knowledge base.
Parameters:
query - the query to be asked in the knowledge base
mt - the microtheory in which the query is asked
Returns:
true iff the query is true in the knowledge base

isQueryTrue_Cached

public boolean isQueryTrue_Cached(CycList query,
                                  CycFort mt)
                           throws java.io.IOException,
                                  CycApiException
Returns true iff the query is true in the knowledge base, implements a cache to avoid asking the same question twice from the KB.
Parameters:
query - the query to be asked in the knowledge base
mt - the microtheory in which the query is asked
Returns:
true iff the query is true in the knowledge base

countAllInstances

public int countAllInstances(CycFort collection,
                             CycFort mt)
                      throws java.io.IOException,
                             CycApiException
Returns the count of the instances of the given collection.
Parameters:
collection - the collection whose instances are counted
mt - microtheory (including its genlMts) in which the count is determined
Returns:
the count of the instances of the given collection

countAllInstances_Cached

public int countAllInstances_Cached(CycFort collection,
                                    CycFort mt)
                             throws java.io.IOException,
                                    CycApiException
Returns the count of the instances of the given collection, implements a cache to avoid asking the same question twice from the KB.
Parameters:
collection - the collection whose instances are counted
mt - microtheory (including its genlMts) in which the count is determined
Returns:
the count of the instances of the given collection

getBackchainImplicationRules

public CycList getBackchainImplicationRules(CycConstant predicate,
                                            CycList formula,
                                            CycFort mt)
                                     throws java.io.IOException,
                                            java.net.UnknownHostException,
                                            CycApiException
Gets a list of the backchaining implication rules which might apply to the given rule.
Parameters:
predicate - the predicate for which backward chaining implication rules are sought
formula - the literal for which backward chaining implication rules are sought
mt - the microtheory (and its genlMts) in which the search for backchaining implication rules takes place
Returns:
a list of the backchaining implication rules which might apply to the given predicate

getForwardChainRules

public CycList getForwardChainRules(CycConstant predicate,
                                    CycList formula,
                                    CycFort mt)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    CycApiException
Gets a list of the forward chaining implication rules which might apply to the given rule.
Parameters:
predicate - the predicate for which forward chaining implication rules are sought
formula - the literal for which forward chaining implication rules are sought
mt - the microtheory (and its genlMts) in which the search for forward chaining rules takes place
Returns:
a list of the forward chaining implication rules which might apply to the given predicate

getBackchainRules

public CycList getBackchainRules(CycConstant predicate,
                                 CycFort mt)
                          throws java.io.IOException,
                                 java.net.UnknownHostException,
                                 CycApiException
Gets a list of the backchaining implication rules which might apply to the given predicate.
Parameters:
predicate - the predicate for which backchaining rules are sought
mt - the microtheory (and its genlMts) in which the search for backchaining rules takes place
Returns:
a list of the backchaining implication rules which might apply to the given predicate

getForwardChainRules

public CycList getForwardChainRules(CycConstant predicate,
                                    CycFort mt)
                             throws java.io.IOException,
                                    java.net.UnknownHostException,
                                    CycApiException
Gets a list of the forward chaining implication rules which might apply to the given predicate.
Parameters:
predicate - the predicate for which forward chaining rules are sought
mt - the microtheory (and its genlMts) in which the search for forward chaining rules takes place
Returns:
a list of the forward chaining implication rules which might apply to the given predicate

getSymbolValue

public java.lang.Object getSymbolValue(CycSymbol cycSymbol)
                                throws java.io.IOException,
                                       java.net.UnknownHostException,
                                       CycApiException
Gets the value of a given KB symbol. This is intended mainly for test case setup.
Parameters:
symbol - the KB symbol which will have a value bound
Returns:
the value assigned to the symbol

setSymbolValue

public void setSymbolValue(CycSymbol cycSymbol,
                           java.lang.Object value)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Sets a KB symbol to have the specified value. This is intended mainly for test case setup. If the symbol does not exist at the KB, then it will be created and assigned the value.
Parameters:
symbol - the KB symbol which will have a value bound
value - the value assigned to the symbol

isWellFormedFormula

public boolean isWellFormedFormula(CycList cycList)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Returns true iff CycList represents a well formed formula.

isBackchainRequired

public boolean isBackchainRequired(CycConstant predicate,
                                   CycFort mt)
                            throws java.io.IOException,
                                   CycApiException
Returns true iff backchain inference on the given predicate is required.
Parameters:
predicate - the CycConstant predicate for which backchaining required status is sought
mt - microtheory (including its genlMts) in which the backchaining required status is sought
Returns:
true iff backchain inference on the given predicate is required

isBackchainEncouraged

public boolean isBackchainEncouraged(CycConstant predicate,
                                     CycFort mt)
                              throws java.io.IOException,
                                     CycApiException
Returns true iff backchain inference on the given predicate is encouraged.
Parameters:
predicate - the CycConstant predicate for which backchaining encouraged status is sought
mt - microtheory (including its genlMts) in which the backchaining encouraged status is sought
Returns:
true iff backchain inference on the given predicate is encouraged

isBackchainDiscouraged

public boolean isBackchainDiscouraged(CycConstant predicate,
                                      CycFort mt)
                               throws java.io.IOException,
                                      CycApiException
Returns true iff backchain inference on the given predicate is discouraged.
Parameters:
predicate - the CycConstant predicate for which backchaining discouraged status is sought
mt - microtheory (including its genlMts) in which the backchaining discouraged status is sought
Returns:
true iff backchain inference on the given predicate is discouraged

isBackchainForbidden

public boolean isBackchainForbidden(CycConstant predicate,
                                    CycFort mt)
                             throws java.io.IOException,
                                    CycApiException
Returns true iff backchain inference on the given predicate is forbidden.
Parameters:
predicate - the CycConstant predicate for which backchaining forbidden status is sought
mt - microtheory (including its genlMts) in which the backchaining forbidden status is sought
Returns:
true iff backchain inference on the given predicate is forbidden

isIrreflexivePredicate

public boolean isIrreflexivePredicate(CycConstant predicate,
                                      CycFort mt)
                               throws java.io.IOException,
                                      CycApiException
Returns true iff the predicate has the irreflexive property: (#$isa ?PRED #$IrreflexsiveBinaryPredicate).
Parameters:
predicate - the CycConstant predicate for which irreflexive status is sought
mt - microtheory (including its genlMts) in which the irreflexive status is sought
Returns:
true iff the predicate has the irreflexive property: (#$isa ?PRED #$IrreflexsiveBinaryPredicate)

hasSomePredicateUsingTerm

public boolean hasSomePredicateUsingTerm(CycConstant predicate,
                                         CycFort term,
                                         java.lang.Integer argumentPosition,
                                         CycFort mt)
                                  throws java.io.IOException,
                                         CycApiException
Returns true iff any ground formula instances exist having the given predicate, and the given term in the given argument position.
Parameters:
term - the term present at the given argument position
predicate - the CycConstant predicate for the formula
argumentPosition - the argument position of the given term in the ground formula
mt - microtheory (including its genlMts) in which the existence is sought
Returns:
true iff any ground formula instances exist having the given predicate, and the given term in the given argument position

countUsingBestIndex

public int countUsingBestIndex(CycList formula,
                               CycFort mt)
                        throws java.io.IOException,
                               CycApiException
Returns the count of the assertions indexed according to the given pattern, using the best index (from among the predicate and argument indices). The formula can contain variables.
Parameters:
formula - the formula whose indexed instances are counted
mt - microtheory (including its genlMts) in which the count is determined
Returns:
the count of the assertions indexed according to the given pattern, using the best index (from among the predicate and argument indices)

importMucExpression

public int importMucExpression(CycList mucExpression,
                               java.lang.String mtName)
                        throws java.io.IOException,
                               CycApiException
Imports a MUC (Message Understanding Conference) formatted symbolic expression into cyc via the function which parses the expression and creates assertions for the contained concepts and relations between them.
Parameters:
mucExpression - the MUC (Message Understanding Conference) formatted symbolic expression
mtName - the name of the microtheory in which the imported assertions will be made
Returns:
the number of assertions imported from the input MUC expression

rkfPhraseReader

public CycList rkfPhraseReader(java.lang.String text,
                               CycFort parsingMt,
                               CycFort domainMt)
                        throws java.io.IOException,
                               CycApiException
Returns a list of parsing expressions, each consisting of a parsing span expression, and a list of parsed terms.
 (RKF-PHRASE-READER "penguins" #$RKFEnglishLexicalMicrotheoryPSC #$InferencePSC)
 ==>
 (((0) (#$Penguin #$PittsburghPenguins)))
 
Parameters:
text - the phrase to be parsed
parsingMt - the microtheory in which lexical info is asked
domainMt - the microtherory in which the info about candidate terms is asked
Returns:
a parsing expression consisting of a parsing span expression, and a list of parsed terms

generateDisambiguationPhraseAndTypes

public CycList generateDisambiguationPhraseAndTypes(CycList objects)
                                             throws java.io.IOException,
                                                    CycApiException
Returns a list of disambiguation expressions, corresponding to each of the terms in the given list of objects.
 (GENERATE-DISAMBIGUATION-PHRASES-AND-TYPES (QUOTE (#$Penguin #$PittsburghPenguins)))
 ==>
 ((#$Penguin "penguin" #$Bird "bird")
  (#$PittsburghPenguins "the Pittsburgh Penguins" #$IceHockeyTeam "ice hockey team"))
 
Parameters:
objects - the list of terms to be disambiguated
Returns:
a list of disambiguation expressions, corresponding to each of the terms in the given list of objects

getArity

public int getArity(CycFort predicate)
             throws java.io.IOException,
                    CycApiException
Returns the arity of the given predicate.
Parameters:
predicate - the given predicate whose number of arguments is sought
Returns:
the arity of the given predicate, or zero if the argument is not a predicate