org.opencyc.cycobject
Class CycAssertion

java.lang.Object
  |
  +--org.opencyc.cycobject.CycObject
        |
        +--org.opencyc.cycobject.CycAssertion

public class CycAssertion
extends CycObject

Provides the behavior and attributes of OpenCyc assertions.

Assertions are communicated over the binary API using their Id number (an int). The associated formula, microtheory, truth-value, direction, and remaining attributes are is fetched later.

Author:
Stephen L. Reed, Dan Lipofsky

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 java.lang.String cycAssertionXMLTag
          The name of the XML tag for this object.
 java.lang.Integer id
          Assertion id assigned by the local KB server.
static java.lang.String idXMLTag
          The name of the XML tag for id objects
static int indentLength
          The default indentation for printing objects to XML
 
Constructor Summary
CycAssertion(java.lang.Integer id)
          Constructs an incomplete CycAssertion object given its local KB id.
 
Method Summary
 java.lang.Object cycListApiValue()
          Returns this object in a form suitable for use as an CycList api expression value.
 boolean equals(java.lang.Object object)
          Indicates whether the object is equal to this object.
 CycList getFormula()
          Returns the formula for this assertion.
 java.lang.Integer getId()
          Returns the id for this assertion.
 java.lang.String safeToString()
          Returns a string representation without causing additional api calls.
 void setFormula(CycList formula)
          Sets the formula for this assertion.
 java.lang.String stringApiValue()
          Returns this object in a form suitable for use as an String api expression value.
 java.lang.String toString()
          Returns a String representation of the CycAssertion.
 void toXML(XMLWriter xmlWriter, int indent, boolean relative)
          Prints the XML representation of the CycAssertion to an XMLWriter
 java.lang.String toXMLString()
          Returns the XML representation of this object.
 
Methods inherited from class org.opencyc.cycobject.CycObject
cyclify
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cycAssertionXMLTag

public static final java.lang.String cycAssertionXMLTag
The name of the XML tag for this object.

indentLength

public static int indentLength
The default indentation for printing objects to XML

idXMLTag

public static final java.lang.String idXMLTag
The name of the XML tag for id objects

id

public java.lang.Integer id
Assertion id assigned by the local KB server. Not globally unique.
Constructor Detail

CycAssertion

public CycAssertion(java.lang.Integer id)
Constructs an incomplete CycAssertion object given its local KB id.
Parameters:
id - the assertion id assigned by the local KB
Method Detail

equals

public boolean equals(java.lang.Object object)
Indicates whether the object is equal to this object.
Overrides:
equals in class java.lang.Object
Returns:
true if the object is equal to this object, otherwise returns false

toString

public java.lang.String toString()
Returns a String representation of the CycAssertion.
Overrides:
toString in class java.lang.Object
Returns:
a String representation of the CycAssertion

safeToString

public java.lang.String safeToString()
Returns a string representation without causing additional api calls.
Returns:
a string representation without causing additional api calls

stringApiValue

public java.lang.String stringApiValue()
Returns this object in a form suitable for use as an String api expression value.
Returns:
this object in a form suitable for use as an String api expression value

cycListApiValue

public java.lang.Object cycListApiValue()
Returns this object in a form suitable for use as an CycList api expression value.
Returns:
this object in a form suitable for use as an CycList api expression value

getFormula

public CycList getFormula()
Returns the formula for this assertion.
Returns:
the formula for this assertion

setFormula

public void setFormula(CycList formula)
Sets the formula for this assertion.
Parameters:
formula - the formula for this assertion

getId

public java.lang.Integer getId()
Returns the id for this assertion.
Returns:
the id for this assertion

toXMLString

public java.lang.String toXMLString()
                             throws java.io.IOException
Returns the XML representation of this object.
Returns:
the XML representation of this object

toXML

public void toXML(XMLWriter xmlWriter,
                  int indent,
                  boolean relative)
           throws java.io.IOException
Prints the XML representation of the CycAssertion to an XMLWriter
Parameters:
xmlWriter - an XMLWriter
indent - an int that specifies by how many spaces to indent
relative - a boolean; if true indentation is relative, otherwise absolute