org.opencyc.inferencesupport
Class QueryLiteral

java.lang.Object
  |
  +--org.opencyc.inferencesupport.Literal
        |
        +--org.opencyc.inferencesupport.QueryLiteral
All Implemented Interfaces:
java.lang.Comparable

public class QueryLiteral
extends Literal
implements java.lang.Comparable

QueryLiteral object to model the attributes and behavior of a query literal.

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.

See Also:
UnitTest.testQueryLiteral()

Fields inherited from class org.opencyc.inferencesupport.Literal
formula, nbrFormulaInstances, NO_SUBSUMPTION, SUBSUMED_BY, SUBSUMES, variables
 
Constructor Summary
QueryLiteral(CycList formula)
          Constructs a new QueryLiteral object from a CycList.
QueryLiteral(java.lang.String formulaString)
          Constructs a new QueryLiteral object from a CycList String representation.
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this QueryLiteral.
static QueryLiteral conjoin(QueryLiteral queryLiteral1, QueryLiteral queryLiteral2)
           
 QueryLiteral instantiate(CycVariable cycVariable, java.lang.Object value)
          Returns a new QueryLiteral which is the result of substituting the given Object value for the given CycVariable.
static java.util.ArrayList simplifyQueryLiteralExpression(CycList cycList)
          Simplifies a query literal expression.
 
Methods inherited from class org.opencyc.inferencesupport.Literal
compareTo, cyclify, determineSubsumption, equals, gatherVariables, getArguments, getArity, getFormula, getPredicate, getVariables, hasEvaluatableNumericalArgs, hashCode, isAllDifferent, isEvaluatable, isGround, isIrreflexive, isSubsumedBy, isUnary, isValidConstraintRuleExpression, substituteVariable, subsumes, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

QueryLiteral

public QueryLiteral(java.lang.String formulaString)
             throws CycApiException
Constructs a new QueryLiteral object from a CycList String representation.

Parameters:
formulaString - the query literal's formula String, which must be a well formed OpenCyc query represented by a CycList.

QueryLiteral

public QueryLiteral(CycList formula)
Constructs a new QueryLiteral object from a CycList.

Parameters:
formula - the query literal's formula, which must be a well formed OpenCyc query represented by a CycList.
Method Detail

simplifyQueryLiteralExpression

public static java.util.ArrayList simplifyQueryLiteralExpression(CycList cycList)
                                                          throws java.io.IOException
Simplifies a query literal expression.

(#$and ( ... ) becomes ...

Parameters:
cycList - the query literal expression that is simplified
Returns:
an ArrayList of QueryLiteral objects.
See Also:
UnitTest.testQueryLiteral()

clone

public java.lang.Object clone()
Creates and returns a copy of this QueryLiteral.
Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance

instantiate

public QueryLiteral instantiate(CycVariable cycVariable,
                                java.lang.Object value)
Returns a new QueryLiteral which is the result of substituting the given Object value for the given CycVariable.
Parameters:
cycVariable - the variable for substitution
value - the value which is substituted for each occurrance of the variable
Returns:
a new QueryLiteral which is the result of substituting the given Object value for the given CycVariable

conjoin

public static QueryLiteral conjoin(QueryLiteral queryLiteral1,
                                   QueryLiteral queryLiteral2)