org.opencyc.kif
Class CycAssertionsFactory

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

public class CycAssertionsFactory
extends CycAccess

Provides wrappers for the OpenCyc API.

Extends the CycAccess class.

Author:
Douglas R. Miles

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.


Inner classes inherited from class org.opencyc.api.CycAccess
CycAccess.TraceWithNamesInfo
 
Field Summary
static CycConstant argGenl
           
static CycConstant argIsa
           
static CycConstant cycadministrator
           
static CycConstant cycBasedProject
           
static CycConstant cycFalse
           
static CycConstant cyclist
           
static CycConstant cyclistDefinitionalMt
           
static CycConstant cycNull
           
static CycConstant cycTrue
           
static CycConstant cycVoid
           
static CycConstant functionalRelation
           
static CycConstant genlpreds
           
static CycConstant makeCycConstantError
           
static CycConstant metaRelation
           
static CycConstant microtheory
           
static CycConstant opencycproject
           
static CycConstant predarity
           
static CycConstant predicate
           
static CycConstant relation
           
static CycConstant resultGenl
           
static CycConstant resultIsa
           
 
Fields inherited from class org.opencyc.api.CycAccess
and, askCache, baseKB, binaryPredicate, bookkeepingMt, collection, comment, communicationMode, countAllInstancesCache, cycAccessInstances, cycConnection, DEFAULT_CONNECTION, deferObjectCompletion, different, elementOf, genlMt, genls, hostName, inferencePSC, isa, isCollectionCache, isGenlOfCache, messagingMode, not, numericallyEqual, OK_RESPONSE_CODE, or, PERSISTENT_CONNECTION, persistentConnection, plusFn, port, saveTrace, sharedCycAccessInstance, thing, traceWithNames, traceWithNamesStack, TRANSIENT_CONNECTION, universalVocabularyMt
 
Constructor Summary
CycAssertionsFactory()
          Constructs a new CycAssertionsFactory object.
CycAssertionsFactory(java.lang.String hostName, int basePort, int communicationMode, boolean persistentConnection)
          Constructs a new CycAssertionsFactory object given a host name, port, communication mode and persistence indicator.
CycAssertionsFactory(java.lang.String myAgentName, java.lang.String cycProxyAgentName, int agentCommunity)
          Constructs a new CycAssertionsFactory object to the given CycProxyAgent in the given agent community.
 
Method Summary
static java.lang.Integer arityFromString(java.lang.String term)
           
static java.lang.String aryFromInt(int term)
           
static java.lang.String aryFromString(java.lang.String term)
           
 void assertGafNoWff(CycFort mt, CycConstant predicate, java.lang.Object arg1, java.lang.Object arg2)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGafNoWff(CycFort mt, CycConstant predicate, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Asserts a ground atomic formula (gaf) in the specified microtheory MT.
 void assertGenlMt(CycFort mt1, CycFort mt2)
          Asserts a genlMt formula in BaseKB.
 void assertGenlMt(CycFort mt1, java.lang.String mt2)
          Asserts a genlMt formula in BaseKB.
 void assertWithTranscriptNoWffCheck(CycList sentence, CycFort mt)
          Asserts the given sentence and also places it on the transcript queue with default strength and direction.
 void assertWithTranscriptNoWffCheck(java.lang.String sentence, CycFort mt)
          Asserts the given sentence and also places it on the transcript queue with default strength and direction.
 void createFunction(java.lang.String microtheoryname, java.lang.String username, java.lang.String functionname, java.lang.String genlpredsname, java.lang.String arityname, java.lang.String commentname, java.lang.String categoryname, java.lang.String resultisaname, java.lang.String resultisagenlname, java.lang.String[] arg, java.lang.String[] isagenl)
           
 void createPredicate(java.lang.String microtheoryname, java.lang.String username, java.lang.String predicatename, java.util.ArrayList genlpredss, java.lang.String arityname, java.lang.String commentname, java.util.ArrayList isas, java.lang.String[] arg, java.lang.String[] isagenl)
           
 boolean deleteGaf(CycList sentence, CycFort mt)
           
 java.util.ArrayList getArrayList(java.lang.String mt, java.lang.String collectionname)
           
 java.util.ArrayList getCollections()
           
 java.util.ArrayList getMts()
           
 boolean isMetaRelation(CycFort cycPredicate)
          Returns true if cycPredicate is a MetaRelation.
 CycConstant makeCycConstant(java.lang.String name)
          Override of CycAccess Constructs a new CycConstant object using the constant name.
 CycConstant makeCycConstantOrNull(java.lang.String name)
           
static CycList makeGaf(CycConstant cycPredicate, CycConstant arg1, CycConstant arg2)
          Constructs a new CycList object representing a Gaf using the the three parameters
 CycList makeIsa(CycConstant term, CycConstant type)
          Constructs a new CycList object representing a Isa based Gaf using the the two parameters
 CycList makeIsa(CycConstant term, java.lang.String type)
          Constructs a new CycList object representing a Isa based Gaf using the the two parameters
 java.util.ArrayList queryArrayListSEL(java.lang.String mt, java.lang.String query)
          Returns a list of bindings for a query with a single unbound variable.
 java.util.ArrayList queryArrayListSEL(java.lang.String mt, java.lang.String query, java.lang.String params)
           
 java.lang.String withBookkeepingInfo()
          Returns a with-bookkeeping-info macro expresssion.
 
Methods inherited from class org.opencyc.api.CycAccess
areAssertedCoextensional, areAssertedCoextensional, areDisjoint, areDisjoint, areHierarchical, areHierarchical, areIntersecting, areIntersecting, areTacitCoextensional, areTacitCoextensional, askWithVariable, askWithVariables, assertArg1FormatSingleEntry, assertArg1Genl, assertArg2Genl, assertArg3Genl, assertArgFormat, assertArgIsa, assertComment, assertComment, assertConceptuallyRelated, assertGaf, assertGaf, assertGaf, assertGaf, assertGaf, assertGaf, assertGaf, assertGaf, assertGenFormat, assertGenlMt, assertGenlPreds, assertGenlPreds, assertGenls, assertGenls, assertGenls, assertGenls, assertGenPhraseCountNounPlural, assertGenPhraseCountNounSingular, assertIsa, assertIsa, assertIsa, assertIsa, assertIsaBinaryPredicate, assertIsaBinaryPredicate, assertIsaCollection, assertIsaCollection, assertIsas, assertIsas, assertNameString, assertNameString, assertResultGenl, assertResultIsa, assertSynonymousExternalConcept, assertSynonymousExternalConcept, assertWithTranscript, assertWithTranscript, assertWithTranscriptAndBookkeeping, assertWithTranscriptAndBookkeeping, close, commonInitialization, completeCycAssertion, completeCycConstant, completeCycList, completeCycNart, completeCycVariable, completeObject, constantNameCaseCollision, converse, converseBoolean, converseInt, converseList, converseObject, converseString, converseVoid, countAllInstances_Cached, countAllInstances, countUsingBestIndex, createBinaryPredicate, createBinaryPredicate, createCollection, createCollection, createCollection, createCollectionDenotingBinaryFunction, createCollectionDenotingBinaryFunction, createCollectionDenotingUnaryFunction, createCollectionDenotingUnaryFunction, createCollectorMt, createIndivDenotingUnaryFunction, createIndivDenotingUnaryFunction, createIndividual, createIndividual, createKbSubsetCollection, createMicrotheory, createMicrotheory, createMicrotheorySystem, createNewPermanent, createSpindleMt, createSpindleMt, current, ensureWffConstraints, ensureWffConstraints, find, findNartId, findOrCreate, generateDisambiguationPhraseAndTypes, getAllDependentSpecs, getAllDependentSpecs, getAllGenlPreds, getAllGenlPreds, getAllGenls, getAllGenls, getAllGenlsWrt, getAllGenlsWrt, getAllInstances, getAllInstances, getAllInstancesHashSet, getAllInstancesHashSet, getAllIsa, getAllIsa, getAllSpecInverses, getAllSpecInverses, getAllSpecInversesHashSet, getAllSpecInversesHashSet, getAllSpecMts, getAllSpecMtsHashSet, getAllSpecPreds, getAllSpecPreds, getAllSpecPredsHashSet, getAllSpecPredsHashSet, getAllSpecs, getAllSpecs, getAllSpecsHashSet, getAllSpecsHashSet, getApplicableBinaryPredicates, getArg1Formats, getArg1Formats, getArg1Isas, getArg1Isas, getArg1s, getArg1s, getArg2, getArg2, getArg2, getArg2, getArg2Formats, getArg2Formats, getArg2Isas, getArg2Isas, getArg2s, getArg2s, getArg2s, getArg3Isas, getArg3Isas, getArg4Isas, getArg4Isas, getArgNGenls, getArgNGenls, getArgNIsas, getArgNIsas, getArity, getAssertionById, getBackchainImplicationRules, getBackchainRules, getCoExtensionals, getCoExtensionals, getCollectionLeaves, getCollectionLeaves, getComment, getComment, getCommunicationMode, getConstantByGuid, getConstantById, getConstantByName, getConstantGuid, getConstantGuid, getConstantGuid, getConstantId, getConstantId, getConstantName, getCycConnection, getCycNartById, getCycNartFromCons, getDisjointWiths, getDisjointWiths, getForwardChainRules, getForwardChainRules, getGafs, getGafs, getGafs, getGafs, getGeneratedPhrase, getGenlPreds, getGenlPreds, getGenls, getGenls, getGenlSiblings, getGenlSiblings, getImpreciseParaphrase, getImpreciseParaphrase, getImprecisePluralGeneratedPhrase, getImpreciseSingularGeneratedPhrase, getInstances, getInstances, getInstanceSiblings, getInstanceSiblings, getInterArgIsa1_2_forArg2, getInterArgIsa1_2_forArg2, getInterArgIsa1_2s, getInterArgIsa1_2s, getIsas, getIsas, getKbSubset, getKnownConstantByGuid, getKnownConstantByGuid, getKnownConstantByName, getLocalDisjointWith, getLocalDisjointWith, getMaxSpecs, getMaxSpecs, getMinCol, getMinGenls, getMinGenls, getMinIsas, getMinIsas, getNameStrings, getParaphrase, getPluralGeneratedPhrase, getPublicConstants, getResultIsas, getResultIsas, getSampleLeafSpecs, getSampleLeafSpecs, getSiblings, getSiblings, getSingularGeneratedPhrase, getSpecs, getSpecs, getSpecSiblings, getSpecSiblings, getSymbolValue, getSynonymousExternalConcepts, getSynonymousExternalConcepts, getVariableName, getWhyCollectionsIntersect, getWhyCollectionsIntersect, getWhyCollectionsIntersectParaphrase, getWhyCollectionsIntersectParaphrase, getWhyGenl, getWhyGenl, getWhyGenlParaphrase, getWhyGenlParaphrase, getWhyIsa, getWhyIsa, getWhyIsaParaphrase, getWhyIsaParaphrase, hasSomePredicateUsingTerm, importMucExpression, isa, isa, isa, isBackchainDiscouraged, isBackchainEncouraged, isBackchainForbidden, isBackchainRequired, isBinaryPredicate, isCollection_Cached, isCollection, isConstantNameAvailable, isCycLNonAtomicReifableTerm, isCycLNonAtomicUnreifableTerm, isEvaluatablePredicate, isFormulaWellFormed, isFunction, isGenlInverseOf, isGenlInverseOf, isGenlMtOf, isGenlOf_Cached, isGenlOf, isGenlOf, isGenlPredOf, isGenlPredOf, isIndividual, isIrreflexivePredicate, isMicrotheory, isOpenCyc, isPredicate, isPublicConstant, isQueryTrue_Cached, isQueryTrue, isQuotedCollection, isQuotedCollection, isSpecOf, isSpecOf, isUnaryPredicate, isValidConstantName, isWellFormedFormula, kill, kill, kill, kill, makeCycList, predicateRelates, predicateRelates, rkfPhraseReader, setCyclist, setCyclist, setKePurpose, setKePurpose, setReadableNarts, setSharedCycAccessInstance, setSymbolValue, toString, traceNamesOff, traceNamesOn, traceOff, traceOn, traceOnDetailed, unassertGaf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

argIsa

public static CycConstant argIsa

argGenl

public static CycConstant argGenl

resultIsa

public static CycConstant resultIsa

resultGenl

public static CycConstant resultGenl

predicate

public static CycConstant predicate

relation

public static CycConstant relation

microtheory

public static CycConstant microtheory

cyclist

public static CycConstant cyclist

predarity

public static CycConstant predarity

genlpreds

public static CycConstant genlpreds

cyclistDefinitionalMt

public static CycConstant cyclistDefinitionalMt

cycBasedProject

public static CycConstant cycBasedProject

metaRelation

public static CycConstant metaRelation

makeCycConstantError

public static CycConstant makeCycConstantError

cycadministrator

public static CycConstant cycadministrator

opencycproject

public static CycConstant opencycproject

functionalRelation

public static CycConstant functionalRelation

cycTrue

public static CycConstant cycTrue

cycFalse

public static CycConstant cycFalse

cycVoid

public static CycConstant cycVoid

cycNull

public static CycConstant cycNull
Constructor Detail

CycAssertionsFactory

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

CycAssertionsFactory

public CycAssertionsFactory(java.lang.String myAgentName,
                            java.lang.String cycProxyAgentName,
                            int agentCommunity)
                     throws java.io.IOException,
                            CycApiException
Constructs a new CycAssertionsFactory 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

CycAssertionsFactory

public CycAssertionsFactory(java.lang.String hostName,
                            int basePort,
                            int communicationMode,
                            boolean persistentConnection)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Constructs a new CycAssertionsFactory 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

getMts

public java.util.ArrayList getMts()
                           throws java.lang.Exception

getCollections

public java.util.ArrayList getCollections()
                                   throws java.lang.Exception

withBookkeepingInfo

public java.lang.String withBookkeepingInfo()
Returns a with-bookkeeping-info macro expresssion.
Overrides:
withBookkeepingInfo in class CycAccess
Following copied from class: org.opencyc.api.CycAccess
Returns:
a with-bookkeeping-info macro expresssion

assertGenlMt

public void assertGenlMt(CycFort mt1,
                         CycFort mt2)
                  throws java.io.IOException,
                         CycApiException
Asserts a genlMt formula in BaseKB. The operation will be added to the KB transcript for replication and archive.
Overrides:
assertGenlMt in class CycAccess
Parameters:
CycFort - mt1 the child Microtheory that inherits from mt2
CycFort - mt2 the parent Microtheory that lends it's assertions to the child

assertGenlMt

public void assertGenlMt(CycFort mt1,
                         java.lang.String mt2)
                  throws java.io.IOException,
                         CycApiException
Asserts a genlMt formula in BaseKB. The operation will be added to the KB transcript for replication and archive.
Parameters:
CycFort - mt1 the child Microtheory that inherits from mt2
String - mt2 the parent Microtheory that lends it's assertions to the child

makeCycConstant

public CycConstant makeCycConstant(java.lang.String name)
Override of CycAccess Constructs a new CycConstant object using the constant name.
Overrides:
makeCycConstant in class CycAccess
Parameters:
name - Name of the constant. If prefixed with "#$", then the prefix is removed for canonical representation. SPECIAL: If the name is not considered makeable it appends "Logic" to the end. If it still fails, it returns the #$MakeCycConstantErrorFn (public CycConstant makeCycConstantError)

isMetaRelation

public boolean isMetaRelation(CycFort cycPredicate)
                       throws java.io.IOException,
                              CycApiException
Returns true if cycPredicate is a MetaRelation.
Parameters:
cycPredicate - the predicate for determination as a MetaRelation
Returns:
true iff cycPredicate is a MetaRelation,

makeGaf

public static CycList makeGaf(CycConstant cycPredicate,
                              CycConstant arg1,
                              CycConstant arg2)
Constructs a new CycList object representing a Gaf using the the three parameters
Parameters:
CycConstant - cycPredicate of the Gaf
CycConstant - arg1 of the Gaf
CycConstant - arg2 of the Gaf
Returns:
new CycList that represents the new Gaf

makeIsa

public CycList makeIsa(CycConstant term,
                       java.lang.String type)
Constructs a new CycList object representing a Isa based Gaf using the the two parameters
Parameters:
CycConstant - term of the Gaf
String - type the Collections name
Returns:
new CycList that represents the new Gaf

makeIsa

public CycList makeIsa(CycConstant term,
                       CycConstant type)
Constructs a new CycList object representing a Isa based Gaf using the the two parameters
Parameters:
CycConstant - term of the Gaf
CycConstant - type Collection
Returns:
new CycList that represents the new Gaf

createPredicate

public void createPredicate(java.lang.String microtheoryname,
                            java.lang.String username,
                            java.lang.String predicatename,
                            java.util.ArrayList genlpredss,
                            java.lang.String arityname,
                            java.lang.String commentname,
                            java.util.ArrayList isas,
                            java.lang.String[] arg,
                            java.lang.String[] isagenl)
                     throws CycApiException

createFunction

public void createFunction(java.lang.String microtheoryname,
                           java.lang.String username,
                           java.lang.String functionname,
                           java.lang.String genlpredsname,
                           java.lang.String arityname,
                           java.lang.String commentname,
                           java.lang.String categoryname,
                           java.lang.String resultisaname,
                           java.lang.String resultisagenlname,
                           java.lang.String[] arg,
                           java.lang.String[] isagenl)
                    throws CycApiException

getArrayList

public java.util.ArrayList getArrayList(java.lang.String mt,
                                        java.lang.String collectionname)

queryArrayListSEL

public java.util.ArrayList queryArrayListSEL(java.lang.String mt,
                                             java.lang.String query)
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

queryArrayListSEL

public java.util.ArrayList queryArrayListSEL(java.lang.String mt,
                                             java.lang.String query,
                                             java.lang.String params)

arityFromString

public static java.lang.Integer arityFromString(java.lang.String term)

aryFromString

public static java.lang.String aryFromString(java.lang.String term)

aryFromInt

public static java.lang.String aryFromInt(int term)

assertWithTranscriptNoWffCheck

public void assertWithTranscriptNoWffCheck(java.lang.String sentence,
                                           CycFort mt)
                                    throws java.io.IOException,
                                           java.net.UnknownHostException,
                                           CycApiException
Asserts the given sentence and also places it on the transcript queue with default strength and direction. However, no WFF checks are performed
Parameters:
String - sentence the given sentence for assertion
CycFort - mt the microtheory in which the assertion is placed

assertWithTranscriptNoWffCheck

public void assertWithTranscriptNoWffCheck(CycList sentence,
                                           CycFort mt)
                                    throws java.io.IOException,
                                           java.net.UnknownHostException,
                                           CycApiException
Asserts the given sentence and also places it on the transcript queue with default strength and direction. However, no WFF checks are performed
Parameters:
CycList - sentence the given sentence for assertion
CycFort - mt the microtheory in which the assertion is placed

assertGafNoWff

public void assertGafNoWff(CycFort mt,
                           CycConstant predicate,
                           java.lang.Object arg1,
                           java.lang.Object arg2,
                           java.lang.Object arg3)
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
arg3 - the third argument of the predicate

assertGafNoWff

public void assertGafNoWff(CycFort mt,
                           CycConstant predicate,
                           java.lang.Object arg1,
                           java.lang.Object arg2)
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

deleteGaf

public boolean deleteGaf(CycList sentence,
                         CycFort mt)

makeCycConstantOrNull

public CycConstant makeCycConstantOrNull(java.lang.String name)