![]() |
![]() |
![]() |
Rasqal RDF Query Library Manual | ![]() |
---|---|---|---|---|
typedef rasqal_query_results; void rasqal_free_query_results (rasqal_query_results *query_results); int rasqal_query_results_finished (rasqal_query_results *query_results); const unsigned char* rasqal_query_results_get_binding_name (rasqal_query_results *query_results, int offset); rasqal_literal* rasqal_query_results_get_binding_value (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 (rasqal_query_results *query_results, unsigned char ***names, rasqal_literal ***values); int rasqal_query_results_get_bindings_count (rasqal_query_results *query_results); int rasqal_query_results_get_boolean (rasqal_query_results *query_results); int rasqal_query_results_get_count (rasqal_query_results *query_results); raptor_statement* rasqal_query_results_get_triple (rasqal_query_results *query_results); int rasqal_query_results_is_bindings (rasqal_query_results *query_results); int rasqal_query_results_is_boolean (rasqal_query_results *query_results); int rasqal_query_results_is_graph (rasqal_query_results *query_results); int rasqal_query_results_is_syntax (rasqal_query_results *query_results); int rasqal_query_results_next (rasqal_query_results *query_results); int rasqal_query_results_next_triple (rasqal_query_results *query_results); int rasqal_query_results_read (raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri); int rasqal_query_results_write (raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri);
A query results object is only ever constructed by the internal
query engine evaluating a rasqal_query with rasqal_query_execute()
.
It provides interface to the multiple types of result supported.
There are a large set of methods for returning all or parts of a
variable binding query result including the names, values or
individuals. A boolean result is straightforward to get with
rasqal_query_results_get_boolean()
and an RDF graph returns a
sequence of raptor triples than can be easily passed to the Raptor
library for serializing to a syntax.
void rasqal_free_query_results (rasqal_query_results *query_results);
Destructor - destroy a rasqal_query_results.
|
rasqal_query_results object |
int rasqal_query_results_finished (rasqal_query_results *query_results);
Find out if binding results are exhausted.
|
rasqal_query_results query_results |
Returns : |
non-0 if results are finished or query failed |
const unsigned char* rasqal_query_results_get_binding_name (rasqal_query_results *query_results, int offset);
Get binding name for the current result.
|
rasqal_query_results query_results |
|
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_literal* rasqal_query_results_get_binding_value (rasqal_query_results *query_results, int offset);
Get one binding value for the current result.
|
rasqal_query_results query_results |
|
offset of binding name into array of known names |
Returns : |
a pointer to a shared rasqal_literal binding value or NULL on failure |
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.
|
rasqal_query_results query_results |
|
variable name |
Returns : |
a pointer to a shared rasqal_literal binding value or NULL on failure |
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.
|
rasqal_query_results query_results |
|
pointer to an array of binding names (or NULL) |
|
pointer to an array of binding value rasqal_literal (or NULL) |
Returns : |
non-0 if the assignment failed |
int rasqal_query_results_get_bindings_count (rasqal_query_results *query_results);
Get the number of bound variables in the result.
|
rasqal_query_results query_results |
Returns : |
<0 if failed or results exhausted |
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()
|
rasqal_query_results query_results |
Returns : |
boolean query result - >0 is true, 0 is false, <0 on error |
int rasqal_query_results_get_count (rasqal_query_results *query_results);
Get number of bindings so far.
|
rasqal_query_results query_results |
Returns : |
number of bindings found so far or < 0 on failure |
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.
|
rasqal_query_results query_results |
Returns : |
raptor_statement or NULL if failed or results exhausted |
int rasqal_query_results_is_bindings (rasqal_query_results *query_results);
Test if rasqal_query_results is variable bindings format.
|
rasqal_query_results object |
Returns : |
non-0 if true |
int rasqal_query_results_is_boolean (rasqal_query_results *query_results);
Test if rasqal_query_results is boolean format.
|
rasqal_query_results object |
Returns : |
non-0 if true |
int rasqal_query_results_is_graph (rasqal_query_results *query_results);
Test if rasqal_query_results is RDF graph format.
|
rasqal_query_results object |
Returns : |
non-0 if true |
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.
|
rasqal_query_results object |
Returns : |
non-0 if true |
int rasqal_query_results_next (rasqal_query_results *query_results);
Move to the next result.
|
rasqal_query_results query_results |
Returns : |
non-0 if failed or results exhausted |
int rasqal_query_results_next_triple (rasqal_query_results *query_results);
Move to the next triple result.
|
rasqal_query_results query_results |
Returns : |
non-0 if failed or results exhausted |
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.
|
raptor_iostream to read the query from |
|
rasqal_query_results query results format |
|
raptor_uri describing the format to read (or NULL for default) |
|
raptor_uri base URI of the input format |
Returns : |
non-0 on failure |
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.
|
raptor_iostream to write the query to |
|
rasqal_query_results query results format |
|
raptor_uri describing the format to write (or NULL for default) |
|
raptor_uri base URI of the output format |
Returns : |
non-0 on failure |