Literal

## Literal Literal — RDF literals and RDF query-specific literals. |

## Functions

rasqal_literal * | rasqal_new_typed_literal ()
rasqal_literal * | rasqal_new_boolean_literal ()
rasqal_literal * | rasqal_new_datetime_literal_from_datetime ()
rasqal_literal * | rasqal_new_decimal_literal ()
rasqal_literal * | rasqal_new_decimal_literal_from_decimal ()
rasqal_literal * | rasqal_new_double_literal ()
rasqal_literal * | rasqal_new_float_literal ()
rasqal_literal * | rasqal_new_floating_literal ()
rasqal_literal * | rasqal_new_integer_literal ()
rasqal_literal * | rasqal_new_numeric_literal_from_long ()
rasqal_literal * | rasqal_new_pattern_literal ()
rasqal_literal * | rasqal_new_simple_literal ()
rasqal_literal * | rasqal_new_string_literal ()
rasqal_literal * | rasqal_new_uri_literal ()
rasqal_literal * | rasqal_new_variable_literal ()
rasqal_literal * | rasqal_new_literal_from_literal ()
void | rasqal_free_literal ()
rasqal_literal * | rasqal_literal_as_node ()
const unsigned char * | rasqal_literal_as_counted_string ()
const unsigned char * | rasqal_literal_as_string ()
const unsigned char * | rasqal_literal_as_string_flags ()
rasqal_variable * | rasqal_literal_as_variable ()
int | rasqal_literal_compare ()
raptor_uri * | rasqal_literal_datatype ()
int | rasqal_literal_equals ()
char * | rasqal_literal_get_language ()
rasqal_literal_type | rasqal_literal_get_rdf_term_type ()
rasqal_literal_type | rasqal_literal_get_type ()
int | rasqal_literal_is_rdf_literal ()
int | rasqal_literal_print ()
void | rasqal_literal_print_type ()
const char * | rasqal_literal_type_label ()
int | rasqal_literal_same_term ()
rasqal_literal * | rasqal_literal_value ()

## Types and Values

typedef | rasqal_literal
enum | rasqal_literal_type

## Description

A class for handling RDF terms (URI, blank nodes, strings, datatyped literals) as well as those natively used in a query such as boolean, double, floating, integer, regex pattern and variables.

## Functions

### rasqal_new_typed_literal ()

    rasqal_literal *
    rasqal_new_typed_literal (rasqal_world *world,
                              rasqal_literal_type type,
                              const unsigned char *string);

#### Returns

### rasqal_new_boolean_literal ()

    rasqal_literal *
    rasqal_new_boolean_literal (rasqal_world *world,
                                int value);

#### Returns

### rasqal_new_datetime_literal_from_datetime ()

    rasqal_literal *
    rasqal_new_datetime_literal_from_datetime
                                   (rasqal_world *world,
                                    rasqal_xsd_datetime *dt);

#### Returns

### rasqal_new_decimal_literal ()

    rasqal_literal *
    rasqal_new_decimal_literal (rasqal_world *world,
                                const char *string);

#### Returns

### rasqal_new_decimal_literal_from_decimal ()

    rasqal_literal *
    rasqal_new_decimal_literal_from_decimal
                                   (rasqal_world *world,
                                    const char *string,
                                    rasqal_xsd_decimal *decimal);

#### Returns

### rasqal_new_double_literal ()

    rasqal_literal *
    rasqal_new_double_literal (rasqal_world *world,
                               double d);

#### Returns

### rasqal_new_float_literal ()

    rasqal_literal *
    rasqal_new_float_literal (rasqal_world *world,
                              float f);

`rasqal_new_float_literal` is deprecated and should not be used in newly-written code.

#### Returns

### rasqal_new_floating_literal ()

    rasqal_literal *
    rasqal_new_floating_literal (rasqal_world *world,
                                 rasqal_literal_type type,
                                 double d);

#### Returns

### rasqal_new_integer_literal ()

    rasqal_literal *
    rasqal_new_integer_literal (rasqal_world *world,
                                rasqal_literal_type type,
                                int integer);

#### Returns

### rasqal_new_numeric_literal_from_long ()

    rasqal_literal *
    rasqal_new_numeric_literal_from_long (rasqal_world *world,
                                          rasqal_literal_type type,
                                          long value Param3);

#### Returns

### rasqal_new_pattern_literal ()

    rasqal_literal *
    rasqal_new_pattern_literal (rasqal_world *world,
                                const char *pattern,
                                const char *flags);

#### Returns

### rasqal_new_simple_literal ()

    rasqal_literal *
    rasqal_new_simple_literal (rasqal_world *world,
                               rasqal_literal_type type,
                               const char *string);

#### Returns

### rasqal_new_string_literal ()

    rasqal_literal *
    rasqal_new_string_literal (rasqal_world *world,
                               const char *string,
                               const char *language,
                               raptor_uri *datatype,
                               const unsigned char *datatype_qname);

#### Returns

### rasqal_new_uri_literal ()

    rasqal_literal *
    rasqal_new_uri_literal (rasqal_world *world,
                            raptor_uri *uri);

#### Returns

### rasqal_new_variable_literal ()

    rasqal_literal *
    rasqal_new_variable_literal (rasqal_world *world,
                                 rasqal_variable *variable);

#### Returns

### rasqal_new_literal_from_literal ()

    rasqal_literal *
    rasqal_new_literal_from_literal (rasqal_literal *l);

#### Returns

### rasqal_free_literal ()

    void
    rasqal_free_literal (rasqal_literal *l);

### rasqal_literal_as_node ()

    rasqal_literal *
    rasqal_literal_as_node (rasqal_literal *l);

#### Returns

### rasqal_literal_as_counted_string ()

    const unsigned char *
    rasqal_literal_as_counted_string (rasqal_literal *l,
                                      size_t *len_p,
                                      int flags,
                                      int *error_p);

#### Returns

### rasqal_literal_as_string ()

    const unsigned char *
    rasqal_literal_as_string (rasqal_literal *l);

#### Returns

### rasqal_literal_as_string_flags ()

    const unsigned char *
    rasqal_literal_as_string_flags (rasqal_literal *l,
                                    int flags,
                                    int *error_p);

#### Returns

### rasqal_literal_as_variable ()

    rasqal_variable *
    rasqal_literal_as_variable (rasqal_literal *l);

#### Returns

### rasqal_literal_compare ()

    int
    rasqal_literal_compare (rasqal_literal *l1,
                            rasqal_literal *l2,
                            int flags,
                            int *error_p);

#### Returns

### rasqal_literal_datatype ()

    raptor_uri *
    rasqal_literal_datatype (rasqal_literal *l);

#### Returns

### rasqal_literal_equals ()

    int
    rasqal_literal_equals (rasqal_literal *l1,
                           rasqal_literal *l2);

#### Returns

### rasqal_literal_get_language ()

    char *
    rasqal_literal_get_language (rasqal_literal *l);

#### Returns

### rasqal_literal_get_rdf_term_type ()

    rasqal_literal_type
    rasqal_literal_get_rdf_term_type (rasqal_literal *l);

#### Returns

### rasqal_literal_get_type ()

    rasqal_literal_type
    rasqal_literal_get_type (rasqal_literal *l);

#### Returns

### rasqal_literal_is_rdf_literal ()

    int
    rasqal_literal_is_rdf_literal (rasqal_literal *l);

#### Returns

### rasqal_literal_print ()

    int
    rasqal_literal_print (rasqal_literal *l,
                          FILE *fh);

#### Returns

### rasqal_literal_print_type ()

    void
    rasqal_literal_print_type (rasqal_literal *l,
                               FILE *fh);

### rasqal_literal_type_label ()

    const char *
    rasqal_literal_type_label (rasqal_literal_type type);

#### Returns

### rasqal_literal_same_term ()

    int
    rasqal_literal_same_term (rasqal_literal *l1,
                              rasqal_literal *l2);

#### Returns

### rasqal_literal_value ()

    rasqal_literal *
    rasqal_literal_value (rasqal_literal *l);

#### Returns

## Types and Values

### rasqal_literal

    typedef struct rasqal_literal_s rasqal_literal;

Rasqal literal class.

### enum rasqal_literal_type

Types of literal.

The order in the enumeration is significant as it encodes the SPARQL term ordering conditions:

Blank Nodes << IRIs << RDF literals << typed literals

which coresponds to in enum values

BLANK << URI << STRING << (BOOLEAN | INTEGER | DOUBLE | FLOAT | DECIMAL | DATETIME | XSD_STRING)

(RASQAL_LITERAL_FIRST_XSD ... RASQAL_LITERAL_LAST_XSD)

Not used (internal): PATTERN, QNAME, VARIABLE

See `rasqal_literal_compare()` when used with flags `RASQAL_COMPARE_XQUERY`

#### Members

RASQAL_LITERAL_UNKNOWN | Internal. |
RASQAL_LITERAL_BLANK | RDF blank node literal (SPARQL r:bNode) |
RASQAL_LITERAL_URI | RDF URI Literal (SPARQL r:URI) |
RASQAL_LITERAL_STRING | RDF Plain Literal - no datatype (SPARQL r:Literal) |
RASQAL_LITERAL_XSD_STRING | String xsd:string |
RASQAL_LITERAL_BOOLEAN | Boolean literal xsd:boolean. |
RASQAL_LITERAL_INTEGER | Integer literal xsd:integer. |
RASQAL_LITERAL_FLOAT | Floating point literal xsd:float. |
RASQAL_LITERAL_DOUBLE | Double floating point literal xsd:double. |
RASQAL_LITERAL_DECIMAL | Decimal integer xsd:decimal. |
RASQAL_LITERAL_DATETIME | Date/Time literal xsd:dateTime. |
RASQAL_LITERAL_FIRST_XSD | Internal. |
RASQAL_LITERAL_LAST_XSD | Internal. |
RASQAL_LITERAL_UDT | User defined typed literal with unknown datatype URI |
RASQAL_LITERAL_PATTERN | Pattern literal for a regex. |
RASQAL_LITERAL_QNAME | XML Qname literal. |
RASQAL_LITERAL_VARIABLE | Variable literal. |
RASQAL_LITERAL_INTEGER_SUBTYPE | Internal. |
RASQAL_LITERAL_DATE | Date literal xsd:date. |
RASQAL_LITERAL_LAST | Internal. |