org.opencyc.cycobject
Class CycNart

java.lang.Object
  |
  +--org.opencyc.cycobject.CycFort
        |
        +--org.opencyc.cycobject.CycNart
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class CycNart
extends CycFort
implements java.lang.Comparable

This class implements the behavior and attributes of a an OpenCyc NART (Non Atomic Reified Term).

Author:
Stefano Bertolo, 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:
Serialized Form

Field Summary
static java.lang.String argXMLtag
           
static java.lang.String functorXMLtag
           
static int indentLength
          XML serialization indentation.
static java.lang.String natXMLtag
          XML serialization tags.
 
Fields inherited from class org.opencyc.cycobject.CycFort
idXMLTag
 
Constructor Summary
CycNart()
          Constructs a new incomplete CycNart object.
CycNart(CycFort functor, CycList arguments)
          Constructs a new CycNart object from the given functor and argument list.
CycNart(CycFort functor, java.lang.Object argument)
          Constructs a new unary CycNart object from the functor and argument.
CycNart(CycFort functor, java.lang.Object argument1, java.lang.Object argument2)
          Constructs a new binary CycNart object from the functor and the two arguments.
CycNart(CycList cycList)
          Constructs a new CycNart object from the CycList object.
 
Method Summary
static CycNart coerceToCycNart(java.lang.Object object)
          Returns the given object if it is a CycNart, otherwise the object is expected to be a CycList and a CycNart object is returned using the given CycList representation.
 java.lang.String cyclify()
          Returns a cyclified string representation of the OpenCyc NART.
 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)
          Returns true some object equals this CycNart
 java.util.List getArguments()
          Returns the arguments of the CycNart.
 CycFort getFunctor()
          Returns the functor of the CycNart.
 boolean hasFunctorAndArgs()
          Returns true if the functor and arguments are instantiated.
 int hashCode()
          Return a hash value for this object.
 java.lang.String metaGuid()
          Returns a string representation of the CycNart with the guid in place of the constant name.
 java.lang.String metaName()
          Returns a metaName representation of the CycNart.
 java.lang.String safeToString()
          Returns a string representation without causing additional api calls to determine constant names.
 void setArguments(CycList arguments)
          Sets the arguments of the CycNart.
 void setFunctor(CycFort functor)
          Sets the functor of the CycNart.
 java.lang.String stringApiValue()
          Returns this object in a form suitable for use as an String api expression value.
 CycList toCycList()
          Returns a list representation of the OpenCyc NART.
 java.lang.String toString()
          Returns a string representation of the OpenCyc NART.
 void toXML(XMLWriter xmlWriter, int indent, boolean relative)
          Prints the XML representation of the CycNart to an XMLWriter It is supposed to look like this:
 java.lang.String toXMLString()
          Returns the XML representation of this object.
 
Methods inherited from class org.opencyc.cycobject.CycFort
compareTo, getId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

natXMLtag

public static final java.lang.String natXMLtag
XML serialization tags.

functorXMLtag

public static final java.lang.String functorXMLtag

argXMLtag

public static final java.lang.String argXMLtag

indentLength

public static int indentLength
XML serialization indentation.
Constructor Detail

CycNart

public CycNart()
Constructs a new incomplete CycNart object.

CycNart

public CycNart(CycFort functor,
               CycList arguments)
Constructs a new CycNart object from the given functor and argument list.
Parameters:
functor - a CycFort which is the functor of this CycNart object.
arguments - a CycList of the functor's arguments which are cyc objects

CycNart

public CycNart(CycFort functor,
               java.lang.Object argument)
Constructs a new unary CycNart object from the functor and argument.
Parameters:
functor - a CycFort which is the functor of this CycNart object.
argument - an Object most typically a CycConstant which is the single argument of this CycNart object.

CycNart

public CycNart(CycFort functor,
               java.lang.Object argument1,
               java.lang.Object argument2)
Constructs a new binary CycNart object from the functor and the two arguments.
Parameters:
functor - a CycFort which is the functor of this CycNart object.
argument1 - an Object most typically a CycConstant
argument2 - an Object most typically a CycConstant which is the single argument of this CycNart object.

CycNart

public CycNart(CycList cycList)
Constructs a new CycNart object from the CycList object.
Parameters:
cycList - a list representation of the CycNart
Method Detail

coerceToCycNart

public static CycNart coerceToCycNart(java.lang.Object object)
Returns the given object if it is a CycNart, otherwise the object is expected to be a CycList and a CycNart object is returned using the given CycList representation.
Parameters:
object - the object to be coerced into a CycNart
Returns:
the given object if it is a CycNart, otherwise the object is expected to be a CycList and a CycNart object is returned using the given CycList representation

getFunctor

public CycFort getFunctor()
Returns the functor of the CycNart.
Returns:
the functor of the CycNart

setFunctor

public void setFunctor(CycFort functor)
Sets the functor of the CycNart.
Parameters:
functor - the CycFort functor object of the CycNart

getArguments

public java.util.List getArguments()
Returns the arguments of the CycNart.
Returns:
the arguments of the CycNart

setArguments

public void setArguments(CycList arguments)
Sets the arguments of the CycNart.
Parameters:
arguments - the arguments of the CycNart

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 CycNart to an XMLWriter It is supposed to look like this:

 
  
   
    bd58a976-9c29-11b1-9dad-c379636f7270
    FruitFn
   
  
  
   
    bd58c19d-9c29-11b1-9dad-c379636f7270
    AppleTree
   
  
 
 
The parameter [int indent] specifies by how many spaces the XML output should be indented.

The parameter [boolean relative] specifies whether the indentation should be absolute -- indentation with respect to the beginning of a new line, relative = false -- or relative to the indentation currently specified in the indent_string field of the xml_writer object, relative = true.

Overrides:
toXML in class CycFort

toCycList

public CycList toCycList()
Returns a list representation of the OpenCyc NART.
Returns:
a CycList representation of the OpenCyc NART.

toString

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

cyclify

public java.lang.String cyclify()
Returns a cyclified string representation of the OpenCyc NART. Embedded constants are prefixed with ""#$".
Overrides:
cyclify in class CycFort
Returns:
a cyclified String.

safeToString

public java.lang.String safeToString()
Returns a string representation without causing additional api calls to determine constant names.
Overrides:
safeToString in class CycFort
Returns:
a string representation without causing additional api calls to determine constant names

stringApiValue

public java.lang.String stringApiValue()
Returns this object in a form suitable for use as an String api expression value.
Overrides:
stringApiValue in class CycFort
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.
Overrides:
cycListApiValue in class CycFort
Returns:
this object in a form suitable for use as an CycList api expression value

metaGuid

public java.lang.String metaGuid()
Returns a string representation of the CycNart with the guid in place of the constant name.
Returns:
a String representation of the CycNart with Guid external forms in place of the CycConstant names.

metaName

public java.lang.String metaName()
Returns a metaName representation of the CycNart.
Returns:
a String metaName representation

hashCode

public int hashCode()
Return a hash value for this object.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash value for this object

equals

public boolean equals(java.lang.Object object)
Returns true some object equals this CycNart
Overrides:
equals in class java.lang.Object
Parameters:
object - the Object for equality comparison
Returns:
equals boolean value indicating equality or non-equality.

hasFunctorAndArgs

public boolean hasFunctorAndArgs()
Returns true if the functor and arguments are instantiated.
Returns:
true if the functor and arguments are instantiated