| Top |
This class provides the main interface to the library. A query can be constructed by parsing a string, retrieving it from a URI and/or constructing it via API methods to build the query expression.
The query structures can be read via methods to return
the query verb rasqal_query_get_verb(),
the rasqal_data_graph RDF data sources with rasqal_query_get_data_graph() etc.,
the rasqal_graph_pattern tree with rasqal_query_get_query_graph_pattern(),
the sequence of order conditions with rasqal_query_get_order_condition() etc.,
the rasqal_variable selected to return with
rasqal_query_get_bound_variable_sequence() or rasqal_query_get_all_variable_sequence(),
and so on.
To process a query string, the rasqal_query_prepare() method
parses the query string in some query language and initialises
the rasqal_query structures.
The query can be evaluated with the internal query engine against
some source of matches using rasqal_query_execute() to give an
rasqal_query_results. There are multiple forms of results that
can include variable bindings, a boolean or an RDF graph that
can be tested for with methods on rasqal_query_results and
then retrieved.
rasqal_query * rasqal_new_query (rasqal_world *world,const char *name,const char *uri);
int rasqal_query_add_data_graph (rasqal_query *query,rasqal_data_graph *data_graph);
int rasqal_query_add_data_graphs (rasqal_query *query,raptor_sequence *data_graphs);
int rasqal_query_add_prefix (rasqal_query *query,rasqal_prefix *prefix);
int rasqal_query_add_variable (rasqal_query *query,rasqal_variable *var);
int rasqal_query_dataset_contains_named_graph (rasqal_query *query,raptor_uri *graph_uri);
raptor_sequence *
rasqal_query_get_all_variable_sequence
(rasqal_query *query);
raptor_sequence *
rasqal_query_get_anonymous_variable_sequence
(rasqal_query *query);
rasqal_row * rasqal_query_get_bindings_row (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_bindings_rows_sequence
(rasqal_query *query);
rasqal_variable * rasqal_query_get_bindings_variable (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_bindings_variables_sequence
(rasqal_query *query);
raptor_sequence *
rasqal_query_get_bound_variable_sequence
(rasqal_query *query);
rasqal_triple * rasqal_query_get_construct_triple (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_construct_triples_sequence
(rasqal_query *query);
rasqal_data_graph * rasqal_query_get_data_graph (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_data_graph_sequence (rasqal_query *query);
raptor_sequence *
rasqal_query_get_describe_sequence (rasqal_query *query);
rasqal_expression * rasqal_query_get_group_condition (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_group_conditions_sequence
(rasqal_query *query);
rasqal_graph_pattern * rasqal_query_get_graph_pattern (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_graph_pattern_sequence
(rasqal_query *query);
rasqal_expression * rasqal_query_get_having_condition (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_having_conditions_sequence
(rasqal_query *query);
rasqal_expression * rasqal_query_get_order_condition (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_order_conditions_sequence
(rasqal_query *query);
raptor_sequence *
rasqal_query_get_prefix_sequence (rasqal_query *query);
rasqal_graph_pattern *
rasqal_query_get_query_graph_pattern (rasqal_query *query);
raptor_sequence *
rasqal_query_get_triple_sequence (rasqal_query *query);
rasqal_variable * rasqal_query_get_variable (rasqal_query *query,int idx);
int rasqal_query_has_variable2 (rasqal_query *query,rasqal_variable_type type,const char *name);
int rasqal_query_has_variable (rasqal_query *query,const char *name);
rasqal_query_has_variable is deprecated and should not be used in newly-written code.
int rasqal_query_prepare (rasqal_query *query,const char *query_string,raptor_uri *base_uri);
int rasqal_query_graph_pattern_visit2 (rasqal_query *query,rasqal_graph_pattern_visit_fn visit_fn,void *data);
void rasqal_query_graph_pattern_visit (rasqal_query *query,rasqal_graph_pattern_visit_fn visit_fn,void *data);
rasqal_query_graph_pattern_visit is deprecated and should not be used in newly-written code.
void rasqal_query_set_distinct (rasqal_query *query,int distinct_mode);
void rasqal_query_set_user_data (rasqal_query *query,void *user_data);
int rasqal_query_set_variable2 (rasqal_query *query,rasqal_variable_type type,const char *name,rasqal_literal *value);
int rasqal_query_set_variable (rasqal_query *query,const char *name,rasqal_literal *value);
rasqal_query_set_variable is deprecated and should not be used in newly-written code.
int rasqal_query_set_store_results (rasqal_query *query,int store_results);
int rasqal_query_write (raptor_iostream *iostr,rasqal_query *query,raptor_uri *format_uri,raptor_uri *base_uri);
int rasqal_query_iostream_write_escaped_counted_string (rasqal_query *query,raptor_iostream *iostr,const unsigned char *string,size_t len);
unsigned char * rasqal_query_escape_counted_string (rasqal_query *query,const char *string,size_t len,size_t *output_len_p);
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,const 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);
rasqal_query_results_type
rasqal_query_get_result_type (rasqal_query *query);
rasqal_update_operation * rasqal_query_get_update_operation (rasqal_query *query,int idx);
raptor_sequence *
rasqal_query_get_update_operations_sequence
(rasqal_query *query);
Query main operation verbs describing the major type of query being performed.