org.deri.iris.builtins.datatype
Class ToPlainLiteralBuiltin
java.lang.Object
org.deri.iris.builtins.AbstractBuiltin
org.deri.iris.builtins.FunctionalBuiltin
org.deri.iris.builtins.datatype.ConversionBuiltin
org.deri.iris.builtins.datatype.ToPlainLiteralBuiltin
- All Implemented Interfaces:
- Comparable<IAtom>, IAtom, IBuiltinAtom
public class ToPlainLiteralBuiltin
- extends ConversionBuiltin
Represents a data type conversion function, which converts supported data
type instances to PlainLiteral instances. The following data types are
supported:
- String
- All data types for which casting to string is supported
ToPlainLiteralBuiltin
public ToPlainLiteralBuiltin(ITerm... terms)
- Creates a new instance of this builtin.
- Parameters:
terms - The term representing the data type instance to be
converted.
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.
toPlainLiteral
public static IPlainLiteral toPlainLiteral(IXMLLiteral term)
- Converts a XMLLiteral term to a PlainLiteral term.
- Parameters:
term - The XMLLiteral term to be converted.
- Returns:
- A new PlainLiteral term representing the result of the
conversion.
toPlainLiteral
public static IPlainLiteral toPlainLiteral(IStringTerm term)
- Converts a String term to a PlainLiteral term.
- Parameters:
term - The String term to be converted.
- Returns:
- A new PlainLiteral term representing the result of the
conversion.
toPlainLiteral
public static IPlainLiteral toPlainLiteral(ITerm term)
- Converts a constant term to a PlainLiteral term. For data types other
than Text and XMLLiteral, the
toCanonicalString method of
the given term is used to convert to first convert to a String term and
then to a PlainLiteral term.
- Parameters:
term - The term to be converted.
- Returns:
- A new PlainLiteral term representing the result of the
conversion, or
null if the data type represented by
the given term is not supported.