TrackerSparqlConnection

TrackerSparqlConnection

Functions

Types and Values

Description

Functions

tracker_sparql_connection_get ()

TrackerSparqlConnection *
tracker_sparql_connection_get (GCancellable *cancellable,
                               GError **error);

tracker_sparql_connection_get is deprecated and should not be used in newly-written code.

This function is used to give the caller a connection to Tracker they can use for future requests. The best backend available to connect to Tracker is returned. These backends include direct-access (for read-only queries) and D-Bus (for both read and write queries).

You can use environment variables to influence how backends are used. If no environment variables are provided, both backends are loaded and chosen based on their merits. If you try to force a backend for a query which it won't support (i.e. an update for a read-only backend), you will see critical warnings.

When calling either tracker_sparql_connection_get(), or the asynchronous variants of these functions, a mutex is used to protect the loading of backends against potential race conditions. For synchronous calls, this function will always block if a previous connection get method has been called.

All backends will call the D-Bus tracker-store API Wait() to make sure the store and databases are in the right state before any user based requests can proceed. There may be a small delay during this call if the databases weren't shutdown cleanly and need to be checked on start up. If the journal needs to be replayed in such an event, the delay may be substantial while data is restored as best as possible.

Parameters

cancellable

a GCancellable used to cancel the operation

 

error

GError for error reporting.

 

Returns

a new TrackerSparqlConnection. Call g_object_unref() on the object when no longer used.

Since: 0.10


tracker_sparql_connection_local_new ()

TrackerSparqlConnection *
tracker_sparql_connection_local_new (TrackerSparqlConnectionFlags flags,
                                     GFile *store,
                                     GFile *journal,
                                     GFile *ontology,
                                     GCancellable *cancellable,
                                     GError **error);

Parameters

flags

Flags to define connection behavior

 

store

Location for the database

 

journal

Location for the operation journal, or NULL

 

ontology

Location of the ontology used for this connection, or NULL

 

cancellable

A GCancellable

 

error

The error which occurred or NULL

 

Returns

a new local TrackerSparqlConnection using the specified cache /journal locations, and the ontology specified in the ontology directory. Call g_object_unref() on the object when no longer used.

This database connection is considered entirely private to the calling process, if multiple processes use the same journal/cache locations, the results are unpredictable.

The journal is used to rebuild the database in case of data corruption, if NULL is provided, the same location than store will be assumed.

The caller is entirely free to define an ontology or reuse Nepomuk for its purposes. For the former see the "Defining ontologies" section in this library docs. For the latter pass a NULL ontology .

The ontology argument may be a resource:/// URI, a directory location must be provided, all children .ontology and .description files will be read.

The store and journal arguments expect directories, and those are assumed to be entirely private to Tracker.

Since: 2.0


tracker_sparql_connection_remote_new ()

TrackerSparqlConnection *
tracker_sparql_connection_remote_new (const gchar *uri_base);

Parameters

uri_base

Base URI of the remote connection

 

Returns

a new remote TrackerSparqlConnection. Call g_object_unref() on the object when no longer used.

Since: 1.12


tracker_sparql_connection_set_domain ()

void
tracker_sparql_connection_set_domain (const gchar *domain);

Sets the domain (usually a DBus name or application ID) that will be used on on the connection obtained by tracker_sparql_connection_get(). See the "Isolating tracker-store clients" section in the docs for this library.

This function must be called before any tracker_sparql_connection_get() calls happen.

Parameters

domain

The domain name for the default connection

 

Since: 2.0


tracker_sparql_connection_get_domain ()

gchar *
tracker_sparql_connection_get_domain (void);

Gets the domain (usually a DBus name or application ID) that will be used on on the connection obtained by tracker_sparql_connection_get(). See tracker_sparql_connection_set_domain() for more information.

Returns

The domain string, or NULL if none is set.

[transfer full]

Since: 2.0


tracker_sparql_connection_get_dbus_connection ()

GDBusConnection *
tracker_sparql_connection_get_dbus_connection
                               (void);

Gets the D-Bus connection that is used to contact the Tracker services.

Returns

A GDBusConnection instance, or NULL if the default is being used.

[transfer none]

Since: 2.0


tracker_sparql_connection_set_dbus_connection ()

void
tracker_sparql_connection_set_dbus_connection
                               (GDBusConnection *dbus_connection);

By default, a connection is opened to the session-wide Tracker services running on the D-Bus session bus. This function allows you to connect to Tracker services that are running on a different bus.

This function must be called before any tracker_sparql_connection_get() calls happen.

See also: the TRACKER_IPC_BUS environment variable.

Parameters

dbus_connection

A GDBusConnection to a suitable message bus.

 

Since: 2.2

Types and Values

enum TrackerSparqlError

Members

TRACKER_SPARQL_ERROR_PARSE

   

TRACKER_SPARQL_ERROR_UNKNOWN_CLASS

   

TRACKER_SPARQL_ERROR_UNKNOWN_PROPERTY

   

TRACKER_SPARQL_ERROR_TYPE

   

TRACKER_SPARQL_ERROR_CONSTRAINT

   

TRACKER_SPARQL_ERROR_NO_SPACE

   

TRACKER_SPARQL_ERROR_INTERNAL

   

TRACKER_SPARQL_ERROR_UNSUPPORTED

   

struct TrackerSparqlConnection

struct TrackerSparqlConnection {
	GObject parent_instance;
	TrackerSparqlConnectionPrivate * priv;
};

The TrackerSparqlConnection object represents a connection with the Tracker store or databases depending on direct or non-direct requests.


enum TrackerSparqlConnectionFlags

Members

TRACKER_SPARQL_CONNECTION_FLAGS_NONE

   

TRACKER_SPARQL_CONNECTION_FLAGS_READONLY