org.deri.iris.builtins.datatype
Class ToStringBuiltin

java.lang.Object
  extended by org.deri.iris.builtins.AbstractBuiltin
      extended by org.deri.iris.builtins.FunctionalBuiltin
          extended by org.deri.iris.builtins.datatype.ConversionBuiltin
              extended by org.deri.iris.builtins.datatype.ToStringBuiltin
All Implemented Interfaces:
Comparable<IAtom>, IAtom, IBuiltinAtom

public class ToStringBuiltin
extends ConversionBuiltin

Represents a data type conversion function, which converts supported data type instances to String instances. According to the XPath casting table, all data types are supported to be converted to String.


Field Summary
 
Fields inherited from class org.deri.iris.builtins.AbstractBuiltin
EMPTY_TERM
 
Constructor Summary
ToStringBuiltin(ITerm... terms)
          Creates a new instance of this builtin.
 
Method Summary
protected  ITerm convert(ITerm term)
          Converts the given supported data type instance to the specific data type
static IStringTerm toString(IPlainLiteral term)
          Converts a PlainLiteral term to a String term.
static IStringTerm toString(ITerm term)
          Converts a constant term to a String term.
static IStringTerm toString(IXMLLiteral term)
          Converts a XMLLiteral term to a String term.
 
Methods inherited from class org.deri.iris.builtins.datatype.ConversionBuiltin
computeResult
 
Methods inherited from class org.deri.iris.builtins.FunctionalBuiltin
evaluateTerms, maxUnknownVariables, testForEquality
 
Methods inherited from class org.deri.iris.builtins.AbstractBuiltin
compareTo, equals, evaluate, getPredicate, getTuple, hashCode, isBuiltin, isGround, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ToStringBuiltin

public ToStringBuiltin(ITerm... terms)
Creates a new instance of this builtin.

Parameters:
terms - The term representing the data type instance to be converted.
Method Detail

convert

protected ITerm convert(ITerm term)
Description copied from class: ConversionBuiltin
Converts the given supported data type instance to the specific data type

Specified by:
convert in class ConversionBuiltin
Returns:
The result of the conversion or null if the specified data type is not compatible.

toString

public static IStringTerm toString(IXMLLiteral term)
Converts a XMLLiteral term to a String term. The language tag of the XMLLiteral term is omitted.

Parameters:
term - The XMLLiteral term to be converted.
Returns:
A new String term representing the result of the conversion.

toString

public static IStringTerm toString(IPlainLiteral term)
Converts a PlainLiteral term to a String term. The language tag of the PlainLiteral term is omitted.

Parameters:
term - The PlainLiteral term to be converted.
Returns:
A new String term representing the result of the conversion.

toString

public static IStringTerm toString(ITerm term)
Converts a constant term to a String term. The toCanonicalString method of the given term is used to convert to String term.

Parameters:
term - The term to be converted.
Returns:
A new String term representing the result of the conversion, or null if the data type represented by the given term is not supported.