# TrackerBatch

TrackerBatch is an object containing a series of SPARQL updates, in either SPARQL string or TrackerResource form. This object has a single use, after the batch is executed, it can only be finished and freed.

A batch is created with tracker_sparql_connection_create_batch. To add resources use tracker_batch_add_resource or tracker_batch_add_sparql.

When a batch is ready for execution, use tracker_batch_execute or tracker_batch_execute_async. The batch is executed as a single transaction, it will succeed or fail entirely.

The mapping of blank node labels is global in a TrackerBatch, referencing the same blank node label in different operations in a batch will resolve to the same resource.

This object was added in Tracker 3.1.

## TrackerBatch

    GObject
        ╰──TrackerBatch

### Members

`parent_instance` (GObject) –
No description available

### Class structure

#### TrackerBatchClass

### Tracker.BatchClass

## Tracker.Batch

    GObject.Object
        ╰──Tracker.Batch

### Members

`parent_instance` (GObject.Object) –
No description available

## Tracker.Batch

    GObject.Object
        ╰──Tracker.Batch

### Members

`parent_instance` (GObject.Object) –
No description available

### Methods

#### tracker_batch_add_resource

    tracker_batch_add_resource (TrackerBatch * batch,
                                const gchar * graph,
                                TrackerResource * resource)

Adds the RDF represented by resource to batch.

Parameters:

`batch` –

a TrackerBatch

`graph` –

RDF graph to insert the resource to

`resource` –

a TrackerResource

Since : 3.1

#### Tracker.Batch.prototype.add_resource

    function Tracker.Batch.prototype.add_resource(graph: String, resource: Tracker.Resource): {
        // javascript wrapper for 'tracker_batch_add_resource'
    }

Adds the RDF represented by resource to batch.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`graph` (String) –

RDF graph to insert the resource to

`resource` (Tracker.Resource) –

a Tracker.Resource

Since : 3.1

#### Tracker.Batch.add_resource

    def Tracker.Batch.add_resource (self, graph, resource):
        #python wrapper for 'tracker_batch_add_resource'

Adds the RDF represented by resource to batch.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`graph` (str) –

RDF graph to insert the resource to

`resource` (Tracker.Resource) –

a Tracker.Resource

Since : 3.1

#### tracker_batch_add_sparql

    tracker_batch_add_sparql (TrackerBatch * batch,
                              const gchar * sparql)

Adds an SPARQL update string to batch.

Parameters:

`batch` –

a TrackerBatch

`sparql` –

a SPARQL update string

Since : 3.1

#### Tracker.Batch.prototype.add_sparql

    function Tracker.Batch.prototype.add_sparql(sparql: String): {
        // javascript wrapper for 'tracker_batch_add_sparql'
    }

Adds an SPARQL update string to batch.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`sparql` (String) –

a SPARQL update string

Since : 3.1

#### Tracker.Batch.add_sparql

    def Tracker.Batch.add_sparql (self, sparql):
        #python wrapper for 'tracker_batch_add_sparql'

Adds an SPARQL update string to batch.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`sparql` (str) –

a SPARQL update string

Since : 3.1

#### tracker_batch_execute

    gboolean
    tracker_batch_execute (TrackerBatch * batch,
                           GCancellable * cancellable,
                           GError ** error)

Executes the batch. This operations happens synchronously.

Parameters:

`batch` –

a TrackerBatch

`cancellable` ( [nullable]) –

a GCancellable, or NULL

`error` –

location for a GError, or NULL

Returns –

TRUE of there were no errors, FALSE otherwise

Since : 3.1

#### Tracker.Batch.prototype.execute

    function Tracker.Batch.prototype.execute(cancellable: Gio.Cancellable): {
        // javascript wrapper for 'tracker_batch_execute'
    }

Executes the batch. This operations happens synchronously.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable, or null

Returns (Number) –

true of there were no errors, false otherwise

Since : 3.1

#### Tracker.Batch.execute

    @raises(GLib.GError)
    def Tracker.Batch.execute (self, cancellable):
        #python wrapper for 'tracker_batch_execute'

Executes the batch. This operations happens synchronously.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable, or None

Returns (bool) –

True of there were no errors, False otherwise

Since : 3.1

#### tracker_batch_execute_async

    tracker_batch_execute_async (TrackerBatch * batch,
                                 GCancellable * cancellable,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data)

Executes the batch. This operation happens asynchronously, when finished callback will be executed.

Parameters:

`batch` –

a TrackerBatch

`cancellable` ( [nullable]) –

a GCancellable, or NULL

`callback` –

user-defined GAsyncReadyCallback to be called when asynchronous operation is finished.

`user_data` –

user-defined data to be passed to callback

Since : 3.1

#### Tracker.Batch.prototype.execute_async

    function Tracker.Batch.prototype.execute_async(cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback, user_data: Object): {
        // javascript wrapper for 'tracker_batch_execute_async'
    }

Executes the batch. This operation happens asynchronously, when finished callback will be executed.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable, or null

`callback` (Gio.AsyncReadyCallback) –

user-defined Gio.AsyncReadyCallback to be called when asynchronous operation is finished.

`user_data` (Object) –

user-defined data to be passed to callback

Since : 3.1

#### Tracker.Batch.execute_async

    def Tracker.Batch.execute_async (self, cancellable, callback, *user_data):
        #python wrapper for 'tracker_batch_execute_async'

Executes the batch. This operation happens asynchronously, when finished callback will be executed.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`cancellable` (Gio.Cancellable) –

a Gio.Cancellable, or None

`callback` (Gio.AsyncReadyCallback) –

user-defined Gio.AsyncReadyCallback to be called when asynchronous operation is finished.

`user_data` (variadic) –

user-defined data to be passed to callback

Since : 3.1

#### tracker_batch_execute_finish

    gboolean
    tracker_batch_execute_finish (TrackerBatch * batch,
                                  GAsyncResult * res,
                                  GError ** error)

Finishes the operation started with tracker_batch_execute_async.

Parameters:

`batch` –

a TrackerBatch

`res` –

a GAsyncResult with the result of the operation

`error` –

location for a GError, or NULL

Returns –

TRUE of there were no errors, FALSE otherwise

Since : 3.1

#### Tracker.Batch.prototype.execute_finish

    function Tracker.Batch.prototype.execute_finish(res: Gio.AsyncResult): {
        // javascript wrapper for 'tracker_batch_execute_finish'
    }

Finishes the operation started with Tracker.Batch.prototype.execute_async.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`res` (Gio.AsyncResult) –

a Gio.AsyncResult with the result of the operation

Returns (Number) –

true of there were no errors, false otherwise

Since : 3.1

#### Tracker.Batch.execute_finish

    @raises(GLib.GError)
    def Tracker.Batch.execute_finish (self, res):
        #python wrapper for 'tracker_batch_execute_finish'

Finishes the operation started with Tracker.Batch.execute_async.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

`res` (Gio.AsyncResult) –

a Gio.AsyncResult with the result of the operation

Returns (bool) –

True of there were no errors, False otherwise

Since : 3.1

#### tracker_batch_get_connection

    TrackerSparqlConnection *
    tracker_batch_get_connection (TrackerBatch * batch)

Returns the TrackerSparqlConnection that this batch was created from.

Parameters:

`batch` –

a TrackerBatch

Returns ( [transfer: none]) –

The SPARQL connection of this batch.

#### Tracker.Batch.prototype.get_connection

    function Tracker.Batch.prototype.get_connection(): {
        // javascript wrapper for 'tracker_batch_get_connection'
    }

Returns the Tracker.SparqlConnection that this batch was created from.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

Returns (Tracker.SparqlConnection) –

The SPARQL connection of this batch.

#### Tracker.Batch.get_connection

    def Tracker.Batch.get_connection (self):
        #python wrapper for 'tracker_batch_get_connection'

Returns the Tracker.SparqlConnection that this batch was created from.

Parameters:

`batch` (Tracker.Batch) –

a Tracker.Batch

Returns (Tracker.SparqlConnection) –

The SPARQL connection of this batch.

### Properties

#### connection

    “connection” TrackerSparqlConnection *

The TrackerSparqlConnection the batch belongs to.

Flags : Read / Write / Construct Only

#### connection

    “connection” Tracker.SparqlConnection

The Tracker.SparqlConnection the batch belongs to.

Flags : Read / Write / Construct Only

#### connection

    “self.props.connection” Tracker.SparqlConnection

The Tracker.SparqlConnection the batch belongs to.

Flags : Read / Write / Construct Only

## Constants

### TRACKER_TYPE_BATCH

    #define TRACKER_TYPE_BATCH tracker_batch_get_type ()

The results of the search are