<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="rasqal-section-query">
<refmeta>
<refentrytitle role="top_of_page" id="rasqal-section-query.top_of_page">Query</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>RASQAL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Query</refname>
<refpurpose>Query object API, parsing and execution</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="rasqal-section-query.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
enum                <link linkend="rasqal-query-verb">rasqal_query_verb</link>;
typedef             <link linkend="rasqal-query">rasqal_query</link>;
<link linkend="rasqal-query">rasqal_query</link>*       <link linkend="rasqal-new-query">rasqal_new_query</link>                    (<link linkend="rasqal-world">rasqal_world</link> *world,
                                                         const <link linkend="char">char</link> *name,
                                                         unsigned <link linkend="char">char</link> *uri);
<link linkend="void">void</link>                <link linkend="rasqal-free-query">rasqal_free_query</link>                   (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-add-data-graph">rasqal_query_add_data_graph</link>         (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="raptor-uri">raptor_uri</link> *uri,
                                                         <link linkend="raptor-uri">raptor_uri</link> *name_uri,
                                                         <link linkend="int">int</link> flags);
<link linkend="int">int</link>                 <link linkend="rasqal-query-add-prefix">rasqal_query_add_prefix</link>             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-prefix">rasqal_prefix</link> *prefix);
<link linkend="int">int</link>                 <link linkend="rasqal-query-add-variable">rasqal_query_add_variable</link>           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-variable">rasqal_variable</link> *var);
<link linkend="rasqal-query-results">rasqal_query_results</link>* <link linkend="rasqal-query-execute">rasqal_query_execute</link>              (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-all-variable-sequence">rasqal_query_get_all_variable_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-anonymous-variable-sequence">rasqal_query_get_anonymous_variable_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-bound-variable-sequence">rasqal_query_get_bound_variable_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-triple">rasqal_triple</link>*      <link linkend="rasqal-query-get-construct-triple">rasqal_query_get_construct_triple</link>   (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-construct-triples-sequence">rasqal_query_get_construct_triples_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-data-graph">rasqal_data_graph</link>*  <link linkend="rasqal-query-get-data-graph">rasqal_query_get_data_graph</link>         (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-data-graph-sequence">rasqal_query_get_data_graph_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-get-distinct">rasqal_query_get_distinct</link>           (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-get-explain">rasqal_query_get_explain</link>            (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-expression">rasqal_expression</link>*  <link linkend="rasqal-query-get-group-condition">rasqal_query_get_group_condition</link>    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-group-conditions-sequence">rasqal_query_get_group_conditions_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-graph-pattern">rasqal_graph_pattern</link>* <link linkend="rasqal-query-get-graph-pattern">rasqal_query_get_graph_pattern</link>    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-graph-pattern-sequence">rasqal_query_get_graph_pattern_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
const <link linkend="char">char</link>*         <link linkend="rasqal-query-get-label">rasqal_query_get_label</link>              (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-get-limit">rasqal_query_get_limit</link>              (<link linkend="rasqal-query">rasqal_query</link> *query);
const <link linkend="char">char</link>*         <link linkend="rasqal-query-get-name">rasqal_query_get_name</link>               (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-get-offset">rasqal_query_get_offset</link>             (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-expression">rasqal_expression</link>*  <link linkend="rasqal-query-get-order-condition">rasqal_query_get_order_condition</link>    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-order-conditions-sequence">rasqal_query_get_order_conditions_sequence</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-prefix">rasqal_prefix</link>*      <link linkend="rasqal-query-get-prefix">rasqal_query_get_prefix</link>             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-prefix-sequence">rasqal_query_get_prefix_sequence</link>    (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-graph-pattern">rasqal_graph_pattern</link>* <link linkend="rasqal-query-get-query-graph-pattern">rasqal_query_get_query_graph_pattern</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-triple">rasqal_triple</link>*      <link linkend="rasqal-query-get-triple">rasqal_query_get_triple</link>             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="raptor-sequence">raptor_sequence</link>*    <link linkend="rasqal-query-get-triple-sequence">rasqal_query_get_triple_sequence</link>    (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="void">void</link>*               <link linkend="rasqal-query-get-user-data">rasqal_query_get_user_data</link>          (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="rasqal-variable">rasqal_variable</link>*    <link linkend="rasqal-query-get-variable">rasqal_query_get_variable</link>           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);
<link linkend="rasqal-query-verb">rasqal_query_verb</link>   <link linkend="rasqal-query-get-verb">rasqal_query_get_verb</link>               (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-get-wildcard">rasqal_query_get_wildcard</link>           (<link linkend="rasqal-query">rasqal_query</link> *query);
<link linkend="int">int</link>                 <link linkend="rasqal-query-has-variable">rasqal_query_has_variable</link>           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *name);
<link linkend="int">int</link>                 <link linkend="rasqal-query-prepare">rasqal_query_prepare</link>                (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *query_string,
                                                         <link linkend="raptor-uri">raptor_uri</link> *base_uri);
<link linkend="void">void</link>                <link linkend="rasqal-query-print">rasqal_query_print</link>                  (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="FILE:CAPS">FILE</link> *fh);
<link linkend="void">void</link>                <link linkend="rasqal-query-graph-pattern-visit">rasqal_query_graph_pattern_visit</link>    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-graph-pattern-visit-fn">rasqal_graph_pattern_visit_fn</link> visit_fn,
                                                         <link linkend="void">void</link> *data);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-default-generate-bnodeid-parameters">rasqal_query_set_default_generate_bnodeid_parameters</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *rdf_query,
                                                         <link linkend="char">char</link> *prefix,
                                                         <link linkend="int">int</link> base);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-distinct">rasqal_query_set_distinct</link>           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> distinct_mode);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-explain">rasqal_query_set_explain</link>            (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> is_explain);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-error-handler">rasqal_query_set_error_handler</link>      (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-message-handler">raptor_message_handler</link> handler);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-fatal-error-handler">rasqal_query_set_fatal_error_handler</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-message-handler">raptor_message_handler</link> handler);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-generate-bnodeid-handler">rasqal_query_set_generate_bnodeid_handler</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="rasqal-generate-bnodeid-handler">rasqal_generate_bnodeid_handler</link> handler);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-limit">rasqal_query_set_limit</link>              (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> limit);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-offset">rasqal_query_set_offset</link>             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> offset);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-user-data">rasqal_query_set_user_data</link>          (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data);
<link linkend="int">int</link>                 <link linkend="rasqal-query-set-variable">rasqal_query_set_variable</link>           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *name,
                                                         <link linkend="rasqal-literal">rasqal_literal</link> *value);
<link linkend="void">void</link>                <link linkend="rasqal-query-set-warning-handler">rasqal_query_set_warning_handler</link>    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-message-handler">raptor_message_handler</link> handler);
const <link linkend="char">char</link>*         <link linkend="rasqal-query-verb-as-string">rasqal_query_verb_as_string</link>         (<link linkend="rasqal-query-verb">rasqal_query_verb</link> verb);
<link linkend="int">int</link>                 <link linkend="rasqal-query-write">rasqal_query_write</link>                  (<link linkend="raptor-iostream">raptor_iostream</link> *iostr,
                                                         <link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="raptor-uri">raptor_uri</link> *format_uri,
                                                         <link linkend="raptor-uri">raptor_uri</link> *base_uri);
<link linkend="int">int</link>                 <link linkend="rasqal-query-iostream-write-escaped-counted-string">rasqal_query_iostream_write_escaped_counted_string</link>
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="raptor-iostream">raptor_iostream</link> *iostr,
                                                         unsigned <link linkend="char">char</link> *string,
                                                         <link linkend="size-t">size_t</link> len);
unsigned <link linkend="char">char</link>*      <link linkend="rasqal-query-escape-counted-string">rasqal_query_escape_counted_string</link>  (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *string,
                                                         <link linkend="size-t">size_t</link> len,
                                                         <link linkend="size-t">size_t</link> *output_len_p);
<link linkend="int">int</link>                 <link linkend="rasqal-query-set-feature">rasqal_query_set_feature</link>            (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature,
                                                         <link linkend="int">int</link> value);
<link linkend="int">int</link>                 <link linkend="rasqal-query-set-feature-string">rasqal_query_set_feature_string</link>     (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature,
                                                         unsigned <link linkend="char">char</link> *value);
<link linkend="int">int</link>                 <link linkend="rasqal-query-get-feature">rasqal_query_get_feature</link>            (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature);
const unsigned <link linkend="char">char</link>* <link linkend="rasqal-query-get-feature-string">rasqal_query_get_feature_string</link>    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature);
</synopsis>
</refsynopsisdiv>









<refsect1 id="rasqal-section-query.description" role="desc">
<title role="desc.title">Description</title>
<para>
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.
</para>

<para>The query structures can be read via methods to return
the query verb <link linkend="rasqal-query-get-verb"><function>rasqal_query_get_verb()</function></link>,
the <link linkend="rasqal-data-graph"><type>rasqal_data_graph</type></link> RDF data sources with <link linkend="rasqal-query-get-data-graph"><function>rasqal_query_get_data_graph()</function></link> etc.,
the <link linkend="rasqal-graph-pattern"><type>rasqal_graph_pattern</type></link> tree with <link linkend="rasqal-query-get-query-graph-pattern"><function>rasqal_query_get_query_graph_pattern()</function></link>,
the sequence of order conditions with <link linkend="rasqal-query-get-order-condition"><function>rasqal_query_get_order_condition()</function></link> etc.,
the <link linkend="rasqal-variable"><type>rasqal_variable</type></link> selected to return with
<link linkend="rasqal-query-get-bound-variable-sequence"><function>rasqal_query_get_bound_variable_sequence()</function></link> or <link linkend="rasqal-query-get-all-variable-sequence"><function>rasqal_query_get_all_variable_sequence()</function></link>,
and so on.
</para>

<para>
To process a query string, the <link linkend="rasqal-query-prepare"><function>rasqal_query_prepare()</function></link> method
parses the query string in some query language and initialises
the <link linkend="rasqal-query"><type>rasqal_query</type></link> structures.
</para>

<para>
The query can be evaluated with the internal query engine against
some source of matches using <link linkend="rasqal-query-execute"><function>rasqal_query_execute()</function></link> to give an
<link linkend="rasqal-query-results"><type>rasqal_query_results</type></link>.  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 <link linkend="rasqal-query-results"><type>rasqal_query_results</type></link> and
then retrieved.
</para>
</refsect1>

<refsect1 id="rasqal-section-query.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="rasqal-query-verb" role="enum">
<title>enum rasqal_query_verb</title>
<indexterm zone="rasqal-query-verb"><primary>rasqal_query_verb</primary></indexterm><programlisting>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;
</programlisting>
<para>
Query main operation verbs describing the major type of query
being performed.</para>
<para>

</para><variablelist role="enum">
<varlistentry id="RASQAL-QUERY-VERB-UNKNOWN:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_UNKNOWN</literal></term>
<listitem><simpara> Internal
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-SELECT:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_SELECT</literal></term>
<listitem><simpara> RDQL/SPARQL query select verb. 
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-CONSTRUCT:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_CONSTRUCT</literal></term>
<listitem><simpara> SPARQL query construct verb.
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-DESCRIBE:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_DESCRIBE</literal></term>
<listitem><simpara> SPARQL query describe verb.
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-ASK:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_ASK</literal></term>
<listitem><simpara> SPARQL query ask verb.
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-DELETE:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_DELETE</literal></term>
<listitem><simpara> LAQRS query delete verb.
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-INSERT:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_INSERT</literal></term>
<listitem><simpara> LAQRS query insert verb.
</simpara></listitem>
</varlistentry>
<varlistentry id="RASQAL-QUERY-VERB-LAST:CAPS" role="constant">
<term><literal>RASQAL_QUERY_VERB_LAST</literal></term>
<listitem><simpara> Internal
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query" role="typedef">
<title>rasqal_query</title>
<indexterm zone="rasqal-query"><primary>rasqal_query</primary></indexterm><programlisting>rasqal_graph_query* query;
</programlisting>
<para>
Rasqal query class.</para>
<para>

</para></refsect2>
<refsect2 id="rasqal-new-query" role="function">
<title>rasqal_new_query ()</title>
<indexterm zone="rasqal-new-query"><primary>rasqal_new_query</primary></indexterm><programlisting><link linkend="rasqal-query">rasqal_query</link>*       rasqal_new_query                    (<link linkend="rasqal-world">rasqal_world</link> *world,
                                                         const <link linkend="char">char</link> *name,
                                                         unsigned <link linkend="char">char</link> *uri);</programlisting>
<para>
Constructor - create a new rasqal_query object.
</para>
<para>
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.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>world</parameter>&nbsp;:</term>
<listitem><simpara> rasqal_world object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> the query language name (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> language uri (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="rasqal-query"><type>rasqal_query</type></link> object or NULL on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-free-query" role="function">
<title>rasqal_free_query ()</title>
<indexterm zone="rasqal-free-query"><primary>rasqal_free_query</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_free_query                   (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Destructor - destroy a <link linkend="rasqal-query"><type>rasqal_query</type></link> object.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-add-data-graph" role="function">
<title>rasqal_query_add_data_graph ()</title>
<indexterm zone="rasqal-query-add-data-graph"><primary>rasqal_query_add_data_graph</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_add_data_graph         (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="raptor-uri">raptor_uri</link> *uri,
                                                         <link linkend="raptor-uri">raptor_uri</link> *name_uri,
                                                         <link linkend="int">int</link> flags);</programlisting>
<para>
Add a data graph to the query.
</para>
<para>
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.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> source uri for retrieval
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name_uri</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> name uri (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara> RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-add-prefix" role="function">
<title>rasqal_query_add_prefix ()</title>
<indexterm zone="rasqal-query-add-prefix"><primary>rasqal_query_add_prefix</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_add_prefix             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-prefix">rasqal_prefix</link> *prefix);</programlisting>
<para>
Add a namespace prefix to the query.
</para>
<para>
If the prefix has already been used, the old URI will be overridden.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>prefix</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-prefix"><type>rasqal_prefix</type></link> namespace prefix, URI
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-add-variable" role="function">
<title>rasqal_query_add_variable ()</title>
<indexterm zone="rasqal-query-add-variable"><primary>rasqal_query_add_variable</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_add_variable           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-variable">rasqal_variable</link> *var);</programlisting>
<para>
Add a binding variable to the query.
</para>
<para>
See also rasqal_query_set_variable which assigns or removes a value to
a previously added variable in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>var</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-variable"><type>rasqal_variable</type></link> variable
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-execute" role="function">
<title>rasqal_query_execute ()</title>
<indexterm zone="rasqal-query-execute"><primary>rasqal_query_execute</primary></indexterm><programlisting><link linkend="rasqal-query-results">rasqal_query_results</link>* rasqal_query_execute              (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Excute a query - run and return results.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> the <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-query-results"><type>rasqal_query_results</type></link> structure or NULL on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-all-variable-sequence" role="function">
<title>rasqal_query_get_all_variable_sequence ()</title>
<indexterm zone="rasqal-query-get-all-variable-sequence"><primary>rasqal_query_get_all_variable_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_all_variable_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of all variables mentioned in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-variable"><type>rasqal_variable</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-anonymous-variable-sequence" role="function">
<title>rasqal_query_get_anonymous_variable_sequence ()</title>
<indexterm zone="rasqal-query-get-anonymous-variable-sequence"><primary>rasqal_query_get_anonymous_variable_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_anonymous_variable_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of anonymous variables mentioned in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-variable"><type>rasqal_variable</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-bound-variable-sequence" role="function">
<title>rasqal_query_get_bound_variable_sequence ()</title>
<indexterm zone="rasqal-query-get-bound-variable-sequence"><primary>rasqal_query_get_bound_variable_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_bound_variable_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of variables to bind in the query.
</para>
<para>
This returns the sequence of variables that are explicitly chosen
via SELECT in RDQL, SPARQL.  Or all variables mentioned with SELECT *</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-variable"><type>rasqal_variable</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-construct-triple" role="function">
<title>rasqal_query_get_construct_triple ()</title>
<indexterm zone="rasqal-query-get-construct-triple"><primary>rasqal_query_get_construct_triple</primary></indexterm><programlisting><link linkend="rasqal-triple">rasqal_triple</link>*      rasqal_query_get_construct_triple   (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a triple in the sequence of construct triples.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-triple"><type>rasqal_triple</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-construct-triples-sequence" role="function">
<title>rasqal_query_get_construct_triples_sequence ()</title>
<indexterm zone="rasqal-query-get-construct-triples-sequence"><primary>rasqal_query_get_construct_triples_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_construct_triples_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of triples for a construct.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-triple"><type>rasqal_triple</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-data-graph" role="function">
<title>rasqal_query_get_data_graph ()</title>
<indexterm zone="rasqal-query-get-data-graph"><primary>rasqal_query_get_data_graph</primary></indexterm><programlisting><link linkend="rasqal-data-graph">rasqal_data_graph</link>*  rasqal_query_get_data_graph         (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a rasqal_data_graph* in the sequence of data_graphs.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-data-graph"><type>rasqal_data_graph</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-data-graph-sequence" role="function">
<title>rasqal_query_get_data_graph_sequence ()</title>
<indexterm zone="rasqal-query-get-data-graph-sequence"><primary>rasqal_query_get_data_graph_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_data_graph_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of data_graph URIs.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="raptor-uri"><type>raptor_uri</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-distinct" role="function">
<title>rasqal_query_get_distinct ()</title>
<indexterm zone="rasqal-query-get-distinct"><primary>rasqal_query_get_distinct</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_get_distinct           (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the query distinct mode
</para>
<para>
See <link linkend="rasqal-query-set-distinct"><function>rasqal_query_set_distinct()</function></link> for the distinct modes.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 if the results should be distinct
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-explain" role="function">
<title>rasqal_query_get_explain ()</title>
<indexterm zone="rasqal-query-get-explain"><primary>rasqal_query_get_explain</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_get_explain            (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the query explain results flag.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 if the results should be explain
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-group-condition" role="function">
<title>rasqal_query_get_group_condition ()</title>
<indexterm zone="rasqal-query-get-group-condition"><primary>rasqal_query_get_group_condition</primary></indexterm><programlisting><link linkend="rasqal-expression">rasqal_expression</link>*  rasqal_query_get_group_condition    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a query grouping expression in the sequence of query grouping conditions.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-expression"><type>rasqal_expression</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-group-conditions-sequence" role="function">
<title>rasqal_query_get_group_conditions_sequence ()</title>
<indexterm zone="rasqal-query-get-group-conditions-sequence"><primary>rasqal_query_get_group_conditions_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_group_conditions_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of query grouping conditions.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-expression"><type>rasqal_expression</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-graph-pattern" role="function">
<title>rasqal_query_get_graph_pattern ()</title>
<indexterm zone="rasqal-query-get-graph-pattern"><primary>rasqal_query_get_graph_pattern</primary></indexterm><programlisting><link linkend="rasqal-graph-pattern">rasqal_graph_pattern</link>* rasqal_query_get_graph_pattern    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a graph_pattern in the sequence of graph_pattern expressions in the top query graph pattern.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-graph-pattern"><type>rasqal_graph_pattern</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-graph-pattern-sequence" role="function">
<title>rasqal_query_get_graph_pattern_sequence ()</title>
<indexterm zone="rasqal-query-get-graph-pattern-sequence"><primary>rasqal_query_get_graph_pattern_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_graph_pattern_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of graph_patterns expressions inside the top query graph pattern.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-graph-pattern"><type>rasqal_graph_pattern</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-label" role="function">
<title>rasqal_query_get_label ()</title>
<indexterm zone="rasqal-query-get-label"><primary>rasqal_query_get_label</primary></indexterm><programlisting>const <link linkend="char">char</link>*         rasqal_query_get_label              (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get a readable label for the query language.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> shared string label value
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-limit" role="function">
<title>rasqal_query_get_limit ()</title>
<indexterm zone="rasqal-query-get-limit"><primary>rasqal_query_get_limit</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_get_limit              (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the query-specified limit on results.
</para>
<para>
This is the limit given in the query on the number of results allowed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> integer &gt;=0 if a limit is given, otherwise &lt;0
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-name" role="function">
<title>rasqal_query_get_name ()</title>
<indexterm zone="rasqal-query-get-name"><primary>rasqal_query_get_name</primary></indexterm><programlisting>const <link linkend="char">char</link>*         rasqal_query_get_name               (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get a short name for the query language.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> shared string label value
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-offset" role="function">
<title>rasqal_query_get_offset ()</title>
<indexterm zone="rasqal-query-get-offset"><primary>rasqal_query_get_offset</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_get_offset             (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the query-specified offset on results.
</para>
<para>
This is the offset given in the query on the number of results allowed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> integer &gt;=0 if a offset is given, otherwise &lt;0
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-order-condition" role="function">
<title>rasqal_query_get_order_condition ()</title>
<indexterm zone="rasqal-query-get-order-condition"><primary>rasqal_query_get_order_condition</primary></indexterm><programlisting><link linkend="rasqal-expression">rasqal_expression</link>*  rasqal_query_get_order_condition    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a query ordering expression in the sequence of query ordering conditions.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-expression"><type>rasqal_expression</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-order-conditions-sequence" role="function">
<title>rasqal_query_get_order_conditions_sequence ()</title>
<indexterm zone="rasqal-query-get-order-conditions-sequence"><primary>rasqal_query_get_order_conditions_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_order_conditions_sequence
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of query ordering conditions.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-expression"><type>rasqal_expression</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-prefix" role="function">
<title>rasqal_query_get_prefix ()</title>
<indexterm zone="rasqal-query-get-prefix"><primary>rasqal_query_get_prefix</primary></indexterm><programlisting><link linkend="rasqal-prefix">rasqal_prefix</link>*      rasqal_query_get_prefix             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a prefix in the sequence of namespsace prefixes in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-prefix"><type>rasqal_prefix</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-prefix-sequence" role="function">
<title>rasqal_query_get_prefix_sequence ()</title>
<indexterm zone="rasqal-query-get-prefix-sequence"><primary>rasqal_query_get_prefix_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_prefix_sequence    (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of namespace prefixes in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-prefix"><type>rasqal_prefix</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-query-graph-pattern" role="function">
<title>rasqal_query_get_query_graph_pattern ()</title>
<indexterm zone="rasqal-query-get-query-graph-pattern"><primary>rasqal_query_get_query_graph_pattern</primary></indexterm><programlisting><link linkend="rasqal-graph-pattern">rasqal_graph_pattern</link>* rasqal_query_get_query_graph_pattern
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the top query graph pattern.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-graph-pattern"><type>rasqal_graph_pattern</type></link> of the top query graph pattern
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-triple" role="function">
<title>rasqal_query_get_triple ()</title>
<indexterm zone="rasqal-query-get-triple"><primary>rasqal_query_get_triple</primary></indexterm><programlisting><link linkend="rasqal-triple">rasqal_triple</link>*      rasqal_query_get_triple             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a triple in the sequence of matching triples in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-triple"><type>rasqal_triple</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-triple-sequence" role="function">
<title>rasqal_query_get_triple_sequence ()</title>
<indexterm zone="rasqal-query-get-triple-sequence"><primary>rasqal_query_get_triple_sequence</primary></indexterm><programlisting><link linkend="raptor-sequence">raptor_sequence</link>*    rasqal_query_get_triple_sequence    (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the sequence of matching triples in the query.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="raptor-sequence"><type>raptor_sequence</type></link> of <link linkend="rasqal-triple"><type>rasqal_triple</type></link> pointers.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-user-data" role="function">
<title>rasqal_query_get_user_data ()</title>
<indexterm zone="rasqal-query-get-user-data"><primary>rasqal_query_get_user_data</primary></indexterm><programlisting><link linkend="void">void</link>*               rasqal_query_get_user_data          (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get query user data.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> user data as set by rasqal_query_set_user_data
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-variable" role="function">
<title>rasqal_query_get_variable ()</title>
<indexterm zone="rasqal-query-get-variable"><primary>rasqal_query_get_variable</primary></indexterm><programlisting><link linkend="rasqal-variable">rasqal_variable</link>*    rasqal_query_get_variable           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> idx);</programlisting>
<para>
Get a variable in the sequence of variables to bind.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>idx</parameter>&nbsp;:</term>
<listitem><simpara> index into the sequence (0 or larger)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a <link linkend="rasqal-variable"><type>rasqal_variable</type></link> pointer or NULL if out of the sequence range
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-verb" role="function">
<title>rasqal_query_get_verb ()</title>
<indexterm zone="rasqal-query-get-verb"><primary>rasqal_query_get_verb</primary></indexterm><programlisting><link linkend="rasqal-query-verb">rasqal_query_verb</link>   rasqal_query_get_verb               (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the query verb.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the operating verb of the query of type rasqal_query_verb
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-wildcard" role="function">
<title>rasqal_query_get_wildcard ()</title>
<indexterm zone="rasqal-query-get-wildcard"><primary>rasqal_query_get_wildcard</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_get_wildcard           (<link linkend="rasqal-query">rasqal_query</link> *query);</programlisting>
<para>
Get the query verb is wildcard flag.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 if the query verb was a wildcard (such as SELECT *)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-has-variable" role="function">
<title>rasqal_query_has_variable ()</title>
<indexterm zone="rasqal-query-has-variable"><primary>rasqal_query_has_variable</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_has_variable           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *name);</programlisting>
<para>
Find if the named variable is in the sequence of variables to bind.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> variable name
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 if the variable name was found.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-prepare" role="function">
<title>rasqal_query_prepare ()</title>
<indexterm zone="rasqal-query-prepare"><primary>rasqal_query_prepare</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_prepare                (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *query_string,
                                                         <link linkend="raptor-uri">raptor_uri</link> *base_uri);</programlisting>
<para>
Prepare a query - typically parse it.
</para>
<para>
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.
</para>
<para>
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.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> the <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>query_string</parameter>&nbsp;:</term>
<listitem><simpara> the query string (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>base_uri</parameter>&nbsp;:</term>
<listitem><simpara> base URI of query string (optional)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-print" role="function">
<title>rasqal_query_print ()</title>
<indexterm zone="rasqal-query-print"><primary>rasqal_query_print</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_print                  (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="FILE:CAPS">FILE</link> *fh);</programlisting>
<para>
Print a query in a debug format.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> the <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fh</parameter>&nbsp;:</term>
<listitem><simpara> the <link linkend="FILE:CAPS"><type>FILE</type></link>* handle to print to.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-graph-pattern-visit" role="function">
<title>rasqal_query_graph_pattern_visit ()</title>
<indexterm zone="rasqal-query-graph-pattern-visit"><primary>rasqal_query_graph_pattern_visit</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_graph_pattern_visit    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-graph-pattern-visit-fn">rasqal_graph_pattern_visit_fn</link> visit_fn,
                                                         <link linkend="void">void</link> *data);</programlisting>
<para>
Visit all graph patterns in a query with a user function <parameter>visit_fn</parameter>.
</para>
<para>
See also <link linkend="rasqal-graph-pattern-visit"><function>rasqal_graph_pattern_visit()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> query
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>visit_fn</parameter>&nbsp;:</term>
<listitem><simpara> user function to operate on
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
<listitem><simpara> user data to pass to function
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-default-generate-bnodeid-parameters" role="function">
<title>rasqal_query_set_default_generate_bnodeid_parameters ()</title>
<indexterm zone="rasqal-query-set-default-generate-bnodeid-parameters"><primary>rasqal_query_set_default_generate_bnodeid_parameters</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_default_generate_bnodeid_parameters
                                                        (<link linkend="rasqal-query">rasqal_query</link> *rdf_query,
                                                         <link linkend="char">char</link> *prefix,
                                                         <link linkend="int">int</link> base);</programlisting>
<para>
Sets the parameters for the default algorithm used to generate
blank node IDs.  The default algorithm uses both <parameter>prefix</parameter> and <parameter>base</parameter>
to generate a new identifier.  The exact identifier generated is
not guaranteed to be a strict concatenation of <parameter>prefix</parameter> and <parameter>base</parameter>
but will use both parts.
</para>
<para>
For finer control of the generated identifiers, use
<link linkend="rasqal-set-default-generate-bnodeid-handler"><function>rasqal_set_default_generate_bnodeid_handler()</function></link>
</para>
<para>
If prefix is NULL, the default prefix is used (currently "bnodeid")
If base is less than 1, it is initialised to 1.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>rdf_query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>prefix</parameter>&nbsp;:</term>
<listitem><simpara> prefix string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>base</parameter>&nbsp;:</term>
<listitem><simpara> integer base identifier
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-distinct" role="function">
<title>rasqal_query_set_distinct ()</title>
<indexterm zone="rasqal-query-set-distinct"><primary>rasqal_query_set_distinct</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_distinct           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> distinct_mode);</programlisting>
<para>
Set the query distinct results mode.
</para>
<para>
The allowed <parameter>distinct_mode</parameter> values are:
0 if not given
1 if DISTINCT: ensure solutions are unique
2 if SPARQL REDUCED: permit elimination of some non-unique solutions</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>distinct_mode</parameter>&nbsp;:</term>
<listitem><simpara> distinct mode
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-explain" role="function">
<title>rasqal_query_set_explain ()</title>
<indexterm zone="rasqal-query-set-explain"><primary>rasqal_query_set_explain</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_explain            (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> is_explain);</programlisting>
<para>
Set the query explain results flag.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>is_explain</parameter>&nbsp;:</term>
<listitem><simpara> non-0 if explain
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-error-handler" role="function">
<title>rasqal_query_set_error_handler ()</title>
<indexterm zone="rasqal-query-set-error-handler"><primary>rasqal_query_set_error_handler</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_error_handler      (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-message-handler">raptor_message_handler</link> handler);</programlisting>
<para>
Set the query error handling function.
</para>
<para>
The function will receive callbacks when the query fails.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> the query
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data to pass to function
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>handler</parameter>&nbsp;:</term>
<listitem><simpara> pointer to the function
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-fatal-error-handler" role="function">
<title>rasqal_query_set_fatal_error_handler ()</title>
<indexterm zone="rasqal-query-set-fatal-error-handler"><primary>rasqal_query_set_fatal_error_handler</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_fatal_error_handler
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-message-handler">raptor_message_handler</link> handler);</programlisting>
<para>
Set the query error handling function.
</para>
<para>
The function will receive callbacks when the query fails.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> the query
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data to pass to function
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>handler</parameter>&nbsp;:</term>
<listitem><simpara> pointer to the function
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-generate-bnodeid-handler" role="function">
<title>rasqal_query_set_generate_bnodeid_handler ()</title>
<indexterm zone="rasqal-query-set-generate-bnodeid-handler"><primary>rasqal_query_set_generate_bnodeid_handler</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_generate_bnodeid_handler
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="rasqal-generate-bnodeid-handler">rasqal_generate_bnodeid_handler</link> handler);</programlisting>
<para>
Set the generate blank node ID handler function for the query.
</para>
<para>
Sets the function to generate blank node IDs for the query.
The handler is called with a pointer to the rasqal_query, the
<parameter>user_data</parameter> 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 <link linkend="free"><function>free()</function></link>d if it is not used.
</para>
<para>
If handler is NULL, the default method is used</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data pointer for callback
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>handler</parameter>&nbsp;:</term>
<listitem><simpara> generate blank ID callback function
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-limit" role="function">
<title>rasqal_query_set_limit ()</title>
<indexterm zone="rasqal-query-set-limit"><primary>rasqal_query_set_limit</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_limit              (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> limit);</programlisting>
<para>
Set the query-specified limit on results.
</para>
<para>
This is the limit given in the query on the number of results allowed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>limit</parameter>&nbsp;:</term>
<listitem><simpara> the limit on results, &gt;=0 to set a limit, &lt;0 to have no limit
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-offset" role="function">
<title>rasqal_query_set_offset ()</title>
<indexterm zone="rasqal-query-set-offset"><primary>rasqal_query_set_offset</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_offset             (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="int">int</link> offset);</programlisting>
<para>
Set the query-specified offset on results.
</para>
<para>
This is the offset given in the query on the number of results allowed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>offset</parameter>&nbsp;:</term>
<listitem><simpara> offset for results, &gt;=0 to set an offset, &lt;0 to have no offset
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-user-data" role="function">
<title>rasqal_query_set_user_data ()</title>
<indexterm zone="rasqal-query-set-user-data"><primary>rasqal_query_set_user_data</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_user_data          (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data);</programlisting>
<para>
Set the query user data.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> some user data to associate with the query
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-variable" role="function">
<title>rasqal_query_set_variable ()</title>
<indexterm zone="rasqal-query-set-variable"><primary>rasqal_query_set_variable</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_set_variable           (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *name,
                                                         <link linkend="rasqal-literal">rasqal_literal</link> *value);</programlisting>
<para>
Add a binding variable to the query.
</para>
<para>
See also rasqal_query_add_variable which adds a new binding variable
and must be called before this method is invoked.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-variable"><type>rasqal_variable</type></link> variable
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-literal"><type>rasqal_literal</type></link> value to set or NULL
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-warning-handler" role="function">
<title>rasqal_query_set_warning_handler ()</title>
<indexterm zone="rasqal-query-set-warning-handler"><primary>rasqal_query_set_warning_handler</primary></indexterm><programlisting><link linkend="void">void</link>                rasqal_query_set_warning_handler    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="void">void</link> *user_data,
                                                         <link linkend="raptor-message-handler">raptor_message_handler</link> handler);</programlisting>
<para>
Set the query warning handling function.
</para>
<para>
The function will receive callbacks when the query gives a warning.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> the query
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data to pass to function
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>handler</parameter>&nbsp;:</term>
<listitem><simpara> pointer to the function
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-verb-as-string" role="function">
<title>rasqal_query_verb_as_string ()</title>
<indexterm zone="rasqal-query-verb-as-string"><primary>rasqal_query_verb_as_string</primary></indexterm><programlisting>const <link linkend="char">char</link>*         rasqal_query_verb_as_string         (<link linkend="rasqal-query-verb">rasqal_query_verb</link> verb);</programlisting>
<para>
Get a string for the query verb.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>verb</parameter>&nbsp;:</term>
<listitem><simpara> the <link linkend="rasqal-query-verb"><type>rasqal_query_verb</type></link> verb of the query
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> pointer to a shared string label for the query verb
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-write" role="function">
<title>rasqal_query_write ()</title>
<indexterm zone="rasqal-query-write"><primary>rasqal_query_write</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_write                  (<link linkend="raptor-iostream">raptor_iostream</link> *iostr,
                                                         <link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="raptor-uri">raptor_uri</link> *format_uri,
                                                         <link linkend="raptor-uri">raptor_uri</link> *base_uri);</programlisting>
<para>
Write a query to an iostream in a specified format.
</para>
<para>
The supported URIs for the format_uri are:
</para>
<para>
Default: SPARQL Query Language 2006-04-06
http://www.w3.org/TR/2006/CR-rdf-sparql-query-20060406/</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>iostr</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-iostream"><type>raptor_iostream</type></link> to write the query to
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> pointer.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format_uri</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> describing the format to write (or NULL for default)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>base_uri</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> base URI of the output format
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-iostream-write-escaped-counted-string" role="function">
<title>rasqal_query_iostream_write_escaped_counted_string ()</title>
<indexterm zone="rasqal-query-iostream-write-escaped-counted-string"><primary>rasqal_query_iostream_write_escaped_counted_string</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_iostream_write_escaped_counted_string
                                                        (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="raptor-iostream">raptor_iostream</link> *iostr,
                                                         unsigned <link linkend="char">char</link> *string,
                                                         <link linkend="size-t">size_t</link> len);</programlisting>
<para>
Write a string to an iostream in escaped form suitable for the query string.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>iostr</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-iostream"><type>raptor_iostream</type></link> to write the escaped string to
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>string</parameter>&nbsp;:</term>
<listitem><simpara> string to escape
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&nbsp;:</term>
<listitem><simpara> Length of string to escape
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non-0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-escape-counted-string" role="function">
<title>rasqal_query_escape_counted_string ()</title>
<indexterm zone="rasqal-query-escape-counted-string"><primary>rasqal_query_escape_counted_string</primary></indexterm><programlisting>unsigned <link linkend="char">char</link>*      rasqal_query_escape_counted_string  (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         unsigned <link linkend="char">char</link> *string,
                                                         <link linkend="size-t">size_t</link> len,
                                                         <link linkend="size-t">size_t</link> *output_len_p);</programlisting>
<para>
Convert a string into an escaped form suitable for the query string.
</para>
<para>
The returned string must be freed by the caller with
<link linkend="rasqal-free-memory"><function>rasqal_free_memory()</function></link></para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>string</parameter>&nbsp;:</term>
<listitem><simpara> string to escape
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&nbsp;:</term>
<listitem><simpara> Length of string to escape
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>output_len_p</parameter>&nbsp;:</term>
<listitem><simpara> Pointer to store length of output string (or NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the escaped string or NULL on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-feature" role="function">
<title>rasqal_query_set_feature ()</title>
<indexterm zone="rasqal-query-set-feature"><primary>rasqal_query_set_feature</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_set_feature            (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature,
                                                         <link linkend="int">int</link> value);</programlisting>
<para>
Set various query features.
</para>
<para>
The allowed features are available via <link linkend="rasqal-features-enumerate"><function>rasqal_features_enumerate()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>feature</parameter>&nbsp;:</term>
<listitem><simpara> feature to set from enumerated <link linkend="rasqal-feature"><type>rasqal_feature</type></link> values
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&nbsp;:</term>
<listitem><simpara> integer feature value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 on failure or if the feature is unknown
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-set-feature-string" role="function">
<title>rasqal_query_set_feature_string ()</title>
<indexterm zone="rasqal-query-set-feature-string"><primary>rasqal_query_set_feature_string</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_set_feature_string     (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature,
                                                         unsigned <link linkend="char">char</link> *value);</programlisting>
<para>
Set query features with string values.
</para>
<para>
The allowed features are available via <link linkend="rasqal-features-enumerate"><function>rasqal_features_enumerate()</function></link>.
If the feature type is integer, the value is interpreted as an integer.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>feature</parameter>&nbsp;:</term>
<listitem><simpara> feature to set from enumerated <link linkend="rasqal-feature"><type>rasqal_feature</type></link> values
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>value</parameter>&nbsp;:</term>
<listitem><simpara> feature value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 on failure or if the feature is unknown
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-feature" role="function">
<title>rasqal_query_get_feature ()</title>
<indexterm zone="rasqal-query-get-feature"><primary>rasqal_query_get_feature</primary></indexterm><programlisting><link linkend="int">int</link>                 rasqal_query_get_feature            (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature);</programlisting>
<para>
Get various query features.
</para>
<para>
The allowed features are available via <link linkend="rasqal-features-enumerate"><function>rasqal_features_enumerate()</function></link>.
</para>
<para>
Note: no feature value is negative</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>feature</parameter>&nbsp;:</term>
<listitem><simpara> feature to get value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> feature value or &lt; 0 for an illegal feature
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rasqal-query-get-feature-string" role="function">
<title>rasqal_query_get_feature_string ()</title>
<indexterm zone="rasqal-query-get-feature-string"><primary>rasqal_query_get_feature_string</primary></indexterm><programlisting>const unsigned <link linkend="char">char</link>* rasqal_query_get_feature_string    (<link linkend="rasqal-query">rasqal_query</link> *query,
                                                         <link linkend="rasqal-feature">rasqal_feature</link> feature);</programlisting>
<para>
Get query features with string values.
</para>
<para>
The allowed features are available via <link linkend="rasqal-features-enumerate"><function>rasqal_features_enumerate()</function></link>.
If a string is returned, it must be freed by the caller.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="rasqal-query"><type>rasqal_query</type></link> query object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>feature</parameter>&nbsp;:</term>
<listitem><simpara> feature to get value
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> feature value or NULL for an illegal feature or no value
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
