![]() |
![]() |
![]() |
Tracker Client Library Reference Manual | |
---|---|---|---|---|
Top | Description |
void (*TrackerReplyArray) (gchar **result, GError *error, gpointer user_data); void (*TrackerReplyGPtrArray) (GPtrArray *result, GError *error, gpointer user_data); void (*TrackerReplyVoid) (GError *error, gpointer user_data); void tracker_resources_load (TrackerClient *client, const gchar *uri, GError **error); GPtrArray * tracker_resources_sparql_query (TrackerClient *client, const gchar *query, GError **error); void tracker_resources_sparql_update (TrackerClient *client, const gchar *query, GError **error); GPtrArray * tracker_resources_sparql_update_blank (TrackerClient *client, const gchar *query, GError **error); void tracker_resources_batch_sparql_update (TrackerClient *client, const gchar *query, GError **error); void tracker_resources_batch_commit (TrackerClient *client, GError **error); guint tracker_resources_load_async (TrackerClient *client, const gchar *uri, TrackerReplyVoid callback, gpointer user_data); guint tracker_resources_sparql_query_async (TrackerClient *client, const gchar *query, TrackerReplyGPtrArray callback, gpointer user_data); guint tracker_resources_sparql_update_async (TrackerClient *client, const gchar *query, TrackerReplyVoid callback, gpointer user_data); guint tracker_resources_sparql_update_blank_async (TrackerClient *client, const gchar *query, TrackerReplyGPtrArray callback, gpointer user_data); guint tracker_resources_batch_sparql_update_async (TrackerClient *client, const gchar *query, TrackerReplyVoid callback, gpointer user_data); guint tracker_resources_batch_commit_async (TrackerClient *client, TrackerReplyVoid callback, gpointer user_data);
void (*TrackerReplyArray) (gchar **result, GError *error, gpointer user_data);
This is used by the old tracker_search_* API and is deprecated.
|
a gchar ** with the results of the query. |
|
a GError. |
|
a gpointer for user data. |
void (*TrackerReplyGPtrArray) (GPtrArray *result, GError *error, gpointer user_data);
The returned GPtrArray contains an array of GStrv with the
results from the query unless there is an error in the query. If
there is an error the error
is populated with the details.
|
a GPtrArray with the results of the query. |
|
a GError. |
|
a gpointer for user data. |
void (*TrackerReplyVoid) (GError *error, gpointer user_data);
If there is an error the error
is populated with the details.
|
a GError. |
|
a gpointer for user data. |
void tracker_resources_load (TrackerClient *client, const gchar *uri, GError **error);
|
|
|
|
|
GPtrArray * tracker_resources_sparql_query (TrackerClient *client, const gchar *query, GError **error);
Queries the database using SPARQL. For more information about SPARQL see:
http://www.w3.org/TR/rdf-sparql-query/
The ontology used in Tracker mostly follows Nepomuk:
http://nepomuk.semanticdesktop.org/
An example query would be:
Example 1. Using tracker_resource_sparql_query()
tracker_resource_sparql_query()
to list all
albums by title and include their song count and song total length.
TrackerClient *client; GPtrArray *array; GError *error = NULL; const gchar *query; // Create D-Bus connection with no warnings and no timeout. client = tracker_connect (FALSE, 0); query = "SELECT" " ?album" " ?title" " COUNT(?song) AS songs" " SUM(?length) AS totallength" "WHERE {" " ?album a nmm:MusicAlbum ;" " nie:title ?title ." " ?song nmm:musicAlbum ?album ;" " nmm:length ?length" "} " "GROUP BY ?album"); array = tracker_resources_sparql_query (client, query, &error); if (error) { g_warning ("Could not query Tracker, %s", error->message); g_error_free (error); tracker_disconnect (client); return; } // Do something with the array g_ptr_array_free (array, TRUE);
This API call is completely synchronous so it may block.
|
a TrackerClient. |
|
a string representing SPARQL. |
|
a GError. |
Returns : |
A GPtrArray with the query results which must be freed
using g_ptr_array_free() .
|
void tracker_resources_sparql_update (TrackerClient *client, const gchar *query, GError **error);
Updates the database using SPARQL.
This API behaves the same way tracker_resources_sparql_query()
does
but with the difference that it is intended to be used for data
updates.
This API call is completely synchronous so it may block.
|
a TrackerClient. |
|
a string representing SPARQL. |
|
a GError. |
GPtrArray * tracker_resources_sparql_update_blank (TrackerClient *client, const gchar *query, GError **error);
|
|
|
|
|
|
Returns : |
void tracker_resources_batch_sparql_update (TrackerClient *client, const gchar *query, GError **error);
|
|
|
|
|
void tracker_resources_batch_commit (TrackerClient *client, GError **error);
|
|
|
guint tracker_resources_load_async (TrackerClient *client, const gchar *uri, TrackerReplyVoid callback, gpointer user_data);
|
|
|
|
|
|
|
|
Returns : |
guint tracker_resources_sparql_query_async (TrackerClient *client, const gchar *query, TrackerReplyGPtrArray callback, gpointer user_data);
|
|
|
|
|
|
|
|
Returns : |
guint tracker_resources_sparql_update_async (TrackerClient *client, const gchar *query, TrackerReplyVoid callback, gpointer user_data);
|
|
|
|
|
|
|
|
Returns : |
guint tracker_resources_sparql_update_blank_async (TrackerClient *client, const gchar *query, TrackerReplyGPtrArray callback, gpointer user_data);
|
|
|
|
|
|
|
|
Returns : |
guint tracker_resources_batch_sparql_update_async (TrackerClient *client, const gchar *query, TrackerReplyVoid callback, gpointer user_data);
|
|
|
|
|
|
|
|
Returns : |
guint tracker_resources_batch_commit_async (TrackerClient *client, TrackerReplyVoid callback, gpointer user_data);
|
|
|
|
|
|
Returns : |