|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.inferencesupport.Literal
An abstract parent class for QueryLiteral and ConstraintRule classes.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
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.
UnitTest.testQueryLiteral()
Field Summary | |
protected CycList |
formula
The literal formula as an OpenCyc query. |
int |
nbrFormulaInstances
The number of instances matching this literal formula in the KB. |
static int |
NO_SUBSUMPTION
Value which indicates that a given literal neither subsumes another given literal or is subsumed by another given literal. |
static int |
SUBSUMED_BY
Value which indicates that a given literal is subsumed by another given literal. |
static int |
SUBSUMES
Value which indicates that a given literal subsumes another given literal. |
protected java.util.ArrayList |
variables
The collection of CycVariables used in the literal. |
Constructor Summary | |
Literal()
|
Method Summary | |
int |
compareTo(java.lang.Object object)
Compares this object with the specified object for order. |
java.lang.String |
cyclify()
Returns a cyclified string representation of the literal's formula. |
int |
determineSubsumption(Literal literal)
Returns a value indicating the subsumption relationship, or lack of subsumption relationship between this literal and another literal. |
boolean |
equals(java.lang.Object object)
Returns true if the object equals this object. |
protected void |
gatherVariables()
Gathers the unique variables from the literal's formula. |
CycList |
getArguments()
Returns the arguments of this Literal object. |
int |
getArity()
Returns the literal's arity which is defined to be the number of variables, not necessarily equalling the arity of the literal's first predicate. |
CycList |
getFormula()
Gets the literal's formula. |
CycConstant |
getPredicate()
Returns the predicate of this Literal object. |
java.util.ArrayList |
getVariables()
Returns the literal's variables. |
boolean |
hasEvaluatableNumericalArgs()
Returns true if this Literal has simple evaluatable numerical arguments. |
int |
hashCode()
Provides the hash code appropriate for the Literal. |
boolean |
isAllDifferent()
Returns true if this Literal is a #$different literal. |
boolean |
isEvaluatable()
Returns true if this Literal is a simple evaluatable literal, which can be answered without KB lookup. |
boolean |
isGround()
Returns true iff this is a ground formula having no variables. |
boolean |
isIrreflexive(CycFort mt)
Returns true iff the predicate has the irreflexive property: (#$isa ?PRED #$IrreflexsiveBinaryPredicate). |
boolean |
isSubsumedBy(Literal literal)
Returns whether this literal is subsumed by the given literal. |
boolean |
isUnary()
Returns true iff this is a formula having one variable. |
static boolean |
isValidConstraintRuleExpression(CycList cycListConstraintRule)
Returns true iff the given CycList is a valid representation of a constraint rule. |
void |
substituteVariable(CycVariable variable,
java.lang.Object newObject)
Substitutes an object for a variable. |
boolean |
subsumes(Literal literal)
Returns whether this literal subsumes the given literal. |
java.lang.String |
toString()
Returns a string representation of the Literal. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public int nbrFormulaInstances
protected CycList formula
protected java.util.ArrayList variables
public static final int SUBSUMES
public static final int SUBSUMED_BY
public static final int NO_SUBSUMPTION
Constructor Detail |
public Literal()
Method Detail |
protected void gatherVariables()
public CycList getFormula()
public java.util.ArrayList getVariables()
public int getArity()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the object for comparisonpublic int hashCode()
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object object)
compareTo
in interface java.lang.Comparable
object
- the reference object with which to compare.public int determineSubsumption(Literal literal) throws java.io.IOException, CycApiException
literal
- the literal for subsumption determinationpublic boolean isSubsumedBy(Literal literal) throws java.io.IOException, CycApiException
literal
- the given literal for subsumption determination.public boolean subsumes(Literal literal) throws java.io.IOException, CycApiException
literal
- the given literal for subsumption determination.public CycConstant getPredicate()
public CycList getArguments()
public void substituteVariable(CycVariable variable, java.lang.Object newObject)
oldVariable
- the variable to replacedpublic boolean isAllDifferent() throws java.io.IOException
public boolean isEvaluatable() throws java.io.IOException
public boolean hasEvaluatableNumericalArgs() throws java.io.IOException
public boolean isGround()
public boolean isUnary()
public boolean isIrreflexive(CycFort mt) throws java.io.IOException, CycApiException
mt
- the microtheory in which the irreflexive property is soughtpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String cyclify()
public static boolean isValidConstraintRuleExpression(CycList cycListConstraintRule)
cycListConstraintRule
- the representation of a constraint rule to be validated
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |