blob: eb52ac3166c5b785dfbdedb7f797da085791cef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <libtracker-sparql/tracker-sparql.h>
int main (int argc, const char **argv)
{
GError *error = NULL;
TrackerSparqlConnection *connection;
const gchar *query =
"INSERT { "
" _:tag a nao:Tag ; "
" nao:prefLabel 'mylabel' . "
"} WHERE { "
" OPTIONAL { "
" ?tag a nao:Tag ; "
" nao:prefLabel 'mylabel' "
" } . "
"FILTER (!bound(?tag)) "
"}";
connection = tracker_sparql_connection_bus_new ("org.freedesktop.Tracker3.Miner.Files", NULL, NULL, &error);
if (!connection) {
g_printerr ("Couldn't obtain a connection to the Tracker store: %s",
error ? error->message : "unknown error");
g_clear_error (&error);
return 1;
}
/* Run a synchronous update query */
tracker_sparql_connection_update (connection,
query,
G_PRIORITY_DEFAULT,
NULL,
&error);
if (error) {
/* Some error happened performing the query, not good */
g_printerr ("Couldn't update the Tracker store: %s",
error ? error->message : "unknown error");
g_clear_error (&error);
g_object_unref (connection);
return 1;
}
g_object_unref (connection);
return 0;
}
|