Tsparql.SparqlStatement
Description: Reference for Tsparql.SparqlStatement

### Class

# TsparqlSparqlStatement

#### Description [src]

    abstract class Tsparql.SparqlStatement : GObject.Object
    {
      /* No available fields */
    }

`TrackerSparqlStatement` represents a prepared statement for a SPARQL query.

The SPARQL query will be internally compiled into the format that is most optimal to execute the query many times. For connections created through `tracker_sparql_connection_new()` that will be a SQLite compiled statement.

The SPARQL query may contain parameterized variables expressed via the `~` prefix in the SPARQL syntax (e.g. `~var`), these may happen anywhere in the SPARQL where a literal or variable would typically happen. These parameterized variables may be mapped to arbitrary values prior to execution. The `TrackerSparqlStatement` may be reused for future queries with different values.

The argument bindings may be changed through the `tracker_sparql_statement_bind_int()`, `tracker_sparql_statement_bind_int()`, etc… family of functions. Those functions receive a `name` argument corresponding for the variable name in the SPARQL query (eg. `"var"` for `~var`) and a value to map the variable to.

Once all arguments have a value, the query may be executed through `tracker_sparql_statement_execute_async()` or `tracker_sparql_statement_execute()`.

It is possible to use any `TrackerSparqlStatement` from other threads than the one it was created from. However, binding values and executing the statement must only happen from one thread at a time. It is possible to reuse the `TrackerSparqlStatement` right after `tracker_sparql_statement_execute_async()` was called, there is no need to wait for `tracker_sparql_statement_execute_finish()`.

In some circumstances, it is possible that the query needs to be recompiled from the SPARQL source. This will happen transparently.

#### Ancestors

- GObject

#### Instance methods

###### tracker_sparql_statement_bind_boolean

Binds the boolean `value` to the parameterized variable given by `name`.

###### tracker_sparql_statement_bind_datetime

Binds the `GDateTime` `value` to the parameterized variable given by `name`.

since: 3.2

###### tracker_sparql_statement_bind_double

Binds the double `value` to the parameterized variable given by `name`.

###### tracker_sparql_statement_bind_int

Binds the integer `value` to the parameterized variable given by `name`.

###### tracker_sparql_statement_bind_langstring

Binds the `value` to the parameterized variable given by `name`, tagged with the language defined by `langtag`. The language tag should follow RFC 5646. The parameter will be represented as a `rdf:langString`.

since: 3.7

###### tracker_sparql_statement_bind_string

Binds the string `value` to the parameterized variable given by `name`.

###### tracker_sparql_statement_clear_bindings

Clears all bindings.

###### tracker_sparql_statement_execute

Executes the `SELECT` or `ASK` SPARQL query with the currently bound values.

###### tracker_sparql_statement_execute_async

Executes asynchronously the `SELECT` or `ASK` SPARQL query with the currently bound values.

###### tracker_sparql_statement_execute_finish

Finishes the asynchronous operation started through `tracker_sparql_statement_execute_async()`.

###### tracker_sparql_statement_get_connection

Returns the `TrackerSparqlConnection` that this statement was created for.

###### tracker_sparql_statement_get_sparql

Returns the SPARQL string that this prepared statement holds.

###### tracker_sparql_statement_serialize_async

Serializes a `DESCRIBE` or `CONSTRUCT` query into the given RDF `format`.

since: 3.3

###### tracker_sparql_statement_serialize_finish

Finishes the asynchronous operation started through `tracker_sparql_statement_serialize_async()`.

since: 3.3

###### tracker_sparql_statement_update

Executes the `INSERT`/`DELETE` SPARQL query series with the currently bound values.

since: 3.5

###### tracker_sparql_statement_update_async

Executes asynchronously the `INSERT`/`DELETE` SPARQL query series with the currently bound values.

since: 3.5

###### tracker_sparql_statement_update_finish

Finishes the asynchronous update started through `tracker_sparql_statement_update_async()`.

since: 3.5

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Tsparql.SparqlStatement:connection

The `TrackerSparqlConnection` the statement was created for.

###### Tsparql.SparqlStatement:sparql

SPARQL query stored in this statement.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct TsparqlSparqlStatementClass {
      /* no available fields */
    }

No description available.