rasqal
3
RASQAL Library

# rasqal

## Synopsis

    #define             RASQAL_API
    #define             RASQAL_DEPRECATED
    extern              const unsigned int rasqal_version_major;
    extern              const unsigned int rasqal_version_minor;
    extern              const unsigned int rasqal_version_release;
    extern              const unsigned int rasqal_version_decimal;
    #define             RASQAL_WORLD_DECLARED
    typedef             rasqal_world;
    typedef             rasqal_query;
    typedef             rasqal_query_results;
    #define             RASQAL_QUERY_RESULTS_FORMATTER_DECLARED
    typedef             rasqal_query_results_formatter;
    typedef             rasqal_literal;
    typedef             rasqal_graph_pattern;
    enum                rasqal_feature;
                        rasqal_prefix;
    enum                rasqal_variable_type;
    struct              rasqal_expression_s;
                        rasqal_variable;
    enum                rasqal_data_graph_flags;
                        rasqal_data_graph;
    enum                rasqal_literal_type;
    typedef             rasqal_xsd_decimal;
    enum                rasqal_op;
    typedef             rasqal_expression;
    enum                rasqal_triple_flags;
                        rasqal_triple;
    enum                rasqal_pattern_flags;
    enum                rasqal_query_verb;
    enum                rasqal_graph_pattern_operator;
    int                 (*rasqal_graph_pattern_visit_fn)    (rasqal_query *query,
                                                             rasqal_graph_pattern *gp,
                                                             void *user_data);
    rasqal_world*       rasqal_new_world                    (void);
    void                rasqal_free_world                   (rasqal_world *);
    int                 rasqal_features_enumerate           (const rasqal_feature feature,
                                                             const char **name,
                                                             raptor_uri **uri,
                                                             const char **label);
    unsigned int        rasqal_get_feature_count            (void);
    rasqal_feature      rasqal_feature_from_uri             (raptor_uri *uri);
    int                 rasqal_feature_value_type           (const rasqal_feature feature);
    int                 rasqal_languages_enumerate          (rasqal_world *,
                                                             unsigned int counter,
                                                             const char **name,
                                                             const char **label,
                                                             unsigned char **uri_string);
    int                 rasqal_language_name_check          (rasqal_world *,
                                                             const char *name);
    rasqal_query*       rasqal_new_query                    (rasqal_world *,
                                                             const char *name,
                                                             unsigned char *uri);
    void                rasqal_free_query                   (rasqal_query *query);
    const char*         rasqal_query_get_name               (rasqal_query *query);
    const char*         rasqal_query_get_label              (rasqal_query *query);
    void                rasqal_query_set_fatal_error_handler
                                                            (rasqal_query *query,
                                                             void *user_data,
                                                             raptor_message_handler handler);
    void                rasqal_query_set_error_handler      (rasqal_query *query,
                                                             void *user_data,
                                                             raptor_message_handler handler);
    void                rasqal_query_set_warning_handler    (rasqal_query *query,
                                                             void *user_data,
                                                             raptor_message_handler handler);
    int                 rasqal_query_set_feature            (rasqal_query *query,
                                                             rasqal_feature feature,
                                                             int value);
    int                 rasqal_query_set_feature_string     (rasqal_query *query,
                                                             rasqal_feature feature,
                                                             unsigned char *value);
    int                 rasqal_query_get_feature            (rasqal_query *query,
                                                             rasqal_feature feature);
    const unsigned char* rasqal_query_get_feature_string    (rasqal_query *query,
                                                             rasqal_feature feature);
    void                rasqal_query_set_default_generate_bnodeid_parameters
                                                            (rasqal_query *rdf_query,
                                                             char *prefix,
                                                             int base);
    void                rasqal_query_set_generate_bnodeid_handler
                                                            (rasqal_query *query,
                                                             void *user_data,
                                                             rasqal_generate_bnodeid_handler handler);
    rasqal_query_verb   rasqal_query_get_verb               (rasqal_query *query);
    int                 rasqal_query_get_wildcard           (rasqal_query *query);
    int                 rasqal_query_get_distinct           (rasqal_query *query);
    void                rasqal_query_set_distinct           (rasqal_query *query,
                                                             int distinct_mode);
    int                 rasqal_query_get_explain            (rasqal_query *query);
    void                rasqal_query_set_explain            (rasqal_query *query,
                                                             int is_explain);
    int                 rasqal_query_get_limit              (rasqal_query *query);
    void                rasqal_query_set_limit              (rasqal_query *query,
                                                             int limit);
    int                 rasqal_query_get_offset             (rasqal_query *query);
    void                rasqal_query_set_offset             (rasqal_query *query,
                                                             int offset);
    int                 rasqal_query_add_data_graph         (rasqal_query *query,
                                                             raptor_uri *uri,
                                                             raptor_uri *name_uri,
                                                             int flags);
    raptor_sequence*    rasqal_query_get_data_graph_sequence
                                                            (rasqal_query *query);
    rasqal_data_graph*  rasqal_query_get_data_graph         (rasqal_query *query,
                                                             int idx);
    int                 rasqal_query_add_variable           (rasqal_query *query,
                                                             rasqal_variable *var);
    raptor_sequence*    rasqal_query_get_bound_variable_sequence
                                                            (rasqal_query *query);
    raptor_sequence*    rasqal_query_get_anonymous_variable_sequence
                                                            (rasqal_query *query);
    raptor_sequence*    rasqal_query_get_all_variable_sequence
                                                            (rasqal_query *query);
    rasqal_variable*    rasqal_query_get_variable           (rasqal_query *query,
                                                             int idx);
    int                 rasqal_query_has_variable           (rasqal_query *query,
                                                             unsigned char *name);
    int                 rasqal_query_set_variable           (rasqal_query *query,
                                                             unsigned char *name,
                                                             rasqal_literal *value);
    raptor_sequence*    rasqal_query_get_triple_sequence    (rasqal_query *query);
    rasqal_triple*      rasqal_query_get_triple             (rasqal_query *query,
                                                             int idx);
    int                 rasqal_query_add_prefix             (rasqal_query *query,
                                                             rasqal_prefix *prefix);
    raptor_sequence*    rasqal_query_get_prefix_sequence    (rasqal_query *query);
    rasqal_prefix*      rasqal_query_get_prefix             (rasqal_query *query,
                                                             int idx);
    raptor_sequence*    rasqal_query_get_order_conditions_sequence
                                                            (rasqal_query *query);
    rasqal_expression*  rasqal_query_get_order_condition    (rasqal_query *query,
                                                             int idx);
    raptor_sequence*    rasqal_query_get_group_conditions_sequence
                                                            (rasqal_query *query);
    rasqal_expression*  rasqal_query_get_group_condition    (rasqal_query *query,
                                                             int idx);
    raptor_sequence*    rasqal_query_get_construct_triples_sequence
                                                            (rasqal_query *query);
    rasqal_triple*      rasqal_query_get_construct_triple   (rasqal_query *query,
                                                             int idx);
    void                rasqal_query_graph_pattern_visit    (rasqal_query *query,
                                                             rasqal_graph_pattern_visit_fn visit_fn,
                                                             void *data);
    int                 rasqal_query_write                  (raptor_iostream *iostr,
                                                             rasqal_query *query,
                                                             raptor_uri *format_uri,
                                                             raptor_uri *base_uri);
    rasqal_graph_pattern* rasqal_query_get_query_graph_pattern
                                                            (rasqal_query *query);
    raptor_sequence*    rasqal_query_get_graph_pattern_sequence
                                                            (rasqal_query *query);
    rasqal_graph_pattern* rasqal_query_get_graph_pattern    (rasqal_query *query,
                                                             int idx);
    int                 rasqal_graph_pattern_add_sub_graph_pattern
                                                            (rasqal_graph_pattern *graph_pattern,
                                                             rasqal_graph_pattern *sub_graph_pattern);
    rasqal_triple*      rasqal_graph_pattern_get_triple     (rasqal_graph_pattern *graph_pattern,
                                                             int idx);
    raptor_sequence*    rasqal_graph_pattern_get_sub_graph_pattern_sequence
                                                            (rasqal_graph_pattern *graph_pattern);
    rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern
                                                            (rasqal_graph_pattern *graph_pattern,
                                                             int idx);
    rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator
                                                            (rasqal_graph_pattern *graph_pattern);
    const char*         rasqal_graph_pattern_operator_as_string
                                                            (rasqal_graph_pattern_operator op);
    void                rasqal_graph_pattern_print          (rasqal_graph_pattern *gp,
                                                             FILE *fh);
    int                 rasqal_graph_pattern_add_constraint (rasqal_graph_pattern *gp,
                                                             rasqal_expression *expr);
    raptor_sequence*    rasqal_graph_pattern_get_constraint_sequence
                                                            (rasqal_graph_pattern *gp);
    rasqal_expression*  rasqal_graph_pattern_get_constraint (rasqal_graph_pattern *gp,
                                                             int idx);
    int                 rasqal_graph_pattern_visit          (rasqal_query *query,
                                                             rasqal_graph_pattern *gp,
                                                             rasqal_graph_pattern_visit_fn fn,
                                                             void *user_data);
    int                 rasqal_graph_pattern_get_index      (rasqal_graph_pattern *gp);
    const char*         rasqal_query_verb_as_string         (rasqal_query_verb verb);
    void                rasqal_query_print                  (rasqal_query *query,
                                                             FILE *fh);
    int                 rasqal_query_prepare                (rasqal_query *query,
                                                             unsigned char *query_string,
                                                             raptor_uri *base_uri);
    rasqal_query_results* rasqal_query_execute              (rasqal_query *query);
    void*               rasqal_query_get_user_data          (rasqal_query *query);
    void                rasqal_query_set_user_data          (rasqal_query *query,
                                                             void *user_data);
    void                rasqal_free_query_results           (rasqal_query_results *query_results);
    int                 rasqal_query_results_is_bindings    (rasqal_query_results *query_results);
    int                 rasqal_query_results_get_count      (rasqal_query_results *query_results);
    int                 rasqal_query_results_next           (rasqal_query_results *query_results);
    int                 rasqal_query_results_finished       (rasqal_query_results *query_results);
    int                 rasqal_query_results_get_bindings   (rasqal_query_results *query_results,
                                                             unsigned char ***names,
                                                             rasqal_literal ***values);
    rasqal_literal*     rasqal_query_results_get_binding_value
                                                            (rasqal_query_results *query_results,
                                                             int offset);
    const unsigned char* rasqal_query_results_get_binding_name
                                                            (rasqal_query_results *query_results,
                                                             int offset);
    rasqal_literal*     rasqal_query_results_get_binding_value_by_name
                                                            (rasqal_query_results *query_results,
                                                             unsigned char *name);
    int                 rasqal_query_results_get_bindings_count
                                                            (rasqal_query_results *query_results);
    int                 rasqal_query_results_is_boolean     (rasqal_query_results *query_results);
    int                 rasqal_query_results_get_boolean    (rasqal_query_results *query_results);
    int                 rasqal_query_results_is_graph       (rasqal_query_results *query_results);
    raptor_statement*   rasqal_query_results_get_triple     (rasqal_query_results *query_results);
    int                 rasqal_query_results_next_triple    (rasqal_query_results *query_results);
    int                 rasqal_query_results_is_syntax      (rasqal_query_results *query_results);
    int                 rasqal_query_results_write          (raptor_iostream *iostr,
                                                             rasqal_query_results *results,
                                                             raptor_uri *format_uri,
                                                             raptor_uri *base_uri);
    int                 rasqal_query_results_read           (raptor_iostream *iostr,
                                                             rasqal_query_results *results,
                                                             raptor_uri *format_uri,
                                                             raptor_uri *base_uri);
    #define             RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER
    #define             RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER
    int                 rasqal_query_results_formats_enumerate
                                                            (rasqal_world *,
                                                             unsigned int counter,
                                                             const char **name,
                                                             const char **label,
                                                             unsigned char **uri_string,
                                                             const char **mime_type,
                                                             int *flags);
    int                 rasqal_query_results_formats_check  (rasqal_world *,
                                                             const char *name,
                                                             raptor_uri *uri,
                                                             const char *mime_type);
    rasqal_query_results_formatter* rasqal_new_query_results_formatter
                                                            (rasqal_world *,
                                                             const char *name,
                                                             raptor_uri *format_uri);
    rasqal_query_results_formatter* rasqal_new_query_results_formatter_by_mime_type
                                                            (rasqal_world *,
                                                             const char *mime_type);
    void                rasqal_free_query_results_formatter (rasqal_query_results_formatter *formatter);
    int                 rasqal_query_results_formatter_write
                                                            (raptor_iostream *iostr,
                                                             rasqal_query_results_formatter *formatter,
                                                             rasqal_query_results *results,
                                                             raptor_uri *base_uri);
    int                 rasqal_query_results_formatter_read (rasqal_world *,
                                                             raptor_iostream *iostr,
                                                             rasqal_query_results_formatter *formatter,
                                                             rasqal_query_results *results,
                                                             raptor_uri *base_uri);
    const char*         rasqal_query_results_formatter_get_mime_type
                                                            (rasqal_query_results_formatter *formatter);
    int                 rasqal_query_iostream_write_escaped_counted_string
                                                            (rasqal_query *query,
                                                             raptor_iostream *iostr,
                                                             unsigned char *string,
                                                             size_t len);
    unsigned char*      rasqal_query_escape_counted_string  (rasqal_query *query,
                                                             unsigned char *string,
                                                             size_t len,
                                                             size_t *output_len_p);
    rasqal_data_graph*  rasqal_new_data_graph               (raptor_uri *uri,
                                                             raptor_uri *name_uri,
                                                             int flags);
    void                rasqal_free_data_graph              (rasqal_data_graph *dg);
    void                rasqal_data_graph_print             (rasqal_data_graph *dg,
                                                             FILE *fh);
    enum                rasqal_compare_flags;
    rasqal_expression*  rasqal_new_0op_expression           (rasqal_op op);
    rasqal_expression*  rasqal_new_1op_expression           (rasqal_op op,
                                                             rasqal_expression *arg);
    rasqal_expression*  rasqal_new_2op_expression           (rasqal_op op,
                                                             rasqal_expression *arg1,
                                                             rasqal_expression *arg2);
    rasqal_expression*  rasqal_new_3op_expression           (rasqal_op op,
                                                             rasqal_expression *arg1,
                                                             rasqal_expression *arg2,
                                                             rasqal_expression *arg3);
    rasqal_expression*  rasqal_new_string_op_expression     (rasqal_op op,
                                                             rasqal_expression *arg1,
                                                             rasqal_literal *literal);
    rasqal_expression*  rasqal_new_literal_expression       (rasqal_literal *literal);
    rasqal_expression*  rasqal_new_function_expression      (raptor_uri *name,
                                                             raptor_sequence *args);
    rasqal_expression*  rasqal_new_cast_expression          (raptor_uri *name,
                                                             rasqal_expression *value);
    rasqal_expression*  rasqal_new_expression_from_expression
                                                            (rasqal_expression *e);
    void                rasqal_free_expression              (rasqal_expression *e);
    void                rasqal_expression_print_op          (rasqal_expression *e,
                                                             FILE *fh);
    void                rasqal_expression_print             (rasqal_expression *e,
                                                             FILE *fh);
    rasqal_literal*     rasqal_expression_evaluate          (rasqal_query *query,
                                                             rasqal_expression *e,
                                                             int flags);
    int                 (*rasqal_expression_visit_fn)       (void *user_data,
                                                             rasqal_expression *e);
    int                 rasqal_expression_visit             (rasqal_expression *e,
                                                             rasqal_expression_visit_fn fn,
                                                             void *user_data);
    rasqal_literal*     rasqal_new_integer_literal          (rasqal_world *,
                                                             rasqal_literal_type type,
                                                             int integer);
    rasqal_literal*     rasqal_new_typed_literal            (rasqal_world *,
                                                             rasqal_literal_type type,
                                                             unsigned char *string);
    rasqal_literal*     rasqal_new_double_literal           (rasqal_world *,
                                                             double d);
    rasqal_literal*     rasqal_new_float_literal            (rasqal_world *,
                                                             float f);
    rasqal_literal*     rasqal_new_uri_literal              (rasqal_world *,
                                                             raptor_uri *uri);
    rasqal_literal*     rasqal_new_pattern_literal          (rasqal_world *,
                                                             unsigned char *pattern,
                                                             const char *flags);
    rasqal_literal*     rasqal_new_string_literal           (rasqal_world *,
                                                             unsigned char *string,
                                                             const char *language,
                                                             raptor_uri *datatype,
                                                             unsigned char *datatype_qname);
    rasqal_literal*     rasqal_new_simple_literal           (rasqal_world *,
                                                             rasqal_literal_type type,
                                                             unsigned char *string);
    rasqal_literal*     rasqal_new_boolean_literal          (rasqal_world *,
                                                             int value);
    rasqal_literal*     rasqal_new_variable_literal         (rasqal_world *,
                                                             rasqal_variable *variable);
    rasqal_literal*     rasqal_new_decimal_literal          (rasqal_world *,
                                                             unsigned char *string);
    rasqal_literal*     rasqal_new_decimal_literal_from_decimal
                                                            (rasqal_world *,
                                                             unsigned char *string,
                                                             rasqal_xsd_decimal *decimal);
    rasqal_literal*     rasqal_new_literal_from_literal     (rasqal_literal *l);
    void                rasqal_free_literal                 (rasqal_literal *l);
    void                rasqal_literal_print                (rasqal_literal *l,
                                                             FILE *fh);
    void                rasqal_literal_print_type           (rasqal_literal *l,
                                                             FILE *fh);
    rasqal_variable*    rasqal_literal_as_variable          (rasqal_literal *l);
    const unsigned char* rasqal_literal_as_string           (rasqal_literal *l);
    const unsigned char* rasqal_literal_as_string_flags     (rasqal_literal *l,
                                                             int flags,
                                                             int *error);
    rasqal_literal*     rasqal_literal_as_node              (rasqal_literal *l);
    raptor_uri*         rasqal_literal_datatype             (rasqal_literal *l);
    rasqal_literal*     rasqal_literal_value                (rasqal_literal *l);
    int                 rasqal_literal_compare              (rasqal_literal *l1,
                                                             rasqal_literal *l2,
                                                             int flags,
                                                             int *error);
    int                 rasqal_literal_equals               (rasqal_literal *l1,
                                                             rasqal_literal *l2);
    rasqal_prefix*      rasqal_new_prefix                   (unsigned char *prefix,
                                                             raptor_uri *uri);
    void                rasqal_free_prefix                  (rasqal_prefix *p);
    void                rasqal_prefix_print                 (rasqal_prefix *p,
                                                             FILE *fh);
    rasqal_triple*      rasqal_new_triple                   (rasqal_literal *subject,
                                                             rasqal_literal *predicate,
                                                             rasqal_literal *object);
    rasqal_triple*      rasqal_new_triple_from_triple       (rasqal_triple *t);
    void                rasqal_free_triple                  (rasqal_triple *t);
    void                rasqal_triple_print                 (rasqal_triple *t,
                                                             FILE *fh);
    void                rasqal_triple_set_origin            (rasqal_triple *t,
                                                             rasqal_literal *l);
    rasqal_literal*     rasqal_triple_get_origin            (rasqal_triple *t);
    rasqal_variable*    rasqal_new_variable_typed           (rasqal_query *rq,
                                                             rasqal_variable_type type,
                                                             unsigned char *name,
                                                             rasqal_literal *value);
    rasqal_variable*    rasqal_new_variable                 (rasqal_query *rq,
                                                             unsigned char *name,
                                                             rasqal_literal *value);
    rasqal_variable*    rasqal_new_variable_from_variable   (rasqal_variable *v);
    void                rasqal_free_variable                (rasqal_variable *v);
    void                rasqal_variable_print               (rasqal_variable *v,
                                                             FILE *fh);
    void                rasqal_variable_set_value           (rasqal_variable *v,
                                                             rasqal_literal *l);
    void                rasqal_free_memory                  (void *ptr);
    void*               rasqal_alloc_memory                 (size_t size);
    void*               rasqal_calloc_memory                (size_t nmemb,
                                                             size_t size);
    rasqal_xsd_decimal* rasqal_new_xsd_decimal              (void);
    void                rasqal_free_xsd_decimal             (rasqal_xsd_decimal *dec);
    int                 rasqal_xsd_decimal_set_string       (rasqal_xsd_decimal *dec,
                                                             const char *string);
    double              rasqal_xsd_decimal_get_double       (rasqal_xsd_decimal *dec);
    char*               rasqal_xsd_decimal_as_string        (rasqal_xsd_decimal *dec);
    char*               rasqal_xsd_decimal_as_counted_string
                                                            (rasqal_xsd_decimal *dec,
                                                             size_t *len_p);
    int                 rasqal_xsd_decimal_set_long         (rasqal_xsd_decimal *dec,
                                                             long l );
    int                 rasqal_xsd_decimal_set_double       (rasqal_xsd_decimal *dec,
                                                             double d);
    int                 rasqal_xsd_decimal_print            (rasqal_xsd_decimal *dec,
                                                             FILE *stream);
    int                 rasqal_xsd_decimal_add              (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);
    int                 rasqal_xsd_decimal_subtract         (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);
    int                 rasqal_xsd_decimal_multiply         (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);
    int                 rasqal_xsd_decimal_divide           (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);
    int                 rasqal_xsd_decimal_negate           (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a);
    int                 rasqal_xsd_decimal_compare          (rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);
    int                 rasqal_xsd_decimal_equals           (rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);
    int                 rasqal_xsd_decimal_is_zero          (rasqal_xsd_decimal *d);
    enum                rasqal_triple_parts;
    rasqal_triple_parts bind_match                          (struct rasqal_triples_match_s *,
                                                             void *user_data,
                                                             rasqal_variable *bindings[4],
                                                             rasqal_triple_parts parts);
    void                next_match                          (struct rasqal_triples_match_s *,
                                                             void *user_data);
    int                 is_end                              (struct rasqal_triples_match_s *,
                                                             void *user_data);
    void                finish                              (struct rasqal_triples_match_s *,
                                                             void *user_data);
    typedef             rasqal_triples_match;
                        rasqal_triple_meta;
    int                 init_triples_match                  (rasqal_triples_match *rtm,
                                                             struct rasqal_triples_source_s *rts,
                                                             void *user_data,
                                                             rasqal_triple_meta *m,
                                                             rasqal_triple *t);
    int                 triple_present                      (struct rasqal_triples_source_s *rts,
                                                             void *user_data,
                                                             rasqal_triple *t);
    void                free_triples_source                 (void *user_data);
    typedef             rasqal_triples_source;
                        rasqal_triples_source_factory;
    void                rasqal_set_triples_source_factory   (rasqal_world *,
                                                             void (register_fnrasqal_triples_source_factory *factory) (),
                                                             void *user_data);

## Description

## Details

### RASQAL_API

    #define             RASQAL_API

Macro for wrapping API function call declarations.

### RASQAL_DEPRECATED

    #define             RASQAL_DEPRECATED

When defined before a function, indicates that the function has been deprecated and may be replaced in a future release. With some versions of gcc this may give a compilation warning.

### rasqal_version_major

    extern const unsigned int rasqal_version_major;

Library major version number as a decimal integer.

### rasqal_version_minor

    extern const unsigned int rasqal_version_minor;

Library minor version number as a decimal integer.

### rasqal_version_release

    extern const unsigned int rasqal_version_release;

Library release version number as a decimal integer.

### rasqal_version_decimal

    extern const unsigned int rasqal_version_decimal;

Library full version as a decimal integer.

See also rasqal_version_string.

### RASQAL_WORLD_DECLARED

    #define RASQAL_WORLD_DECLARED 1

### rasqal_world

    typedef struct rasqal_world_s rasqal_world;

Rasqal world class.

### rasqal_query

    typedef struct rasqal_query_s rasqal_query;

Rasqal query class.

### rasqal_query_results

    typedef struct rasqal_query_results_s rasqal_query_results;

Rasqal query results class.

### RASQAL_QUERY_RESULTS_FORMATTER_DECLARED

    #define RASQAL_QUERY_RESULTS_FORMATTER_DECLARED 1

### rasqal_query_results_formatter

    typedef struct rasqal_query_results_formatter_s rasqal_query_results_formatter;

Rasqal query results formatter class.

### rasqal_literal

    typedef struct rasqal_literal_s rasqal_literal;

Rasqal literal class.

### rasqal_graph_pattern

    typedef struct rasqal_graph_pattern_s rasqal_graph_pattern;

Rasqal graph pattern class.

### enum rasqal_feature

    typedef enum {
      RASQAL_FEATURE_NO_NET,
      RASQAL_FEATURE_LAST = RASQAL_FEATURE_NO_NET
    } rasqal_feature;

Query features.

None currently defined.

`RASQAL_FEATURE_NO_NET`

  Deny network requests.

`RASQAL_FEATURE_LAST`

  Internal.

### rasqal_prefix

    typedef struct {
      const unsigned char *prefix;
      raptor_uri* uri;
      int declared;
      int depth;
    } rasqal_prefix;

Namespace (prefix, uri) pair.

Includes internal flags used for marking when prefixes are declared and at what XML element depth when used in XML formats.

raptor_uri *uri;

  URI associated with the prefix.

int declared;

  Internal flag.

int depth;

  Internal flag.

### enum rasqal_variable_type

    typedef enum {
      RASQAL_VARIABLE_TYPE_UNKNOWN   = 0,
      RASQAL_VARIABLE_TYPE_NORMAL    = 1,
      RASQAL_VARIABLE_TYPE_ANONYMOUS = 2
    } rasqal_variable_type;

Rasqal variable types.

ANONYMOUS can be used in queries but cannot be returned in a result.

`RASQAL_VARIABLE_TYPE_UNKNOWN`

  Internal.

`RASQAL_VARIABLE_TYPE_NORMAL`

  The regular variable type.

`RASQAL_VARIABLE_TYPE_ANONYMOUS`

  Anonymous variable type.

### struct rasqal_expression_s

    struct rasqal_expression_s;

Internal - see rasqal_expression.

### rasqal_variable

    typedef struct {
      const unsigned char *name;
      rasqal_literal* value;
      int offset;
      rasqal_variable_type type;
      struct rasqal_expression_s* expression;
    } rasqal_variable;

Binding between a variable name and a value.

Includes internal field `offset` for recording the offset into the (internal) rasqal_query variables array.

rasqal_literal *value;

  Variable value or NULL if unbound.

int offset;

  Internal.

rasqal_variable_type type;

  Variable type.

struct rasqal_expression_s *expression;

  Expression when the variable is a computed SELECT expression

### enum rasqal_data_graph_flags

    typedef enum {
      RASQAL_DATA_GRAPH_NONE  = 0,
      RASQAL_DATA_GRAPH_NAMED = 1,
      RASQAL_DATA_GRAPH_BACKGROUND = 2,
    } rasqal_data_graph_flags;

Flags for the type of rasqal_data_graph.

These are used by `rasqal_query_add_data_graph()`. See rasqal_data_graph.

`RASQAL_DATA_GRAPH_NONE`

  Internal.

`RASQAL_DATA_GRAPH_NAMED`

  Graphs with a source and name.

`RASQAL_DATA_GRAPH_BACKGROUND`

  Graphs with a source only.

### rasqal_data_graph

    typedef struct {
      raptor_uri* uri;
      raptor_uri* name_uri;
      int flags;
    } rasqal_data_graph;

A source of RDF data for querying.

The uri is the original source (base URI) of the content. It may also have an additional name `name_uri` as long as `flags` is `RASQAL_DATA_NAMED`

raptor_uri *uri;

  source URI

raptor_uri *name_uri;

  name of graph for `RASQAL_DATA_NAMED`

int flags;

  `RASQAL_DATA_GRAPH_NAMED` or `RASQAL_DATA_GRAPH_BACKGROUND`

### enum rasqal_literal_type

    typedef enum {
      /* internal */
      RASQAL_LITERAL_UNKNOWN,
      RASQAL_LITERAL_BLANK,
      RASQAL_LITERAL_URI,
      RASQAL_LITERAL_STRING,
      RASQAL_LITERAL_BOOLEAN,
      RASQAL_LITERAL_INTEGER,
      RASQAL_LITERAL_DOUBLE,
      RASQAL_LITERAL_FLOAT,
      RASQAL_LITERAL_DECIMAL,
      RASQAL_LITERAL_DATETIME,
      /* internal */
      RASQAL_LITERAL_FIRST_XSD = RASQAL_LITERAL_STRING,
      /* internal */
      RASQAL_LITERAL_LAST_XSD = RASQAL_LITERAL_DATETIME,
      RASQAL_LITERAL_PATTERN,
      RASQAL_LITERAL_QNAME,
      RASQAL_LITERAL_VARIABLE,
      /* internal */
      RASQAL_LITERAL_LAST= RASQAL_LITERAL_VARIABLE
    } 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) (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`

`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 Literal / xsd:string (SPARQL r:Literal)

`RASQAL_LITERAL_BOOLEAN`

  Boolean literal xsd:boolean.

`RASQAL_LITERAL_INTEGER`

  Integer literal xsd:integer.

`RASQAL_LITERAL_DOUBLE`

  Double floating point literal xsd:double.

`RASQAL_LITERAL_FLOAT`

  Floating point literal xsd:float.

`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_PATTERN`

  Pattern literal for a regex.

`RASQAL_LITERAL_QNAME`

  XML Qname literal.

`RASQAL_LITERAL_VARIABLE`

  Variable literal.

`RASQAL_LITERAL_LAST`

  Internal.

### rasqal_xsd_decimal

    typedef struct rasqal_xsd_decimal_s rasqal_xsd_decimal;

Rasqal XSD Decimal class.

### enum rasqal_op

    typedef enum {
      /* internal */
      RASQAL_EXPR_UNKNOWN,
      RASQAL_EXPR_AND,
      RASQAL_EXPR_OR,
      RASQAL_EXPR_EQ,
      RASQAL_EXPR_NEQ,
      RASQAL_EXPR_LT,
      RASQAL_EXPR_GT,
      RASQAL_EXPR_LE,
      RASQAL_EXPR_GE,
      RASQAL_EXPR_UMINUS,
      RASQAL_EXPR_PLUS,
      RASQAL_EXPR_MINUS,
      RASQAL_EXPR_STAR,
      RASQAL_EXPR_SLASH,
      RASQAL_EXPR_REM,
      RASQAL_EXPR_STR_EQ,
      RASQAL_EXPR_STR_NEQ,
      RASQAL_EXPR_STR_MATCH,
      RASQAL_EXPR_STR_NMATCH,
      RASQAL_EXPR_TILDE,
      RASQAL_EXPR_BANG,
      RASQAL_EXPR_LITERAL,
      RASQAL_EXPR_FUNCTION,
      RASQAL_EXPR_BOUND,
      RASQAL_EXPR_STR,
      RASQAL_EXPR_LANG,
      RASQAL_EXPR_DATATYPE,
      RASQAL_EXPR_ISURI,
      RASQAL_EXPR_ISBLANK,
      RASQAL_EXPR_ISLITERAL,
      RASQAL_EXPR_CAST,
      RASQAL_EXPR_ORDER_COND_ASC,
      RASQAL_EXPR_ORDER_COND_DESC,
      RASQAL_EXPR_LANGMATCHES,
      RASQAL_EXPR_REGEX,
      RASQAL_EXPR_GROUP_COND_ASC,
      RASQAL_EXPR_GROUP_COND_DESC,
      RASQAL_EXPR_COUNT,
      RASQAL_EXPR_VARSTAR,
      RASQAL_EXPR_SAMETERM,
      /* internal */
      RASQAL_EXPR_LAST= RASQAL_EXPR_SAMETERM
    } rasqal_op;

Rasqal expression operators. A mixture of unary, binary and tertiary operators (string matches). Also includes casting and two ordering operators from ORDER BY in SPARQL.

`RASQAL_EXPR_UNKNOWN`

  Internal

`RASQAL_EXPR_AND`

  Expression for AND(A, B)

`RASQAL_EXPR_OR`

  Expression for OR(A, B)

`RASQAL_EXPR_EQ`

  Expression for A equals B

`RASQAL_EXPR_NEQ`

  Expression for A not equals B.

`RASQAL_EXPR_LT`

  Expression for A less than B.

`RASQAL_EXPR_GT`

  Expression for A greather than B.

`RASQAL_EXPR_LE`

  Expression for A less than or equal to B.

`RASQAL_EXPR_GE`

  Expression for A greater than or equal to B.

`RASQAL_EXPR_UMINUS`

  Expression for -A.

`RASQAL_EXPR_PLUS`

  Expression for +A.

`RASQAL_EXPR_MINUS`

  Expression for A-B.

`RASQAL_EXPR_STAR`

  Expression for A*B.

`RASQAL_EXPR_SLASH`

  Expression for A/B.

`RASQAL_EXPR_REM`

  Expression for A/B remainder.

`RASQAL_EXPR_STR_EQ`

  Expression for A string equals B.

`RASQAL_EXPR_STR_NEQ`

  Expression for A string not-equals B.

`RASQAL_EXPR_STR_MATCH`

  Expression for string A matches literal regex B with flags.

`RASQAL_EXPR_STR_NMATCH`

  Expression for string A not-matches literal regex B with flags.

`RASQAL_EXPR_TILDE`

  Expression for binary not A.

`RASQAL_EXPR_BANG`

  Expression for logical not A.

`RASQAL_EXPR_LITERAL`

  Expression for a rasqal_literal.

`RASQAL_EXPR_FUNCTION`

  Expression for a function A with arguments (B...).

`RASQAL_EXPR_BOUND`

  Expression for SPARQL ISBOUND(A).

`RASQAL_EXPR_STR`

  Expression for SPARQL STR(A).

`RASQAL_EXPR_LANG`

  Expression for SPARQL LANG(A).

`RASQAL_EXPR_DATATYPE`

  Expression for SPARQL DATATYPE(A).

`RASQAL_EXPR_ISURI`

  Expression for SPARQL ISURI(A).

`RASQAL_EXPR_ISBLANK`

  Expression for SPARQL ISBLANK(A).

`RASQAL_EXPR_ISLITERAL`

  Expression for SPARQL ISLITERAL(A).

`RASQAL_EXPR_CAST`

  Expression for cast literal A to type B.

`RASQAL_EXPR_ORDER_COND_ASC`

  Expression for SPARQL order condition ascending.

`RASQAL_EXPR_ORDER_COND_DESC`

  Expression for SPARQL order condition descending.

`RASQAL_EXPR_LANGMATCHES`

  Expression for SPARQL LANGMATCHES(A, B).

`RASQAL_EXPR_REGEX`

  Expression for string A matches expression regex B with flags.

`RASQAL_EXPR_GROUP_COND_ASC`

  Expression for LAQRS group condition ascending.

`RASQAL_EXPR_GROUP_COND_DESC`

  Expression for LAQRS group condition descending.

`RASQAL_EXPR_COUNT`

  Expression for LAQRS select `COUNT()`

`RASQAL_EXPR_VARSTAR`

  Expression for LAQRS select Variable *

`RASQAL_EXPR_SAMETERM`

  Expression for SPARQL sameTerm

`RASQAL_EXPR_LAST`

  Internal

### rasqal_expression

    typedef struct rasqal_expression_s rasqal_expression;

expression (arg1), unary op (arg1), binary op (arg1,arg2), literal or variable

### enum rasqal_triple_flags

    typedef enum {

      /* Not used - was only used internally in the execution engine */
      RASQAL_TRIPLE_FLAGS_EXACT=1,

      /* Not used - this is now a property of a graph pattern */
      RASQAL_TRIPLE_FLAGS_OPTIONAL=2,

      RASQAL_TRIPLE_FLAGS_LAST=RASQAL_TRIPLE_FLAGS_OPTIONAL
    } rasqal_triple_flags;

Flags for triple patterns.

`RASQAL_TRIPLE_FLAGS_EXACT`

  Not used.

`RASQAL_TRIPLE_FLAGS_OPTIONAL`

  Not used.

`RASQAL_TRIPLE_FLAGS_LAST`

  Internal.

### rasqal_triple

    typedef struct {
      rasqal_literal* subject;
      rasqal_literal* predicate;
      rasqal_literal* object;
      rasqal_literal* origin;
      unsigned int flags;
    } rasqal_triple;

A triple pattern or RDF triple.

This is used as a triple pattern in queries and an RDF triple when generating RDF triples such as with SPARQL CONSTRUCT.

rasqal_literal *subject;

  Triple subject.

rasqal_literal *predicate;

  Triple predicate.

rasqal_literal *object;

  Triple object.

rasqal_literal *origin;

  Triple origin.

unsigned int flags;

  Or of enum rasqal_triple_flags bits.

### enum rasqal_pattern_flags

    typedef enum {
      RASQAL_PATTERN_FLAGS_OPTIONAL=1,

      RASQAL_PATTERN_FLAGS_LAST=RASQAL_PATTERN_FLAGS_OPTIONAL
    } rasqal_pattern_flags;

Flags for rasqal_graph_pattern.

`RASQAL_PATTERN_FLAGS_OPTIONAL`

  True when the graph pattern is an optional match.

`RASQAL_PATTERN_FLAGS_LAST`

  Internal

### enum rasqal_query_verb

    typedef enum {
      /* internal */
      RASQAL_QUERY_VERB_UNKNOWN   = 0,
      RASQAL_QUERY_VERB_SELECT    = 1,
      RASQAL_QUERY_VERB_CONSTRUCT = 2,
      RASQAL_QUERY_VERB_DESCRIBE  = 3,
      RASQAL_QUERY_VERB_ASK       = 4,
      RASQAL_QUERY_VERB_DELETE    = 5,
      RASQAL_QUERY_VERB_INSERT    = 6,

      /* internal */
      RASQAL_QUERY_VERB_LAST=RASQAL_QUERY_VERB_INSERT
    } rasqal_query_verb;

Query main operation verbs describing the major type of query being performed.

`RASQAL_QUERY_VERB_UNKNOWN`

  Internal

`RASQAL_QUERY_VERB_SELECT`

  RDQL/SPARQL query select verb.

`RASQAL_QUERY_VERB_CONSTRUCT`

  SPARQL query construct verb.

`RASQAL_QUERY_VERB_DESCRIBE`

  SPARQL query describe verb.

`RASQAL_QUERY_VERB_ASK`

  SPARQL query ask verb.

`RASQAL_QUERY_VERB_DELETE`

  LAQRS query delete verb.

`RASQAL_QUERY_VERB_INSERT`

  LAQRS query insert verb.

`RASQAL_QUERY_VERB_LAST`

  Internal

### enum rasqal_graph_pattern_operator

    typedef enum {
      RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN   = 0,
      RASQAL_GRAPH_PATTERN_OPERATOR_BASIC     = 1,
      RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL  = 2,
      RASQAL_GRAPH_PATTERN_OPERATOR_UNION     = 3,
      RASQAL_GRAPH_PATTERN_OPERATOR_GROUP     = 4,
      RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH     = 5,

      RASQAL_GRAPH_PATTERN_OPERATOR_LAST=RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH
    } rasqal_graph_pattern_operator;

Graph pattern operators

`RASQAL_GRAPH_PATTERN_OPERATOR_UNKNOWN`

  Internal.

`RASQAL_GRAPH_PATTERN_OPERATOR_BASIC`

  Just triple patterns and constraints.

`RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL`

  Set of graph patterns (ANDed) and constraints.

`RASQAL_GRAPH_PATTERN_OPERATOR_UNION`

  Set of graph patterns (UNIONed) and constraints.

`RASQAL_GRAPH_PATTERN_OPERATOR_GROUP`

  Set of graph patterns (ANDed) and constraints.

`RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH`

  A graph term + a graph pattern and constraints.

`RASQAL_GRAPH_PATTERN_OPERATOR_LAST`

  Internal.

### rasqal_graph_pattern_visit_fn ()

    int                 (*rasqal_graph_pattern_visit_fn)    (rasqal_query *query,
                                                             rasqal_graph_pattern *gp,
                                                             void *user_data);

User function to visit an graph_pattern and operate on it with `rasqal_graph_pattern_visit()` or `rasqal_query_graph_pattern_visit()`

`query` :

  rasqal_query containing the graph pattern

`gp` :

  current graph_pattern

`user_data` :

  user data passed in

Returns :

  0 to truncate the visit

### rasqal_new_world ()

    rasqal_world*       rasqal_new_world                    (void);

Initialise the rasqal library.

Creates a rasqal_world object and initializes it.

The returned world object is used with subsequent rasqal API calls.

Returns :

  rasqal_world object or NULL on failure

### rasqal_free_world ()

    void                rasqal_free_world                   (rasqal_world *);

`Param1` :

### rasqal_features_enumerate ()

    int                 rasqal_features_enumerate           (const rasqal_feature feature,
                                                             const char **name,
                                                             raptor_uri **uri,
                                                             const char **label);

Get list of rasqal features.

If uri is not NULL, a pointer to a new raptor_uri is returned that must be freed by the caller with `raptor_free_uri()`.

`feature` :

  feature enumeration (0+)

`name` :

  pointer to store feature short name (or NULL)

`uri` :

  pointer to store feature URI (or NULL)

`label` :

  pointer to feature label (or NULL)

Returns :

  0 on success, <0 on failure, >0 if feature is unknown

### rasqal_get_feature_count ()

    unsigned int        rasqal_get_feature_count            (void);

Get the count of features defined.

This is prefered to the compile time-only symbol RASQAL_FEATURE_LAST and returns a count of the number of features which is RASQAL_FEATURE_LAST+1.

Returns :

  count of features in the rasqal_feature enumeration

### rasqal_feature_from_uri ()

    rasqal_feature      rasqal_feature_from_uri             (raptor_uri *uri);

Turn a feature URI into an feature enum.

The allowed feature URIs are available via `rasqal_features_enumerate()`.

`uri` :

  feature URI

Returns :

  < 0 if the feature is unknown

### rasqal_feature_value_type ()

    int                 rasqal_feature_value_type           (const rasqal_feature feature);

Get the type of a features.

The type of the `feature` is 0=integer , 1=string. Other values are undefined. Most features are integer values and use rasqal_query_set_feature `rasqal_query_get_feature()`

`feature` :

  rasqal query feature

Returns :

  the type of the feature or <0 if `feature` is unknown

### rasqal_languages_enumerate ()

    int                 rasqal_languages_enumerate          (rasqal_world *,
                                                             unsigned int counter,
                                                             const char **name,
                                                             const char **label,
                                                             unsigned char **uri_string);

Get information on query languages.

`Param1` :

`counter` :

  index into the list of syntaxes

`name` :

  pointer to store the name of the syntax (or NULL)

`label` :

  pointer to store syntax readable label (or NULL)

`uri_string` :

  pointer to store syntax URI string (or NULL)

Returns :

  non 0 on failure of if counter is out of range

### rasqal_language_name_check ()

    int                 rasqal_language_name_check          (rasqal_world *,
                                                             const char *name);

Check name of a query language.

`Param1` :

`name` :

  the query language name

Returns :

  non 0 if name is a known query language

### rasqal_new_query ()

    rasqal_query*       rasqal_new_query                    (rasqal_world *,
                                                             const char *name,
                                                             unsigned char *uri);

Constructor - create a new rasqal_query object.

A query language can be named or identified by a URI, either of which is optional. The default query language will be used if both are NULL. rasqal_languages_enumerate returns information on the known names, labels and URIs.

`Param1` :

`name` :

  the query language name (or NULL)

`uri` :

  raptor_uri language uri (or NULL)

Returns :

  a new rasqal_query object or NULL on failure

### rasqal_free_query ()

    void                rasqal_free_query                   (rasqal_query *query);

Destructor - destroy a rasqal_query object.

`query` :

  rasqal_query object

### rasqal_query_get_name ()

    const char*         rasqal_query_get_name               (rasqal_query *query);

Get a short name for the query language.

`query` :

  rasqal_query query object

Returns :

  shared string label value

### rasqal_query_get_label ()

    const char*         rasqal_query_get_label              (rasqal_query *query);

Get a readable label for the query language.

`query` :

  rasqal_query query object

Returns :

  shared string label value

### rasqal_query_set_fatal_error_handler ()

    void                rasqal_query_set_fatal_error_handler
                                                            (rasqal_query *query,
                                                             void *user_data,
                                                             raptor_message_handler handler);

Set the query error handling function.

The function will receive callbacks when the query fails.

`query` :

  the query

`user_data` :

  user data to pass to function

`handler` :

  pointer to the function

### rasqal_query_set_error_handler ()

    void                rasqal_query_set_error_handler      (rasqal_query *query,
                                                             void *user_data,
                                                             raptor_message_handler handler);

Set the query error handling function.

The function will receive callbacks when the query fails.

`query` :

  the query

`user_data` :

  user data to pass to function

`handler` :

  pointer to the function

### rasqal_query_set_warning_handler ()

    void                rasqal_query_set_warning_handler    (rasqal_query *query,
                                                             void *user_data,
                                                             raptor_message_handler handler);

Set the query warning handling function.

The function will receive callbacks when the query gives a warning.

`query` :

  the query

`user_data` :

  user data to pass to function

`handler` :

  pointer to the function

### rasqal_query_set_feature ()

    int                 rasqal_query_set_feature            (rasqal_query *query,
                                                             rasqal_feature feature,
                                                             int value);

Set various query features.

The allowed features are available via `rasqal_features_enumerate()`.

`query` :

  rasqal_query query object

`feature` :

  feature to set from enumerated rasqal_feature values

`value` :

  integer feature value

Returns :

  non 0 on failure or if the feature is unknown

### rasqal_query_set_feature_string ()

    int                 rasqal_query_set_feature_string     (rasqal_query *query,
                                                             rasqal_feature feature,
                                                             unsigned char *value);

Set query features with string values.

The allowed features are available via `rasqal_features_enumerate()`. If the feature type is integer, the value is interpreted as an integer.

`query` :

  rasqal_query query object

`feature` :

  feature to set from enumerated rasqal_feature values

`value` :

  feature value

Returns :

  non 0 on failure or if the feature is unknown

### rasqal_query_get_feature ()

    int                 rasqal_query_get_feature            (rasqal_query *query,
                                                             rasqal_feature feature);

Get various query features.

The allowed features are available via `rasqal_features_enumerate()`.

Note: no feature value is negative

`query` :

  rasqal_query query object

`feature` :

  feature to get value

Returns :

  feature value or < 0 for an illegal feature

### rasqal_query_get_feature_string ()

    const unsigned char* rasqal_query_get_feature_string    (rasqal_query *query,
                                                             rasqal_feature feature);

Get query features with string values.

The allowed features are available via `rasqal_features_enumerate()`. If a string is returned, it must be freed by the caller.

`query` :

  rasqal_query query object

`feature` :

  feature to get value

Returns :

  feature value or NULL for an illegal feature or no value

### rasqal_query_set_default_generate_bnodeid_parameters ()

    void                rasqal_query_set_default_generate_bnodeid_parameters
                                                            (rasqal_query *rdf_query,
                                                             char *prefix,
                                                             int base);

Sets the parameters for the default algorithm used to generate blank node IDs. The default algorithm uses both `prefix` and `base` to generate a new identifier. The exact identifier generated is not guaranteed to be a strict concatenation of `prefix` and `base` but will use both parts.

For finer control of the generated identifiers, use `rasqal_set_default_generate_bnodeid_handler()`

If prefix is NULL, the default prefix is used (currently "bnodeid") If base is less than 1, it is initialised to 1.

`rdf_query` :

  rasqal_query object

`prefix` :

  prefix string

`base` :

  integer base identifier

### rasqal_query_set_generate_bnodeid_handler ()

    void                rasqal_query_set_generate_bnodeid_handler
                                                            (rasqal_query *query,
                                                             void *user_data,
                                                             rasqal_generate_bnodeid_handler handler);

Set the generate blank node ID handler function for the query.

Sets the function to generate blank node IDs for the query. The handler is called with a pointer to the rasqal_query, the `user_data` pointer and a user_bnodeid which is the value of a user-provided blank node identifier (may be NULL). It can either be returned directly as the generated value when present or modified. The passed in value must be `free()`d if it is not used.

If handler is NULL, the default method is used

`query` :

  rasqal_query query object

`user_data` :

  user data pointer for callback

`handler` :

  generate blank ID callback function

### rasqal_query_get_verb ()

    rasqal_query_verb   rasqal_query_get_verb               (rasqal_query *query);

Get the query verb.

`query` :

  rasqal_query

Returns :

  the operating verb of the query of type rasqal_query_verb

### rasqal_query_get_wildcard ()

    int                 rasqal_query_get_wildcard           (rasqal_query *query);

Get the query verb is wildcard flag.

`query` :

  rasqal_query

Returns :

  non-0 if the query verb was a wildcard (such as SELECT *)

### rasqal_query_get_distinct ()

    int                 rasqal_query_get_distinct           (rasqal_query *query);

Get the query distinct mode

See `rasqal_query_set_distinct()` for the distinct modes.

`query` :

  rasqal_query query object

Returns :

  non-0 if the results should be distinct

### rasqal_query_set_distinct ()

    void                rasqal_query_set_distinct           (rasqal_query *query,
                                                             int distinct_mode);

Set the query distinct results mode.

The allowed `distinct_mode` values are: 0 if not given 1 if DISTINCT: ensure solutions are unique 2 if SPARQL REDUCED: permit elimination of some non-unique solutions

`query` :

  rasqal_query query object

`distinct_mode` :

  distinct mode

### rasqal_query_get_explain ()

    int                 rasqal_query_get_explain            (rasqal_query *query);

Get the query explain results flag.

`query` :

  rasqal_query query object

Returns :

  non-0 if the results should be explain

### rasqal_query_set_explain ()

    void                rasqal_query_set_explain            (rasqal_query *query,
                                                             int is_explain);

Set the query explain results flag.

`query` :

  rasqal_query query object

`is_explain` :

  non-0 if explain

### rasqal_query_get_limit ()

    int                 rasqal_query_get_limit              (rasqal_query *query);

Get the query-specified limit on results.

This is the limit given in the query on the number of results allowed.

`query` :

  rasqal_query query object

Returns :

  integer >=0 if a limit is given, otherwise <0

### rasqal_query_set_limit ()

    void                rasqal_query_set_limit              (rasqal_query *query,
                                                             int limit);

Set the query-specified limit on results.

This is the limit given in the query on the number of results allowed.

`query` :

  rasqal_query query object

`limit` :

  the limit on results, >=0 to set a limit, <0 to have no limit

### rasqal_query_get_offset ()

    int                 rasqal_query_get_offset             (rasqal_query *query);

Get the query-specified offset on results.

This is the offset given in the query on the number of results allowed.

`query` :

  rasqal_query query object

Returns :

  integer >=0 if a offset is given, otherwise <0

### rasqal_query_set_offset ()

    void                rasqal_query_set_offset             (rasqal_query *query,
                                                             int offset);

Set the query-specified offset on results.

This is the offset given in the query on the number of results allowed.

`query` :

  rasqal_query query object

`offset` :

  offset for results, >=0 to set an offset, <0 to have no offset

### rasqal_query_add_data_graph ()

    int                 rasqal_query_add_data_graph         (rasqal_query *query,
                                                             raptor_uri *uri,
                                                             raptor_uri *name_uri,
                                                             int flags);

Add a data graph to the query.

named_uri must be given if flags RASQAL_DATA_GRAPH_NAMED is set. It is the name of the graph and also used as the base URI when resolving any relative URIs for the graph in uri.

`query` :

  rasqal_query query object

`uri` :

  raptor_uri source uri for retrieval

`name_uri` :

  raptor_uri name uri (or NULL)

`flags` :

  RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

Returns :

  non-0 on failure

### rasqal_query_get_data_graph_sequence ()

    raptor_sequence*    rasqal_query_get_data_graph_sequence
                                                            (rasqal_query *query);

Get the sequence of data_graph URIs.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of raptor_uri pointers.

### rasqal_query_get_data_graph ()

    rasqal_data_graph*  rasqal_query_get_data_graph         (rasqal_query *query,
                                                             int idx);

Get a rasqal_data_graph* in the sequence of data_graphs.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_data_graph pointer or NULL if out of the sequence range

### rasqal_query_add_variable ()

    int                 rasqal_query_add_variable           (rasqal_query *query,
                                                             rasqal_variable *var);

Add a binding variable to the query.

See also rasqal_query_set_variable which assigns or removes a value to a previously added variable in the query.

`query` :

  rasqal_query query object

`var` :

  rasqal_variable variable

Returns :

  non-0 on failure

### rasqal_query_get_bound_variable_sequence ()

    raptor_sequence*    rasqal_query_get_bound_variable_sequence
                                                            (rasqal_query *query);

Get the sequence of variables to bind in the query.

This returns the sequence of variables that are explicitly chosen via SELECT in RDQL, SPARQL. Or all variables mentioned with SELECT *

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_variable pointers.

### rasqal_query_get_anonymous_variable_sequence ()

    raptor_sequence*    rasqal_query_get_anonymous_variable_sequence
                                                            (rasqal_query *query);

Get the sequence of anonymous variables mentioned in the query.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_variable pointers.

### rasqal_query_get_all_variable_sequence ()

    raptor_sequence*    rasqal_query_get_all_variable_sequence
                                                            (rasqal_query *query);

Get the sequence of all variables mentioned in the query.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_variable pointers.

### rasqal_query_get_variable ()

    rasqal_variable*    rasqal_query_get_variable           (rasqal_query *query,
                                                             int idx);

Get a variable in the sequence of variables to bind.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_variable pointer or NULL if out of the sequence range

### rasqal_query_has_variable ()

    int                 rasqal_query_has_variable           (rasqal_query *query,
                                                             unsigned char *name);

Find if the named variable is in the sequence of variables to bind.

`query` :

  rasqal_query query object

`name` :

  variable name

Returns :

  non-0 if the variable name was found.

### rasqal_query_set_variable ()

    int                 rasqal_query_set_variable           (rasqal_query *query,
                                                             unsigned char *name,
                                                             rasqal_literal *value);

Add a binding variable to the query.

See also rasqal_query_add_variable which adds a new binding variable and must be called before this method is invoked.

`query` :

  rasqal_query query object

`name` :

  rasqal_variable variable

`value` :

  rasqal_literal value to set or NULL

Returns :

  non-0 on failure

### rasqal_query_get_triple_sequence ()

    raptor_sequence*    rasqal_query_get_triple_sequence    (rasqal_query *query);

Get the sequence of matching triples in the query.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_triple pointers.

### rasqal_query_get_triple ()

    rasqal_triple*      rasqal_query_get_triple             (rasqal_query *query,
                                                             int idx);

Get a triple in the sequence of matching triples in the query.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_triple pointer or NULL if out of the sequence range

### rasqal_query_add_prefix ()

    int                 rasqal_query_add_prefix             (rasqal_query *query,
                                                             rasqal_prefix *prefix);

Add a namespace prefix to the query.

If the prefix has already been used, the old URI will be overridden.

`query` :

  rasqal_query query object

`prefix` :

  rasqal_prefix namespace prefix, URI

Returns :

  non-0 on failure

### rasqal_query_get_prefix_sequence ()

    raptor_sequence*    rasqal_query_get_prefix_sequence    (rasqal_query *query);

Get the sequence of namespace prefixes in the query.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_prefix pointers.

### rasqal_query_get_prefix ()

    rasqal_prefix*      rasqal_query_get_prefix             (rasqal_query *query,
                                                             int idx);

Get a prefix in the sequence of namespsace prefixes in the query.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_prefix pointer or NULL if out of the sequence range

### rasqal_query_get_order_conditions_sequence ()

    raptor_sequence*    rasqal_query_get_order_conditions_sequence
                                                            (rasqal_query *query);

Get the sequence of query ordering conditions.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_expression pointers.

### rasqal_query_get_order_condition ()

    rasqal_expression*  rasqal_query_get_order_condition    (rasqal_query *query,
                                                             int idx);

Get a query ordering expression in the sequence of query ordering conditions.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_expression pointer or NULL if out of the sequence range

### rasqal_query_get_group_conditions_sequence ()

    raptor_sequence*    rasqal_query_get_group_conditions_sequence
                                                            (rasqal_query *query);

Get the sequence of query grouping conditions.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_expression pointers.

### rasqal_query_get_group_condition ()

    rasqal_expression*  rasqal_query_get_group_condition    (rasqal_query *query,
                                                             int idx);

Get a query grouping expression in the sequence of query grouping conditions.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_expression pointer or NULL if out of the sequence range

### rasqal_query_get_construct_triples_sequence ()

    raptor_sequence*    rasqal_query_get_construct_triples_sequence
                                                            (rasqal_query *query);

Get the sequence of triples for a construct.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_triple pointers.

### rasqal_query_get_construct_triple ()

    rasqal_triple*      rasqal_query_get_construct_triple   (rasqal_query *query,
                                                             int idx);

Get a triple in the sequence of construct triples.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_triple pointer or NULL if out of the sequence range

### rasqal_query_graph_pattern_visit ()

    void                rasqal_query_graph_pattern_visit    (rasqal_query *query,
                                                             rasqal_graph_pattern_visit_fn visit_fn,
                                                             void *data);

Visit all graph patterns in a query with a user function `visit_fn`.

See also `rasqal_graph_pattern_visit()`.

`query` :

  query

`visit_fn` :

  user function to operate on

`data` :

  user data to pass to function

### rasqal_query_write ()

    int                 rasqal_query_write                  (raptor_iostream *iostr,
                                                             rasqal_query *query,
                                                             raptor_uri *format_uri,
                                                             raptor_uri *base_uri);

Write a query to an iostream in a specified format.

The supported URIs for the format_uri are:

Default: SPARQL Query Language 2006-04-06 http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/

`iostr` :

  raptor_iostream to write the query to

`query` :

  rasqal_query pointer.

`format_uri` :

  raptor_uri describing the format to write (or NULL for default)

`base_uri` :

  raptor_uri base URI of the output format

Returns :

  non-0 on failure

### rasqal_query_get_query_graph_pattern ()

    rasqal_graph_pattern* rasqal_query_get_query_graph_pattern
                                                            (rasqal_query *query);

Get the top query graph pattern.

`query` :

  rasqal_query query object

Returns :

  a rasqal_graph_pattern of the top query graph pattern

### rasqal_query_get_graph_pattern_sequence ()

    raptor_sequence*    rasqal_query_get_graph_pattern_sequence
                                                            (rasqal_query *query);

Get the sequence of graph_patterns expressions inside the top query graph pattern.

`query` :

  rasqal_query query object

Returns :

  a raptor_sequence of rasqal_graph_pattern pointers.

### rasqal_query_get_graph_pattern ()

    rasqal_graph_pattern* rasqal_query_get_graph_pattern    (rasqal_query *query,
                                                             int idx);

Get a graph_pattern in the sequence of graph_pattern expressions in the top query graph pattern.

`query` :

  rasqal_query query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_graph_pattern pointer or NULL if out of the sequence range

### rasqal_graph_pattern_add_sub_graph_pattern ()

    int                 rasqal_graph_pattern_add_sub_graph_pattern
                                                            (rasqal_graph_pattern *graph_pattern,
                                                             rasqal_graph_pattern *sub_graph_pattern);

Add a sub graph pattern to a graph pattern.

`graph_pattern` :

  graph pattern to add to

`sub_graph_pattern` :

  graph pattern to add inside

Returns :

  non-0 on failure

### rasqal_graph_pattern_get_triple ()

    rasqal_triple*      rasqal_graph_pattern_get_triple     (rasqal_graph_pattern *graph_pattern,
                                                             int idx);

Get a triple inside a graph pattern.

`graph_pattern` :

  rasqal_graph_pattern graph pattern object

`idx` :

  index into the sequence of triples in the graph pattern

Returns :

  rasqal_triple or NULL if out of range

### rasqal_graph_pattern_get_sub_graph_pattern_sequence ()

    raptor_sequence*    rasqal_graph_pattern_get_sub_graph_pattern_sequence
                                                            (rasqal_graph_pattern *graph_pattern);

Get the sequence of graph patterns inside a graph pattern .

`graph_pattern` :

  rasqal_graph_pattern graph pattern object

Returns :

  a raptor_sequence of rasqal_graph_pattern pointers.

### rasqal_graph_pattern_get_sub_graph_pattern ()

    rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern
                                                            (rasqal_graph_pattern *graph_pattern,
                                                             int idx);

Get a sub-graph pattern inside a graph pattern.

`graph_pattern` :

  rasqal_graph_pattern graph pattern object

`idx` :

  index into the sequence of sub graph_patterns in the graph pattern

Returns :

  rasqal_graph_pattern or NULL if out of range

### rasqal_graph_pattern_get_operator ()

    rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator
                                                            (rasqal_graph_pattern *graph_pattern);

Get the graph pattern operator .

The operator for the given graph pattern. See also `rasqal_graph_pattern_operator_as_string()`.

`graph_pattern` :

  rasqal_graph_pattern graph pattern object

Returns :

  graph pattern operator

### rasqal_graph_pattern_operator_as_string ()

    const char*         rasqal_graph_pattern_operator_as_string
                                                            (rasqal_graph_pattern_operator op);

Get a string for the query verb.

`op` :

  the rasqal_graph_pattern_operator verb of the query

Returns :

  pointer to a shared string label for the query verb

### rasqal_graph_pattern_print ()

    void                rasqal_graph_pattern_print          (rasqal_graph_pattern *gp,
                                                             FILE *fh);

Print a rasqal_graph_pattern in a debug format.

The print debug format may change in any release.

`gp` :

  the rasqal_graph_pattern object

`fh` :

  the FILE* handle to print to

### rasqal_graph_pattern_add_constraint ()

    int                 rasqal_graph_pattern_add_constraint (rasqal_graph_pattern *gp,
                                                             rasqal_expression *expr);

Add a constraint expression to the graph_pattern.

`gp` :

  rasqal_graph_pattern query object

`expr` :

  rasqal_expression expr - ownership taken

Returns :

  non-0 on failure

### rasqal_graph_pattern_get_constraint_sequence ()

    raptor_sequence*    rasqal_graph_pattern_get_constraint_sequence
                                                            (rasqal_graph_pattern *gp);

Get the sequence of constraints expressions in the query.

`gp` :

  rasqal_graph_pattern object

Returns :

  a raptor_sequence of rasqal_expression pointers.

### rasqal_graph_pattern_get_constraint ()

    rasqal_expression*  rasqal_graph_pattern_get_constraint (rasqal_graph_pattern *gp,
                                                             int idx);

Get a constraint in the sequence of constraint expressions in the query.

`gp` :

  rasqal_graph_pattern query object

`idx` :

  index into the sequence (0 or larger)

Returns :

  a rasqal_expression pointer or NULL if out of the sequence range

### rasqal_graph_pattern_visit ()

    int                 rasqal_graph_pattern_visit          (rasqal_query *query,
                                                             rasqal_graph_pattern *gp,
                                                             rasqal_graph_pattern_visit_fn fn,
                                                             void *user_data);

Visit a user function over a rasqal_graph_pattern

If the user function `fn` returns 0, the visit is truncated.

`query` :

  rasqal_query to operate on

`gp` :

  rasqal_graph_pattern graph pattern

`fn` :

  pointer to function to apply that takes user data and graph pattern parameters

`user_data` :

  user data for applied function

Returns :

  0 if the visit was truncated.

### rasqal_graph_pattern_get_index ()

    int                 rasqal_graph_pattern_get_index      (rasqal_graph_pattern *gp);

Get the graph pattern absolute index in the array of graph patterns.

The graph pattern index is assigned when `rasqal_query_prepare()` is run on a query containing a graph pattern.

`gp` :

  rasqal_graph_pattern graph pattern

Returns :

  index or <0 if no index has been assigned yet

### rasqal_query_verb_as_string ()

    const char*         rasqal_query_verb_as_string         (rasqal_query_verb verb);

Get a string for the query verb.

`verb` :

  the rasqal_query_verb verb of the query

Returns :

  pointer to a shared string label for the query verb

### rasqal_query_print ()

    void                rasqal_query_print                  (rasqal_query *query,
                                                             FILE *fh);

Print a query in a debug format.

`query` :

  the rasqal_query object

`fh` :

  the FILE* handle to print to.

### rasqal_query_prepare ()

    int                 rasqal_query_prepare                (rasqal_query *query,
                                                             unsigned char *query_string,
                                                             raptor_uri *base_uri);

Prepare a query - typically parse it.

Some query languages may require a base URI to resolve any relative URIs in the query string. If this is not given, the current directory in the filesystem is used as the base URI.

The query string may be NULL in which case it is not parsed and the query parts may be created by API calls such as rasqal_query_add_source etc.

`query` :

  the rasqal_query object

`query_string` :

  the query string (or NULL)

`base_uri` :

  base URI of query string (optional)

Returns :

  non-0 on failure.

### rasqal_query_execute ()

    rasqal_query_results* rasqal_query_execute              (rasqal_query *query);

Excute a query - run and return results.

`query` :

  the rasqal_query object

Returns :

  a rasqal_query_results structure or NULL on failure.

### rasqal_query_get_user_data ()

    void*               rasqal_query_get_user_data          (rasqal_query *query);

Get query user data.

`query` :

  rasqal_query

Returns :

  user data as set by rasqal_query_set_user_data

### rasqal_query_set_user_data ()

    void                rasqal_query_set_user_data          (rasqal_query *query,
                                                             void *user_data);

Set the query user data.

`query` :

  rasqal_query

`user_data` :

  some user data to associate with the query

### rasqal_free_query_results ()

    void                rasqal_free_query_results           (rasqal_query_results *query_results);

Destructor - destroy a rasqal_query_results.

`query_results` :

  rasqal_query_results object

### rasqal_query_results_is_bindings ()

    int                 rasqal_query_results_is_bindings    (rasqal_query_results *query_results);

Test if rasqal_query_results is variable bindings format.

`query_results` :

  rasqal_query_results object

Returns :

  non-0 if true

### rasqal_query_results_get_count ()

    int                 rasqal_query_results_get_count      (rasqal_query_results *query_results);

Get number of bindings so far.

`query_results` :

  rasqal_query_results query_results

Returns :

  number of bindings found so far or < 0 on failure

### rasqal_query_results_next ()

    int                 rasqal_query_results_next           (rasqal_query_results *query_results);

Move to the next result.

`query_results` :

  rasqal_query_results query_results

Returns :

  non-0 if failed or results exhausted

### rasqal_query_results_finished ()

    int                 rasqal_query_results_finished       (rasqal_query_results *query_results);

Find out if binding results are exhausted.

`query_results` :

  rasqal_query_results query_results

Returns :

  non-0 if results are finished or query failed

### rasqal_query_results_get_bindings ()

    int                 rasqal_query_results_get_bindings   (rasqal_query_results *query_results,
                                                             unsigned char ***names,
                                                             rasqal_literal ***values);

Get all binding names, values for current result.

If names is not NULL, it is set to the address of a shared array of names of the bindings (an output parameter). These names are shared and must not be freed by the caller

If values is not NULL, it is set to the address of a shared array of rasqal_literal* binding values. These values are shaerd and must not be freed by the caller.

`query_results` :

  rasqal_query_results query_results

`names` :

  pointer to an array of binding names (or NULL)

`values` :

  pointer to an array of binding value rasqal_literal (or NULL)

Returns :

  non-0 if the assignment failed

### rasqal_query_results_get_binding_value ()

    rasqal_literal*     rasqal_query_results_get_binding_value
                                                            (rasqal_query_results *query_results,
                                                             int offset);

Get one binding value for the current result.

`query_results` :

  rasqal_query_results query_results

`offset` :

  offset of binding name into array of known names

Returns :

  a pointer to a shared rasqal_literal binding value or NULL on failure

### rasqal_query_results_get_binding_name ()

    const unsigned char* rasqal_query_results_get_binding_name
                                                            (rasqal_query_results *query_results,
                                                             int offset);

Get binding name for the current result.

`query_results` :

  rasqal_query_results query_results

`offset` :

  offset of binding name into array of known names

Returns :

  a pointer to a shared copy of the binding name or NULL on failure

### rasqal_query_results_get_binding_value_by_name ()

    rasqal_literal*     rasqal_query_results_get_binding_value_by_name
                                                            (rasqal_query_results *query_results,
                                                             unsigned char *name);

Get one binding value for a given name in the current result.

`query_results` :

  rasqal_query_results query_results

`name` :

  variable name

Returns :

  a pointer to a shared rasqal_literal binding value or NULL on failure

### rasqal_query_results_get_bindings_count ()

    int                 rasqal_query_results_get_bindings_count
                                                            (rasqal_query_results *query_results);

Get the number of bound variables in the result.

`query_results` :

  rasqal_query_results query_results

Returns :

  <0 if failed or results exhausted

### rasqal_query_results_is_boolean ()

    int                 rasqal_query_results_is_boolean     (rasqal_query_results *query_results);

Test if rasqal_query_results is boolean format.

`query_results` :

  rasqal_query_results object

Returns :

  non-0 if true

### rasqal_query_results_get_boolean ()

    int                 rasqal_query_results_get_boolean    (rasqal_query_results *query_results);

Get boolean query result.

The return value is only meaningful if this is a boolean query result - see `rasqal_query_results_is_boolean()`

`query_results` :

  rasqal_query_results query_results

Returns :

  boolean query result - >0 is true, 0 is false, <0 on error

### rasqal_query_results_is_graph ()

    int                 rasqal_query_results_is_graph       (rasqal_query_results *query_results);

Test if rasqal_query_results is RDF graph format.

`query_results` :

  rasqal_query_results object

Returns :

  non-0 if true

### rasqal_query_results_get_triple ()

    raptor_statement*   rasqal_query_results_get_triple     (rasqal_query_results *query_results);

Get the current triple in the result.

The return value is a shared raptor_statement.

`query_results` :

  rasqal_query_results query_results

Returns :

  raptor_statement or NULL if failed or results exhausted

### rasqal_query_results_next_triple ()

    int                 rasqal_query_results_next_triple    (rasqal_query_results *query_results);

Move to the next triple result.

`query_results` :

  rasqal_query_results query_results

Returns :

  non-0 if failed or results exhausted

### rasqal_query_results_is_syntax ()

    int                 rasqal_query_results_is_syntax      (rasqal_query_results *query_results);

Test if the rasqal_query_results is a syntax.

Many of the query results may be formatted as a syntax using the rasqal_query_formatter class however this function returns true if a syntax result was specifically requested.

`query_results` :

  rasqal_query_results object

Returns :

  non-0 if true

### rasqal_query_results_write ()

    int                 rasqal_query_results_write          (raptor_iostream *iostr,
                                                             rasqal_query_results *results,
                                                             raptor_uri *format_uri,
                                                             raptor_uri *base_uri);

Write the query results to an iostream in a format.

This uses the rasqal_query_results_formatter class and the `rasqal_query_results_formatter_write()` method to perform the formatting. See `rasqal_query_results_formats_enumerate()` for obtaining the supported format URIs at run time.

`iostr` :

  raptor_iostream to write the query to

`results` :

  rasqal_query_results query results format

`format_uri` :

  raptor_uri describing the format to write (or NULL for default)

`base_uri` :

  raptor_uri base URI of the output format

Returns :

  non-0 on failure

### rasqal_query_results_read ()

    int                 rasqal_query_results_read           (raptor_iostream *iostr,
                                                             rasqal_query_results *results,
                                                             raptor_uri *format_uri,
                                                             raptor_uri *base_uri);

Read the query results from an iostream in a format.

This uses the rasqal_query_results_formatter class and the `rasqal_query_results_formatter_read()` method to perform the formatting. See `rasqal_query_results_formats_enumerate()` for obtaining the supported format URIs at run time.

`iostr` :

  raptor_iostream to read the query from

`results` :

  rasqal_query_results query results format

`format_uri` :

  raptor_uri describing the format to read (or NULL for default)

`base_uri` :

  raptor_uri base URI of the input format

Returns :

  non-0 on failure

### RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER

    #define RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER 1

Flag for `rasqal_query_results_formats_enumerate()` to get query results formats that can be read.

### RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER

    #define RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER 2

Flag for `rasqal_query_results_formats_enumerate()` to get query results formats that can be written.

### rasqal_query_results_formats_enumerate ()

    int                 rasqal_query_results_formats_enumerate
                                                            (rasqal_world *,
                                                             unsigned int counter,
                                                             const char **name,
                                                             const char **label,
                                                             unsigned char **uri_string,
                                                             const char **mime_type,
                                                             int *flags);

Get information on query result syntaxes.

The current list of format names/URI is given below however the results of this function will always return the latest.

SPARQL XML Results 2007-06-14 (default format when `counter` is 0) name '`xml`' with URIs http://www.w3.org/TR/2006/WD-rdf-sparql-XMLres-20070614/ or http://www.w3.org/2005/sparql-results#

JSON name '`json`' and URI http://www.w3.org/2001/sw/DataAccess/json-sparql/

All returned strings are shared and must be copied if needed to be used dynamically.

`Param1` :

`counter` :

  index into the list of query result syntaxes

`name` :

  pointer to store the name of the query result syntax (or NULL)

`label` :

  pointer to store query result syntax readable label (or NULL)

`uri_string` :

  pointer to store query result syntax URI string (or NULL)

`mime_type` :

  pointer to store query result syntax mime type string (or NULL)

`flags` :

  pointer to store query result syntax flags (or NULL)

Returns :

  non 0 on failure of if counter is out of range

### rasqal_query_results_formats_check ()

    int                 rasqal_query_results_formats_check  (rasqal_world *,
                                                             const char *name,
                                                             raptor_uri *uri,
                                                             const char *mime_type);

Check if a query results formatter exists for the requested format.

`Param1` :

`name` :

  the query results format name (or NULL)

`uri` :

  raptor_uri query results format uri (or NULL)

`mime_type` :

  mime type name

Returns :

  non-0 if a formatter exists.

### rasqal_new_query_results_formatter ()

    rasqal_query_results_formatter* rasqal_new_query_results_formatter
                                                            (rasqal_world *,
                                                             const char *name,
                                                             raptor_uri *format_uri);

Constructor - create a new rasqal_query_results_formatter object by identified format.

A query results format can be named or identified by a URI, both of which are optional. The default query results format will be used if both are NULL. `rasqal_query_results_formats_enumerate()` returns information on the known query results names, labels and URIs.

`Param1` :

`name` :

  the query results format name (or NULL)

`format_uri` :

  raptor_uri query results format uri (or NULL)

Returns :

  a new rasqal_query_results_formatter object or NULL on failure

### rasqal_new_query_results_formatter_by_mime_type ()

    rasqal_query_results_formatter* rasqal_new_query_results_formatter_by_mime_type
                                                            (rasqal_world *,
                                                             const char *mime_type);

Constructor - create a new rasqal_query_results_formatter object by mime type.

A query results format generates a syntax with a mime type which may be requested with this constructor.

Note that there may be several formatters that generate the same MIME Type (such as SPARQL XML results format drafts) and in thot case the `rasqal_new_query_results_formatter()` constructor allows selecting of a specific one by name or URI.

`Param1` :

`mime_type` :

  mime type name

Returns :

  a new rasqal_query_results_formatter object or NULL on failure

### rasqal_free_query_results_formatter ()

    void                rasqal_free_query_results_formatter (rasqal_query_results_formatter *formatter);

Destructor - destroy a rasqal_query_results_formatter object.

`formatter` :

  rasqal_query_results_formatter object

### rasqal_query_results_formatter_write ()

    int                 rasqal_query_results_formatter_write
                                                            (raptor_iostream *iostr,
                                                             rasqal_query_results_formatter *formatter,
                                                             rasqal_query_results *results,
                                                             raptor_uri *base_uri);

Write the query results using the given formatter to an iostream

See `rasqal_query_results_formats_enumerate()` to get the list of syntax URIs and their description.

`iostr` :

  raptor_iostream to write the query to

`formatter` :

  rasqal_query_results_formatter object

`results` :

  rasqal_query_results query results format

`base_uri` :

  raptor_uri base URI of the output format

Returns :

  non-0 on failure

### rasqal_query_results_formatter_read ()

    int                 rasqal_query_results_formatter_read (rasqal_world *,
                                                             raptor_iostream *iostr,
                                                             rasqal_query_results_formatter *formatter,
                                                             rasqal_query_results *results,
                                                             raptor_uri *base_uri);

Read the query results using the given formatter from an iostream

See `rasqal_query_results_formats_enumerate()` to get the list of syntax URIs and their description.

`Param1` :

`iostr` :

  raptor_iostream to read the query from

`formatter` :

  rasqal_query_results_formatter object

`results` :

  rasqal_query_results query results format

`base_uri` :

  raptor_uri base URI of the input format

Returns :

  non-0 on failure

### rasqal_query_results_formatter_get_mime_type ()

    const char*         rasqal_query_results_formatter_get_mime_type
                                                            (rasqal_query_results_formatter *formatter);

Get the mime type of the syntax being formatted.

`formatter` :

  rasqal_query_results_formatter object

Returns :

  a shared mime type string

### rasqal_query_iostream_write_escaped_counted_string ()

    int                 rasqal_query_iostream_write_escaped_counted_string
                                                            (rasqal_query *query,
                                                             raptor_iostream *iostr,
                                                             unsigned char *string,
                                                             size_t len);

Write a string to an iostream in escaped form suitable for the query string.

`query` :

  rasqal_query object

`iostr` :

  raptor_iostream to write the escaped string to

`string` :

  string to escape

`len` :

  Length of string to escape

Returns :

  non-0 on failure

### rasqal_query_escape_counted_string ()

    unsigned char*      rasqal_query_escape_counted_string  (rasqal_query *query,
                                                             unsigned char *string,
                                                             size_t len,
                                                             size_t *output_len_p);

Convert a string into an escaped form suitable for the query string.

The returned string must be freed by the caller with `rasqal_free_memory()`

`query` :

  rasqal_query object

`string` :

  string to escape

`len` :

  Length of string to escape

`output_len_p` :

  Pointer to store length of output string (or NULL)

Returns :

  the escaped string or NULL on failure.

### rasqal_new_data_graph ()

    rasqal_data_graph*  rasqal_new_data_graph               (raptor_uri *uri,
                                                             raptor_uri *name_uri,
                                                             int flags);

Constructor - create a new rasqal_data_graph.

The name_uri is only used when the flags are `RASQAL_DATA_GRAPH_NAMED`.

`uri` :

  source URI

`name_uri` :

  name of graph (or NULL)

`flags` :

  `RASQAL_DATA_GRAPH_NAMED` or `RASQAL_DATA_GRAPH_BACKGROUND`

Returns :

  a new rasqal_data_graph or NULL on failure.

### rasqal_free_data_graph ()

    void                rasqal_free_data_graph              (rasqal_data_graph *dg);

Destructor - destroy a rasqal_data_graph object.

`dg` :

  rasqal_data_graph object

### rasqal_data_graph_print ()

    void                rasqal_data_graph_print             (rasqal_data_graph *dg,
                                                             FILE *fh);

Print a Rasqal data graph in a debug format.

The print debug format may change in any release.

`dg` :

  rasqal_data_graph object

`fh` :

  the FILE* handle to print to

### enum rasqal_compare_flags

    typedef enum {
      RASQAL_COMPARE_NOCASE = 1,
      RASQAL_COMPARE_XQUERY = 2,
      RASQAL_COMPARE_RDF    = 4,
      RASQAL_COMPARE_URI    = 8
    } rasqal_compare_flags;

Flags for `rasqal_expression_evaluate()` or `rasqal_literal_compare()`.

`RASQAL_COMPARE_NOCASE`

  String comparisons are case independent.

`RASQAL_COMPARE_XQUERY`

  XQuery comparsion rules apply.

`RASQAL_COMPARE_RDF`

  RDF Term comparsion rules apply.

`RASQAL_COMPARE_URI`

  Allow comparison of URIs

### rasqal_new_0op_expression ()

    rasqal_expression*  rasqal_new_0op_expression           (rasqal_op op);

Constructor - create a new 0-operand (constant) expression.

The operators are: `RASQAL_EXPR_VARSTAR`

The only operator here is the '*' in COUNT(*) as used by LAQRS.

`op` :

  Expression operator

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_1op_expression ()

    rasqal_expression*  rasqal_new_1op_expression           (rasqal_op op,
                                                             rasqal_expression *arg);

Constructor - create a new 1-operand expression. Takes ownership of the operand expression.

The operators are: `RASQAL_EXPR_TILDE` `RASQAL_EXPR_BANG` `RASQAL_EXPR_UMINUS` `RASQAL_EXPR_BOUND` `RASQAL_EXPR_STR` `RASQAL_EXPR_LANG` `RASQAL_EXPR_LANGMATCHES` `RASQAL_EXPR_DATATYPE` `RASQAL_EXPR_ISURI` `RASQAL_EXPR_ISBLANK` `RASQAL_EXPR_ISLITERAL` `RASQAL_EXPR_ORDER_COND_ASC` `RASQAL_EXPR_ORDER_COND_DESC` `RASQAL_EXPR_GROUP_COND_ASC` `RASQAL_EXPR_GROUP_COND_DESC` `RASQAL_EXPR_COUNT`

`RASQAL_EXPR_BANG` and `RASQAL_EXPR_UMINUS` are used by RDQL and SPARQL. `RASQAL_EXPR_TILDE` by RDQL only. The rest by SPARQL only.

`op` :

  Expression operator

`arg` :

  Operand 1

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_2op_expression ()

    rasqal_expression*  rasqal_new_2op_expression           (rasqal_op op,
                                                             rasqal_expression *arg1,
                                                             rasqal_expression *arg2);

Constructor - create a new 2-operand expression. Takes ownership of the operand expressions.

The operators are: `RASQAL_EXPR_AND` `RASQAL_EXPR_OR` `RASQAL_EXPR_EQ` `RASQAL_EXPR_NEQ` `RASQAL_EXPR_LT` `RASQAL_EXPR_GT` `RASQAL_EXPR_LE` `RASQAL_EXPR_GE` `RASQAL_EXPR_PLUS` `RASQAL_EXPR_MINUS` `RASQAL_EXPR_STAR` `RASQAL_EXPR_SLASH` `RASQAL_EXPR_REM` `RASQAL_EXPR_STR_EQ` `RASQAL_EXPR_STR_NEQ`

`RASQAL_EXPR_REM` `RASQAL_EXPR_STR_EQ` and `RASQAL_EXPR_STR_NEQ` are not used by SPARQL. `RASQAL_EXPR_REM` is used by RDQL.

`op` :

  Expression operator

`arg1` :

  Operand 1

`arg2` :

  Operand 2

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_3op_expression ()

    rasqal_expression*  rasqal_new_3op_expression           (rasqal_op op,
                                                             rasqal_expression *arg1,
                                                             rasqal_expression *arg2,
                                                             rasqal_expression *arg3);

Constructor - create a new 3-operand expression. Takes ownership of the operands.

The only operator is: `RASQAL_EXPR_REGEX`

`op` :

  Expression operator

`arg1` :

  Operand 1

`arg2` :

  Operand 2

`arg3` :

  Operand 3 (may be NULL)

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_string_op_expression ()

    rasqal_expression*  rasqal_new_string_op_expression     (rasqal_op op,
                                                             rasqal_expression *arg1,
                                                             rasqal_literal *literal);

Constructor - create a new expression with one expression and one string operand. Takes ownership of the operands.

The operators are: `RASQAL_EXPR_STR_MATCH` (RDQL, SPARQL) and `RASQAL_EXPR_STR_NMATCH` (RDQL)

`op` :

  Expression operator

`arg1` :

  Operand 1

`literal` :

  Literal operand 2

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_literal_expression ()

    rasqal_expression*  rasqal_new_literal_expression       (rasqal_literal *literal);

Constructor - create a new expression for a rasqal_literal Takes ownership of the operand literal.

`literal` :

  Literal operand 1

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_function_expression ()

    rasqal_expression*  rasqal_new_function_expression      (raptor_uri *name,
                                                             raptor_sequence *args);

Constructor - create a new expression for a function with expression arguments. Takes ownership of the function uri and arguments.

`name` :

  function name

`args` :

  sequence of rasqal_expression function arguments

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_cast_expression ()

    rasqal_expression*  rasqal_new_cast_expression          (raptor_uri *name,
                                                             rasqal_expression *value);

Constructor - create a new expression for casting and expression to a datatype. Takes ownership of the datatype uri and expression value.

`name` :

  cast datatype URI

`value` :

  expression value to cast to `datatype` type

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_new_expression_from_expression ()

    rasqal_expression*  rasqal_new_expression_from_expression
                                                            (rasqal_expression *e);

Copy Constructor - create a new rasqal_expression object from an existing rasqal_expression object.

`e` :

  rasqal_expression object to copy

Returns :

  a new rasqal_expression object or NULL on failure

### rasqal_free_expression ()

    void                rasqal_free_expression              (rasqal_expression *e);

Destructor - destroy a rasqal_expression object.

`e` :

  rasqal_expression object

### rasqal_expression_print_op ()

    void                rasqal_expression_print_op          (rasqal_expression *e,
                                                             FILE *fh);

Print a rasqal expression operator in a debug format.

The print debug format may change in any release.

`e` :

  the rasqal_expression object

`fh` :

  the FILE* handle to print to

### rasqal_expression_print ()

    void                rasqal_expression_print             (rasqal_expression *e,
                                                             FILE *fh);

Print a Rasqal expression in a debug format.

The print debug format may change in any release.

`e` :

  rasqal_expression object.

`fh` :

  The FILE* handle to print to.

### rasqal_expression_evaluate ()

    rasqal_literal*     rasqal_expression_evaluate          (rasqal_query *query,
                                                             rasqal_expression *e,
                                                             int flags);

Evaluate a rasqal_expression tree to give a rasqal_literal result or error.

`query` :

  rasqal_query this expression belongs to

`e` :

  The expression to evaluate.

`flags` :

  Flags for `rasqal_literal_compare()` and RASQAL_COMPARE_NOCASE for string matches.

Returns :

  a rasqal_literal value or NULL on failure.

### rasqal_expression_visit_fn ()

    int                 (*rasqal_expression_visit_fn)       (void *user_data,
                                                             rasqal_expression *e);

User function to visit an expression and operate on it with `rasqal_expression_visit()`

`user_data` :

  user data passed in with `rasqal_expression_visit()`

`e` :

  current expression

Returns :

  0 to truncate the visit

### rasqal_expression_visit ()

    int                 rasqal_expression_visit             (rasqal_expression *e,
                                                             rasqal_expression_visit_fn fn,
                                                             void *user_data);

Visit a user function over a rasqal_expression

If the user function `fn` returns 0, the visit is truncated.

`e` :

  rasqal_expression to visit

`fn` :

  visit function

`user_data` :

  user data to pass to visit function

Returns :

  0 if the visit was truncated.

### rasqal_new_integer_literal ()

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

Constructor - Create a new Rasqal integer literal.

The integer decimal number is turned into a rasqal integer literal and given a datatype of xsd:integer

`Param1` :

`type` :

  Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN

`integer` :

  int value

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_typed_literal ()

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

Constructor - Create a new Rasqal integer literal from a string

The integer decimal number is turned into a rasqal integer literal and given a datatype of xsd:integer

`Param1` :

`type` :

  Type of literal such as RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN

`string` :

  lexical form - ownership not taken

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_double_literal ()

    rasqal_literal*     rasqal_new_double_literal           (rasqal_world *,
                                                             double d);

Constructor - Create a new Rasqal double literal.

`Param1` :

`d` :

  double literal

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_float_literal ()

    rasqal_literal*     rasqal_new_float_literal            (rasqal_world *,
                                                             float f);

Constructor - Create a new Rasqal float literal.

`Param1` :

`f` :

  float literal

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_uri_literal ()

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

Constructor - Create a new Rasqal URI literal from a raptor URI.

The uri is an input parameter and is stored in the literal, not copied. The uri is freed also on failure.

`Param1` :

`uri` :

  raptor_uri uri

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_pattern_literal ()

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

Constructor - Create a new Rasqal pattern literal.

The pattern and flags are input parameters and are stored in the literal, not copied. They are freed also on failure. The set of flags recognised depends on the regex engine and the query language.

`Param1` :

`pattern` :

  regex pattern

`flags` :

  regex flags

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_string_literal ()

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

Constructor - Create a new Rasqal string literal.

All parameters are input parameters and if present are stored in the literal, not copied. They are freed also on failure.

The datatype and datatype_qname parameters are alternatives; the qname is a datatype that cannot be resolved till later since the prefixes have not yet been declared or checked.

If the string literal is datatyped and of certain types recognised it may be converted to a different literal type by `rasqal_literal_string_to_native()`

`Param1` :

`string` :

  UTF-8 string lexical form

`language` :

  RDF language (xml:lang) (or NULL)

`datatype` :

  datatype URI (or NULL for plain literal)

`datatype_qname` :

  datatype qname string (or NULL for plain literal)

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_simple_literal ()

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

Constructor - Create a new Rasqal simple literal.

The string is an input parameter and is stored in the literal, not copied. It is freed also on failure.

`Param1` :

`type` :

  RASQAL_LITERAL_BLANK or RASQAL_LITERAL_BLANK_QNAME

`string` :

  the UTF-8 string value to store

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_boolean_literal ()

    rasqal_literal*     rasqal_new_boolean_literal          (rasqal_world *,
                                                             int value);

Constructor - Create a new Rasqal boolean literal.

`Param1` :

`value` :

  non-0 for true, 0 for false

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_variable_literal ()

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

Constructor - Create a new Rasqal variable literal.

variable is an input parameter and stored in the literal, not copied.

`Param1` :

`variable` :

  rasqal_variable to use

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_decimal_literal ()

    rasqal_literal*     rasqal_new_decimal_literal          (rasqal_world *,
                                                             unsigned char *string);

Constructor - Create a new Rasqal decimal literal.

`Param1` :

`string` :

  decimal literal

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_decimal_literal_from_decimal ()

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

Constructor - Create a new Rasqal decimal literal.

`Param1` :

`string` :

  decimal literal string

`decimal` :

  rasqal XSD Decimal

Returns :

  New rasqal_literal or NULL on failure

### rasqal_new_literal_from_literal ()

    rasqal_literal*     rasqal_new_literal_from_literal     (rasqal_literal *l);

Copy Constructor - create a new rasqal_literal object from an existing rasqal_literal object.

`l` :

  rasqal_literal object to copy

Returns :

  a new rasqal_literal object or NULL

### rasqal_free_literal ()

    void                rasqal_free_literal                 (rasqal_literal *l);

Destructor - destroy an rasqal_literal object.

`l` :

  rasqal_literal object

### rasqal_literal_print ()

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

Print a Rasqal literal in a debug format.

The print debug format may change in any release.

`l` :

  the rasqal_literal object

`fh` :

  the FILE* handle to print to

### rasqal_literal_print_type ()

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

Print a string form for a rasqal literal type.

`l` :

  the rasqal_literal object

`fh` :

  the FILE* handle to print to

### rasqal_literal_as_variable ()

    rasqal_variable*    rasqal_literal_as_variable          (rasqal_literal *l);

Get the variable inside a literal.

`l` :

  rasqal_literal object

Returns :

  the rasqal_variable or NULL if the literal is not a variable

### rasqal_literal_as_string ()

    const unsigned char* rasqal_literal_as_string           (rasqal_literal *l);

Return the string format of a literal.

`l` :

  rasqal_literal object

Returns :

  pointer to a shared string format of the literal.

### rasqal_literal_as_string_flags ()

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

Return the string format of a literal according to flags.

flag bits affects conversion: RASQAL_COMPARE_XQUERY: use XQuery conversion rules

If `error` is not NULL, *error is set to non-0 on error

`l` :

  rasqal_literal object

`flags` :

  comparison flags

`error` :

  pointer to error

Returns :

  pointer to a shared string format of the literal.

### rasqal_literal_as_node ()

    rasqal_literal*     rasqal_literal_as_node              (rasqal_literal *l);

Turn a literal into a new RDF string, URI or blank literal.

`l` :

  rasqal_literal object

Returns :

  the new rasqal_literal or NULL on failure

### rasqal_literal_datatype ()

    raptor_uri*         rasqal_literal_datatype             (rasqal_literal *l);

Get the datatype URI of a literal

`l` :

  rasqal_literal object

Returns :

  shared pointer to raptor_uri of datatype or NULL on failure or no value

### rasqal_literal_value ()

    rasqal_literal*     rasqal_literal_value                (rasqal_literal *l);

Get the literal value looking up any variables needed

`l` :

  rasqal_literal object

Returns :

  literal value or NULL if has no value

### rasqal_literal_compare ()

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

Compare two literals with type promotion.

The two literals are compared across their range. If the types are not the same, they are promoted. If one is a double or float, the other is promoted to double, otherwise for integers, otherwise to strings (all literals have a string value).

The comparison returned is as for strcmp, first before second returns <0. equal returns 0, and first after second returns >0. For URIs, the string value is used for the comparsion.

flag bits affects comparisons: RASQAL_COMPARE_NOCASE: use case independent string comparisons RASQAL_COMPARE_XQUERY: use XQuery comparison and type promotion rules RASQAL_COMPARE_RDF: use RDF term comparison RASQAL_COMPARE_URI: allow comparison of URIs (typically for SPARQL ORDER)

If `error` is not NULL, *error is set to non-0 on error

`l1` :

  rasqal_literal first literal

`l2` :

  rasqal_literal second literal

`flags` :

  comparison flags

`error` :

  pointer to error

Returns :

  <0, 0, or >0 as described above.

### rasqal_literal_equals ()

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

Compare two literals with no type promotion.

If the l2 data literal value is a boolean, it will match the string "true" or "false" in the first literal l1.

`l1` :

  rasqal_literal literal

`l2` :

  rasqal_literal data literal

Returns :

  non-0 if equal

### rasqal_new_prefix ()

    rasqal_prefix*      rasqal_new_prefix                   (unsigned char *prefix,
                                                             raptor_uri *uri);

Constructor - create a new rasqal_prefix. Takes ownership of prefix and uri.

`prefix` :

  Short prefix string to stand for URI or NULL.

`uri` :

  Name raptor_uri.

Returns :

  a new rasqal_prefix or NULL on failure.

### rasqal_free_prefix ()

    void                rasqal_free_prefix                  (rasqal_prefix *p);

Destructor - destroy a rasqal_prefix object.

`p` :

  rasqal_prefix object.

### rasqal_prefix_print ()

    void                rasqal_prefix_print                 (rasqal_prefix *p,
                                                             FILE *fh);

Print a Rasqal prefix in a debug format.

The print debug format may change in any release.

`p` :

  rasqal_prefix object.

`fh` :

  The FILE* handle to print to.

### rasqal_new_triple ()

    rasqal_triple*      rasqal_new_triple                   (rasqal_literal *subject,
                                                             rasqal_literal *predicate,
                                                             rasqal_literal *object);

Constructor - create a new rasqal_triple triple or triple pattern. Takes ownership of the literals passed in.

The triple origin can be set with `rasqal_triple_set_origin()`.

`subject` :

  Triple subject.

`predicate` :

  Triple predicate.

`object` :

  Triple object.

Returns :

  a new rasqal_triple or NULL on failure.

### rasqal_new_triple_from_triple ()

    rasqal_triple*      rasqal_new_triple_from_triple       (rasqal_triple *t);

Copy constructor - create a new rasqal_triple from an existing one.

`t` :

  Triple to copy.

Returns :

  a new rasqal_triple or NULL on failure.

### rasqal_free_triple ()

    void                rasqal_free_triple                  (rasqal_triple *t);

Destructor - destroy a rasqal_triple object.

`t` :

  rasqal_triple object.

### rasqal_triple_print ()

    void                rasqal_triple_print                 (rasqal_triple *t,
                                                             FILE *fh);

Print a Rasqal triple in a debug format.

The print debug format may change in any release.

`t` :

  rasqal_triple object.

`fh` :

  The FILE* handle to print to.

### rasqal_triple_set_origin ()

    void                rasqal_triple_set_origin            (rasqal_triple *t,
                                                             rasqal_literal *l);

Set the origin field of a rasqal_triple.

`t` :

  The triple object.

`l` :

  The rasqal_literal object to set as origin.

### rasqal_triple_get_origin ()

    rasqal_literal*     rasqal_triple_get_origin            (rasqal_triple *t);

Get the origin field of a rasqal_triple.

`t` :

  The triple object.

Returns :

  The triple origin or NULL.

### rasqal_new_variable_typed ()

    rasqal_variable*    rasqal_new_variable_typed           (rasqal_query *rq,
                                                             rasqal_variable_type type,
                                                             unsigned char *name,
                                                             rasqal_literal *value);

Constructor - Create a new typed Rasqal variable.

The variable must be associated with a query, since variable names are only significant with a single query.

The `name` and `value` become owned by the rasqal_variable structure

`rq` :

  rasqal_query to associate the variable with

`type` :

  variable type defined by enumeration rasqal_variable_type

`name` :

  variable name

`value` :

  variable rasqal_literal value (or NULL)

Returns :

  a new rasqal_variable or NULL on failure.

### rasqal_new_variable ()

    rasqal_variable*    rasqal_new_variable                 (rasqal_query *rq,
                                                             unsigned char *name,
                                                             rasqal_literal *value);

Constructor - Create a new Rasqal normal variable.

The variable must be associated with a query, since variable names are only significant with a single query.

This creates a regular variable that can be returned of type RASQAL_VARIABLE_TYPE_NORMAL. Use rasqal_new_variable_typed to create other variables.

The `name` and `value` become owned by the rasqal_variable structure

`rq` :

  rasqal_query to associate the variable with

`name` :

  variable name

`value` :

  variable rasqal_literal value (or NULL)

Returns :

  a new rasqal_variable or NULL on failure.

### rasqal_new_variable_from_variable ()

    rasqal_variable*    rasqal_new_variable_from_variable   (rasqal_variable *v);

Copy Constructor - Create a new Rasqal variable from an existing one

This does a deep copy of all variable fields

`v` :

  rasqal_variable to copy

Returns :

  a new rasqal_variable or NULL on failure.

### rasqal_free_variable ()

    void                rasqal_free_variable                (rasqal_variable *v);

Destructor - Destroy a Rasqal variable object.

`v` :

  rasqal_variable object

### rasqal_variable_print ()

    void                rasqal_variable_print               (rasqal_variable *v,
                                                             FILE *fh);

Print a Rasqal variable in a debug format.

The print debug format may change in any release.

`v` :

  the rasqal_variable object

`fh` :

  the FILE* handle to print to

### rasqal_variable_set_value ()

    void                rasqal_variable_set_value           (rasqal_variable *v,
                                                             rasqal_literal *l);

Set the value of a Rasqal variable.

The variable value is an input parameter and is copied in, not shared. If the variable value is NULL, any existing value is deleted.

`v` :

  the rasqal_variable object

`l` :

  the rasqal_literal value to set (or NULL)

### rasqal_free_memory ()

    void                rasqal_free_memory                  (void *ptr);

Free memory allocated inside rasqal.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory allocated by rasqal to be freed.

`ptr` :

  memory pointer

### rasqal_alloc_memory ()

    void*               rasqal_alloc_memory                 (size_t size);

Allocate memory inside rasqal.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the rasqal shared library that can be freed inside rasqal either internally or via `rasqal_free_memory()`.

`size` :

  size of memory to allocate

Returns :

  the address of the allocated memory or NULL on failure

### rasqal_calloc_memory ()

    void*               rasqal_calloc_memory                (size_t nmemb,
                                                             size_t size);

Allocate zeroed array of items inside rasqal.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the rasqal shared library that can be freed inside rasqal either internally or via `rasqal_free_memory()`.

`nmemb` :

  number of members

`size` :

  size of item

Returns :

  the address of the allocated memory or NULL on failure

### rasqal_new_xsd_decimal ()

    rasqal_xsd_decimal* rasqal_new_xsd_decimal              (void);

Create a new XSD Decimal object.

Returns :

  new xsd:decimal object or NULL on failure.

### rasqal_free_xsd_decimal ()

    void                rasqal_free_xsd_decimal             (rasqal_xsd_decimal *dec);

Destroy XSD Decimal object.

`dec` :

  Decimal object

### rasqal_xsd_decimal_set_string ()

    int                 rasqal_xsd_decimal_set_string       (rasqal_xsd_decimal *dec,
                                                             const char *string);

Set an XSD Decimal value from a string lexical form

`dec` :

  XSD Decimal

`string` :

  lexical form

Returns :

  non-0 on failure

### rasqal_xsd_decimal_get_double ()

    double              rasqal_xsd_decimal_get_double       (rasqal_xsd_decimal *dec);

Get an XSD Decimal as a double (may lose precision)

`dec` :

  XSD Decimal

Returns :

  double value.

### rasqal_xsd_decimal_as_string ()

    char*               rasqal_xsd_decimal_as_string        (rasqal_xsd_decimal *dec);

Get an XSD Decimal as a string lexical form.

The returned string is shared and owned by the `dec` object and must be copied.

`dec` :

  XSD Decimal

Returns :

  lexical form string or NULL on failure.

### rasqal_xsd_decimal_as_counted_string ()

    char*               rasqal_xsd_decimal_as_counted_string
                                                            (rasqal_xsd_decimal *dec,
                                                             size_t *len_p);

Get an XSD Decimal as a string lexical form with optional length.

The returned string is shared and owned by the `dec` object and must be copied. If `len_p` is not NULL, the length of the returned string is stored.

`dec` :

  XSD Decimal

`len_p` :

  pointer to length variable (or NULL)

Returns :

  lexical form string or NULL on failure.

### rasqal_xsd_decimal_set_long ()

    int                 rasqal_xsd_decimal_set_long         (rasqal_xsd_decimal *dec,
                                                             long l );

Set an XSD Decimal value from a long.

`dec` :

  XSD Decimal

`Param2` :

Returns :

  non-0 on failure

### rasqal_xsd_decimal_set_double ()

    int                 rasqal_xsd_decimal_set_double       (rasqal_xsd_decimal *dec,
                                                             double d);

Set an XSD Decimal value from a double.

`dec` :

  XSD Decimal

`d` :

  double

Returns :

  non-0 on failure

### rasqal_xsd_decimal_print ()

    int                 rasqal_xsd_decimal_print            (rasqal_xsd_decimal *dec,
                                                             FILE *stream);

Write an XSD Decimal to a FILE* stream

`dec` :

  XSD Decimal

`stream` :

  FILE* stream

Returns :

  non-0 on failure

### rasqal_xsd_decimal_add ()

    int                 rasqal_xsd_decimal_add              (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);

Add two XSD Decimals and store in result XSD Decimal

`result` :

  result variable

`a` :

  argment decimal 1

`b` :

  argument decimal 2

Returns :

  non-0 on failure

### rasqal_xsd_decimal_subtract ()

    int                 rasqal_xsd_decimal_subtract         (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);

Subtract two XSD Decimals and store in result XSD Decimal

`result` :

  result variable

`a` :

  argment decimal 1

`b` :

  argument decimal 2

Returns :

  non-0 on failure

### rasqal_xsd_decimal_multiply ()

    int                 rasqal_xsd_decimal_multiply         (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);

Multiply two XSD Decimals and store in result XSD Decimal

`result` :

  result variable

`a` :

  argment decimal 1

`b` :

  argument decimal 2

Returns :

  non-0 on failure

### rasqal_xsd_decimal_divide ()

    int                 rasqal_xsd_decimal_divide           (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);

Divide two XSD Decimals and store in result XSD Decimal

If the divisor `b` is 0, failure is returned

`result` :

  result variable

`a` :

  argment decimal 1

`b` :

  argument decimal 2

Returns :

  non-0 on failure

### rasqal_xsd_decimal_negate ()

    int                 rasqal_xsd_decimal_negate           (rasqal_xsd_decimal *result,
                                                             rasqal_xsd_decimal *a);

Negate an XSD Decimal

`result` :

  result variable

`a` :

  argment decimal

Returns :

  non-0 on failure

### rasqal_xsd_decimal_compare ()

    int                 rasqal_xsd_decimal_compare          (rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);

Compare two XSD Decimals

`a` :

  first XSD decimal

`b` :

  second XSD decimal

Returns :

  <0 if `a` is less than `b`, 0 if equal, >1 otherwise

### rasqal_xsd_decimal_equals ()

    int                 rasqal_xsd_decimal_equals           (rasqal_xsd_decimal *a,
                                                             rasqal_xsd_decimal *b);

Compare two XSD Decimals for equality.

`a` :

  first XSD Decimal

`b` :

  second XSD Decimal

Returns :

  non-0 if equal.

### rasqal_xsd_decimal_is_zero ()

    int                 rasqal_xsd_decimal_is_zero          (rasqal_xsd_decimal *d);

Test if an XSD decimal is zero.

`d` :

  decimal

Returns :

  non-0 if decimal is zero

### enum rasqal_triple_parts

    typedef enum {
      RASQAL_TRIPLE_SUBJECT  = 1,
      RASQAL_TRIPLE_PREDICATE= 2,
      RASQAL_TRIPLE_OBJECT   = 4,
      RASQAL_TRIPLE_ORIGIN   = 8,
      RASQAL_TRIPLE_GRAPH    = RASQAL_TRIPLE_ORIGIN,
      RASQAL_TRIPLE_SPO      = RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT,
      RASQAL_TRIPLE_SPOG     = RASQAL_TRIPLE_SPO | RASQAL_TRIPLE_GRAPH
    } rasqal_triple_parts;

Flags for parts of a triple.

`RASQAL_TRIPLE_SUBJECT`

  Subject present in a triple.

`RASQAL_TRIPLE_PREDICATE`

  Predicate present in a triple.

`RASQAL_TRIPLE_OBJECT`

  Object present in a triple.

`RASQAL_TRIPLE_ORIGIN`

  Origin/graph present in a triple.

`RASQAL_TRIPLE_GRAPH`

  Alias for RASQAL_TRIPLE_ORIGIN

`RASQAL_TRIPLE_SPO`

  Subject, Predicate and Object present in a triple.

`RASQAL_TRIPLE_SPOG`

  Subject, Predicate, Object, Graph present in a triple.

### bind_match ()

    rasqal_triple_parts bind_match                          (struct rasqal_triples_match_s *,
                                                             void *user_data,
                                                             rasqal_variable *bindings[4],
                                                             rasqal_triple_parts parts);

`Param1` :

`user_data` :

`bindings` :

`parts` :

Returns :

### next_match ()

    void                next_match                          (struct rasqal_triples_match_s *,
                                                             void *user_data);

`Param1` :

`user_data` :

### is_end ()

    int                 is_end                              (struct rasqal_triples_match_s *,
                                                             void *user_data);

`Param1` :

`user_data` :

Returns :

### finish ()

    void                finish                              (struct rasqal_triples_match_s *,
                                                             void *user_data);

`Param1` :

`user_data` :

### rasqal_triples_match

    typedef struct rasqal_triples_match_s rasqal_triples_match;

Triples match structure as initialised by rasqal_triples_source method init_triples_match.

### rasqal_triple_meta

    typedef struct {
      /* triple (subject, predicate, object) and origin */
      rasqal_variable* bindings[4];

      rasqal_triples_match *triples_match;

      void *context;

      rasqal_triple_parts parts;

      /* non-0 if the associated triple pattern contains no variables */
      int is_exact;

      /* non-0 if the triple pattern has been fully executed */
      int executed;
    } rasqal_triple_meta;

Triple matching metadata for one triple pattern.

rasqal_variable *bindings[4];

  Variable bindings for this triple+origin to set.

rasqal_triples_match *triples_match;

  The matcher that is setting these bindings.

void *context;

  Context data used by the matcher.

rasqal_triple_parts parts;

  Parts of the triple to match/bindings to set.

int is_exact;

  non-0 if all parts of the triple are given

int executed;

### init_triples_match ()

    int                 init_triples_match                  (rasqal_triples_match *rtm,
                                                             struct rasqal_triples_source_s *rts,
                                                             void *user_data,
                                                             rasqal_triple_meta *m,
                                                             rasqal_triple *t);

`rtm` :

`rts` :

`user_data` :

`m` :

`t` :

Returns :

### triple_present ()

    int                 triple_present                      (struct rasqal_triples_source_s *rts,
                                                             void *user_data,
                                                             rasqal_triple *t);

`rts` :

`user_data` :

`t` :

Returns :

### free_triples_source ()

    void                free_triples_source                 (void *user_data);

`user_data` :

### rasqal_triples_source

    typedef struct rasqal_triples_source_s rasqal_triples_source;

Triples source as initialised by a rasqal_triples_source_factory.

### rasqal_triples_source_factory

    typedef struct {
      void *user_data;
      size_t user_data_size;

      int (*new_triples_source)(rasqal_query* query, void *factory_user_data, void *user_data, rasqal_triples_source* rts);
    } rasqal_triples_source_factory;

A factory that initialises rasqal_triples_source structures to returning matches to a triple pattern.

void *user_data;

  User data for triples_source_factory.

size_t user_data_size;

  Size Of `user_data` for new_triples_source.

new_triples_source ()

  Create a new triples source - returns non-zero on failure < 0 is a 'no rdf data error', > 0 is an unspecified error..

### rasqal_set_triples_source_factory ()

    void                rasqal_set_triples_source_factory   (rasqal_world *,
                                                             void (register_fnrasqal_triples_source_factory *factory) (),
                                                             void *user_data);

Register the factory to return triple sources.

Registers the factory that returns triples sources. Note that there is only one of these per runtime.

The rasqal_triples_source_factory factory method new_triples_source is called with the user data for some query and rasqal_triples_source.

`Param1` :

`register_fn` :

  registration function

`user_data` :

  user data for registration