From 7579d59222ce40f0b2d3f40170199d2b58a5cee9 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Fri, 19 Mar 2021 21:13:31 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/gnome-online-miners.git#da7131a4985419f3ec39a48290b7094028e06438 --- gnome-online-miners.spec | 45 +- tracker3.patch | 1554 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 1575 insertions(+), 24 deletions(-) create mode 100644 tracker3.patch diff --git a/gnome-online-miners.spec b/gnome-online-miners.spec index 18038a1..2a48ba4 100644 --- a/gnome-online-miners.spec +++ b/gnome-online-miners.spec @@ -4,26 +4,29 @@ Name: gnome-online-miners Version: 3.34.0 -Release: 6%{?dist} +Release: 8%{?dist} Summary: Crawls through your online content License: GPLv2+ and LGPLv2+ and MIT URL: https://wiki.gnome.org/Projects/GnomeOnlineMiners Source0: https://download.gnome.org/sources/%{name}/3.34/%{name}-%{version}.tar.xz +# https://gitlab.gnome.org/GNOME/gnome-online-miners/-/merge_requests/3 +Patch0: tracker3.patch + +# For patch0 +BuildRequires: autoconf automake libtool +BuildRequires: autoconf-archive + BuildRequires: gfbgraph-devel BuildRequires: glib2-devel >= 2.35.1 BuildRequires: gnome-online-accounts-devel >= 3.8.0 BuildRequires: grilo-devel >= 0.3.0 BuildRequires: libgdata-devel >= 0.15.2 -%if 0%{?fedora} -BuildRequires: libzapojit-devel >= 0.0.2 -%endif - +BuildRequires: make BuildRequires: pkgconfig -BuildRequires: tracker-devel >= 0.17.2 -BuildRequires: make +BuildRequires: tracker3-devel Requires: dbus Requires: grilo-plugins @@ -36,19 +39,17 @@ Google, OneDrive and Nextcloud. %prep -%setup -q +%autosetup -p1 %build +# For patch0 +autoreconf -fi + %configure \ --disable-silent-rules \ --disable-static \ -%if 0%{?fedora} - --enable-owncloud \ - --enable-windows-live -%else --disable-owncloud \ --disable-windows-live -%endif make %{?_smp_mflags} @@ -70,11 +71,6 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name} %{_datadir}/dbus-1/services/org.gnome.OnlineMiners.GData.service %{_datadir}/dbus-1/services/org.gnome.OnlineMiners.MediaServer.service -%if 0%{?fedora} -%{_datadir}/dbus-1/services/org.gnome.OnlineMiners.Owncloud.service -%{_datadir}/dbus-1/services/org.gnome.OnlineMiners.Zpj.service -%endif - %dir %{_libdir}/%{name} %{_libdir}/%{name}/libgom-1.0.so @@ -83,18 +79,19 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name} %{_libexecdir}/gom-gdata-miner %{_libexecdir}/gom-media-server-miner -%if 0%{?fedora} -%{_libexecdir}/gom-owncloud-miner -%{_libexecdir}/gom-zpj-miner -%endif - %changelog +* Tue Mar 16 2021 Debarshi Ray - 3.34.0-8 +- Disable unused gnome-documents-specific miners + +* Mon Mar 15 2021 Kalev Lember - 3.34.0-7 +- Backport patches for Tracker 3 support + * Tue Jan 26 2021 Fedora Release Engineering - 3.34.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Wed Jan 06 2021 Debarshi Ray - 3.34.0-5 -- Disable unused gnome-documents-specific miners +- Disable unused gnome-documents-specific miners from RHEL * Sat Aug 01 2020 Fedora Release Engineering - 3.34.0-4 - Second attempt - Rebuilt for diff --git a/tracker3.patch b/tracker3.patch new file mode 100644 index 0000000..c948f65 --- /dev/null +++ b/tracker3.patch @@ -0,0 +1,1554 @@ +From 53869ebc2783c9d08bb32d59c543ab692770c121 Mon Sep 17 00:00:00 2001 +From: Sam Thursfield +Date: Fri, 15 May 2020 01:11:24 +0200 +Subject: [PATCH 1/5] Use GInitable interface for GomMiner class + +This allows for better error reporting. +--- + src/gom-application.c | 7 +++++- + src/gom-miner.c | 58 +++++++++++++++++++++++++++++-------------- + 2 files changed, 45 insertions(+), 20 deletions(-) + +diff --git a/src/gom-application.c b/src/gom-application.c +index fadd388..bfa99ec 100644 +--- a/src/gom-application.c ++++ b/src/gom-application.c +@@ -229,10 +229,15 @@ gom_application_constructed (GObject *object) + { + GomApplication *self = GOM_APPLICATION (object); + const gchar *display_name; ++ GError *error = NULL; + + G_OBJECT_CLASS (gom_application_parent_class)->constructed (object); + +- self->miner = g_object_new (self->miner_type, NULL); ++ self->miner = g_initable_new (self->miner_type, NULL, &error, NULL); ++ ++ if (self->miner == NULL) ++ g_error ("%s", error->message); ++ + display_name = gom_miner_get_display_name (self->miner); + gom_dbus_set_display_name (self->skeleton, display_name); + } +diff --git a/src/gom-miner.c b/src/gom-miner.c +index 7147b33..1dd9bb8 100644 +--- a/src/gom-miner.c ++++ b/src/gom-miner.c +@@ -28,7 +28,11 @@ + + #include "gom-miner.h" + +-G_DEFINE_TYPE (GomMiner, gom_miner, G_TYPE_OBJECT) ++static void gom_miner_initable_interface_init (GInitableIface *iface); ++ ++G_DEFINE_TYPE_WITH_CODE (GomMiner, gom_miner, G_TYPE_OBJECT, ++ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gom_miner_initable_interface_init)) ++ + + struct _GomMinerPrivate { + GoaClient *client; +@@ -132,20 +136,21 @@ gom_miner_dispose (GObject *object) + } + + static void +-gom_miner_init_goa (GomMiner *self) ++gom_miner_init_goa (GomMiner *self, ++ GError **error) + { + GoaAccount *account; + GoaObject *object; + const gchar *provider_type; + GList *accounts, *l; + GomMinerClass *miner_class = GOM_MINER_GET_CLASS (self); ++ GError *inner_error = NULL; + +- self->priv->client = goa_client_new_sync (NULL, &self->priv->client_error); ++ self->priv->client = goa_client_new_sync (NULL, &inner_error); + +- if (self->priv->client_error != NULL) ++ if (inner_error) + { +- g_critical ("Unable to create GoaClient: %s - indexing for %s will not work", +- self->priv->client_error->message, miner_class->goa_provider_type); ++ g_propagate_error (error, inner_error); + return; + } + +@@ -170,16 +175,34 @@ gom_miner_init_goa (GomMiner *self) + g_list_free_full (accounts, g_object_unref); + } + +-static void +-gom_miner_constructed (GObject *obj) ++static gboolean ++gom_miner_initable_init (GInitable *initable, ++ GCancellable *cancellable, ++ GError **error) + { +- GomMiner *self = GOM_MINER (obj); ++ GError *inner_error = NULL; ++ GomMiner *self; + +- G_OBJECT_CLASS (gom_miner_parent_class)->constructed (obj); ++ self = GOM_MINER (initable); + +- gom_miner_init_goa (self); ++ self->priv->connection = tracker_sparql_connection_get (cancellable, &inner_error); ++ if (inner_error) ++ { ++ g_propagate_prefixed_error (error, inner_error, "Unable to connect to Tracker store: "); ++ return FALSE; ++ } ++ ++ gom_miner_init_goa (self, &inner_error); ++ if (inner_error) ++ { ++ g_propagate_prefixed_error (error, inner_error, "Unable to connect to GNOME Online Accounts: "); ++ return FALSE; ++ } ++ ++ return TRUE; + } + ++ + static void + gom_miner_init (GomMiner *self) + { +@@ -187,14 +210,12 @@ gom_miner_init (GomMiner *self) + + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GOM_TYPE_MINER, GomMinerPrivate); + self->priv->display_name = g_strdup (""); ++} + +- self->priv->connection = tracker_sparql_connection_get (NULL, &self->priv->connection_error); +- if (self->priv->connection_error != NULL) +- { +- g_critical ("Unable to create TrackerSparqlConnection: %s - indexing for %s will not work", +- self->priv->connection_error->message, +- klass->goa_provider_type); +- } ++static void ++gom_miner_initable_interface_init (GInitableIface *iface) ++{ ++ iface->init = gom_miner_initable_init; + } + + static void +@@ -202,7 +223,6 @@ gom_miner_class_init (GomMinerClass *klass) + { + GObjectClass *oclass = G_OBJECT_CLASS (klass); + +- oclass->constructed = gom_miner_constructed; + oclass->dispose = gom_miner_dispose; + + cleanup_pool = g_thread_pool_new (cleanup_job, NULL, 1, FALSE, NULL); +-- +GitLab + + +From a2b53970e1c1486a61a1522010e345732ed6ca54 Mon Sep 17 00:00:00 2001 +From: Sam Thursfield +Date: Fri, 15 May 2020 01:19:58 +0200 +Subject: [PATCH 2/5] Initial port to Tracker 3 + +Each miner now stores its data in a private Tracker database, under +the $XDG_CACHE_HOME/gnome-online-miners/$busname directory. + +Each miner now supports the org.freedesktop.Tracker3.Endpoint D-Bus +interface which apps can use to query data directly from the miners. +--- + configure.ac | 4 +- + src/gom-application.c | 4 +- + src/gom-miner.c | 120 +++++++++++++++++++++++++++++++++++++++++- + src/gom-miner.h | 1 + + src/gom-tracker.c | 2 +- + 5 files changed, 125 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index e91e4af..8ee6315 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -21,7 +21,7 @@ AC_HEADER_STDC + + GDATA_MIN_VERSION=0.15.2 + GFBGRAPH_MIN_VERSION=0.2.2 +-GLIB_MIN_VERSION=2.35.1 ++GLIB_MIN_VERSION=2.56.0 + GOA_MIN_VERSION=3.13.3 + GRILO_MIN_VERSION=0.3.0 + ZAPOJIT_MIN_VERSION=0.0.2 +@@ -36,7 +36,7 @@ PKG_CHECK_MODULES(GIO, [gio-2.0 gio-unix-2.0]) + PKG_CHECK_MODULES(GOA, [goa-1.0 >= $GOA_MIN_VERSION]) + AC_DEFINE([GOA_API_IS_SUBJECT_TO_CHANGE], [], [We are aware that GOA's API can change]) + +-PKG_CHECK_MODULES(TRACKER, [tracker-miner-2.0 tracker-sparql-2.0]) ++PKG_CHECK_MODULES(TRACKER, [tracker-sparql-3.0]) + + # Facebook + AC_ARG_ENABLE([facebook], [AS_HELP_STRING([--enable-facebook], [Enable Facebook miner])], [], [enable_facebook=yes]) +diff --git a/src/gom-application.c b/src/gom-application.c +index bfa99ec..86546ed 100644 +--- a/src/gom-application.c ++++ b/src/gom-application.c +@@ -233,7 +233,9 @@ gom_application_constructed (GObject *object) + + G_OBJECT_CLASS (gom_application_parent_class)->constructed (object); + +- self->miner = g_initable_new (self->miner_type, NULL, &error, NULL); ++ self->miner = g_initable_new (self->miner_type, NULL, &error, ++ "bus-name", g_application_get_application_id (G_APPLICATION (self)), ++ NULL); + + if (self->miner == NULL) + g_error ("%s", error->message); +diff --git a/src/gom-miner.c b/src/gom-miner.c +index 1dd9bb8..f349d01 100644 +--- a/src/gom-miner.c ++++ b/src/gom-miner.c +@@ -38,7 +38,9 @@ struct _GomMinerPrivate { + GoaClient *client; + GError *client_error; + ++ gchar *bus_name; + TrackerSparqlConnection *connection; ++ TrackerEndpointDBus *endpoint; + GError *connection_error; + + gchar *display_name; +@@ -62,6 +64,14 @@ typedef struct { + gpointer service; + } InsertSharedContentData; + ++typedef enum ++{ ++ PROP_BUS_NAME = 1, ++ N_PROPERTIES ++} GomMinerProperty; ++ ++static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, }; ++ + static GThreadPool *cleanup_pool; + + static void cleanup_job (gpointer data, gpointer user_data); +@@ -135,6 +145,58 @@ gom_miner_dispose (GObject *object) + G_OBJECT_CLASS (gom_miner_parent_class)->dispose (object); + } + ++static void ++gom_miner_init_database (GomMiner *self, ++ GCancellable *cancellable, ++ GError **error) ++{ ++ TrackerSparqlConnectionFlags flags; ++ g_autoptr (GFile) store_path = NULL; ++ g_autoptr (GDBusConnection) bus = NULL; ++ GError *inner_error = NULL; ++ ++ flags = TRACKER_SPARQL_CONNECTION_FLAGS_FTS_ENABLE_STEMMER | ++ TRACKER_SPARQL_CONNECTION_FLAGS_FTS_ENABLE_UNACCENT | ++ TRACKER_SPARQL_CONNECTION_FLAGS_FTS_ENABLE_STOP_WORDS | ++ TRACKER_SPARQL_CONNECTION_FLAGS_FTS_IGNORE_NUMBERS; ++ ++ store_path = g_file_new_build_filename (g_get_user_cache_dir (), ++ "gnome-online-miners", ++ self->priv->bus_name, ++ NULL); ++ ++ self->priv->connection = tracker_sparql_connection_new (flags, ++ store_path, ++ tracker_sparql_get_ontology_nepomuk (), ++ cancellable, ++ &inner_error); ++ ++ if (inner_error) ++ { ++ g_propagate_error (error, inner_error); ++ return; ++ } ++ ++ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &inner_error); ++ ++ if (inner_error) ++ { ++ g_propagate_error (error, inner_error); ++ return; ++ } ++ ++ self->priv->endpoint = tracker_endpoint_dbus_new (self->priv->connection, ++ bus, ++ NULL, /* object path */ ++ cancellable, ++ &inner_error); ++ if (inner_error) ++ { ++ g_propagate_error (error, inner_error); ++ return; ++ } ++} ++ + static void + gom_miner_init_goa (GomMiner *self, + GError **error) +@@ -185,10 +247,10 @@ gom_miner_initable_init (GInitable *initable, + + self = GOM_MINER (initable); + +- self->priv->connection = tracker_sparql_connection_get (cancellable, &inner_error); ++ gom_miner_init_database (self, cancellable, &inner_error); + if (inner_error) + { +- g_propagate_prefixed_error (error, inner_error, "Unable to connect to Tracker store: "); ++ g_propagate_prefixed_error (error, inner_error, "Unable to set up Tracker database: "); + return FALSE; + } + +@@ -212,6 +274,47 @@ gom_miner_init (GomMiner *self) + self->priv->display_name = g_strdup (""); + } + ++static void ++gom_miner_set_property (GObject *object, ++ guint property_id, ++ const GValue *value, ++ GParamSpec *pspec) ++{ ++ GomMiner *self = GOM_MINER (object); ++ ++ switch ((GomMinerProperty) property_id) ++ { ++ case PROP_BUS_NAME: ++ g_free (self->priv->bus_name); ++ self->priv->bus_name = g_value_dup_string (value); ++ break; ++ ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); ++ break; ++ } ++} ++ ++static void ++gom_miner_get_property (GObject *object, ++ guint property_id, ++ GValue *value, ++ GParamSpec *pspec) ++{ ++ GomMiner *self = GOM_MINER (object); ++ ++ switch ((GomMinerProperty) property_id) ++ { ++ case PROP_BUS_NAME: ++ g_value_set_string (value, self->priv->bus_name); ++ break; ++ ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); ++ break; ++ } ++} ++ + static void + gom_miner_initable_interface_init (GInitableIface *iface) + { +@@ -224,6 +327,19 @@ gom_miner_class_init (GomMinerClass *klass) + GObjectClass *oclass = G_OBJECT_CLASS (klass); + + oclass->dispose = gom_miner_dispose; ++ oclass->set_property = gom_miner_set_property; ++ oclass->get_property = gom_miner_get_property; ++ ++ obj_properties[PROP_BUS_NAME] = g_param_spec_string ("bus-name", ++ "Bus Name", ++ "D-Bus name of the miner", ++ NULL /* default value */, ++ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | ++ G_PARAM_STATIC_STRINGS); ++ ++ g_object_class_install_properties (oclass, ++ N_PROPERTIES, ++ obj_properties); + + cleanup_pool = g_thread_pool_new (cleanup_job, NULL, 1, FALSE, NULL); + +diff --git a/src/gom-miner.h b/src/gom-miner.h +index 8f83139..5dcfc8d 100644 +--- a/src/gom-miner.h ++++ b/src/gom-miner.h +@@ -61,6 +61,7 @@ typedef struct _GomMinerPrivate GomMinerPrivate; + typedef struct { + GomMiner *miner; + TrackerSparqlConnection *connection; ++ gchar *bus_name; + + GoaAccount *account; + GHashTable *services; +diff --git a/src/gom-tracker.c b/src/gom-tracker.c +index 68818c4..5666c16 100644 +--- a/src/gom-tracker.c ++++ b/src/gom-tracker.c +@@ -408,7 +408,7 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection + gchar *retval = NULL; + gchar *select = NULL; + +- g_return_val_if_fail (TRACKER_SPARQL_IS_CONNECTION (connection), NULL); ++ g_return_val_if_fail (TRACKER_IS_SPARQL_CONNECTION (connection), NULL); + g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + g_return_val_if_fail (make != NULL || model != NULL, NULL); +-- +GitLab + + +From 3e77eff8a677c1ecd9aa129094ed857da802d787 Mon Sep 17 00:00:00 2001 +From: Sam Thursfield +Date: Fri, 15 May 2020 01:37:28 +0200 +Subject: [PATCH 3/5] Add DataObject class to our resources + +We need this to set nie:dataSource property. I don't understand +how this worked in the past. +--- + src/gom-tracker.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gom-tracker.c b/src/gom-tracker.c +index 5666c16..63a4c29 100644 +--- a/src/gom-tracker.c ++++ b/src/gom-tracker.c +@@ -208,7 +208,7 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection + insert = g_string_new (NULL); + g_string_append_printf + (insert, +- "INSERT OR REPLACE %s { <%s> a nie:InformationElement ; %s %s }", ++ "INSERT OR REPLACE %s { <%s> a nie:InformationElement, nie:DataObject ; %s %s }", + graph_str, resource, property_name, quoted); + g_free (quoted); + +-- +GitLab + + +From e742a60cf9dea1391d1ff409ce5696d21f423bed Mon Sep 17 00:00:00 2001 +From: Sam Thursfield +Date: Fri, 15 May 2020 02:13:11 +0200 +Subject: [PATCH 4/5] Organize data into content-based graphs + +Previously GOM used a graph per account and per resource but this +cannot be done in Tracker 3. + +In Tracker 3, each graph is stored as a separate SQLite database +and currently a maximum of ten graphs can be included in a single +query due to SQLite's limitations. + +The new layout is modelled after how tracker-miner-fs uses graphs: +we use a graph per content type (Contacts, Documents, Pictures), +plus an extra graph to store accounts and folders/collections. +--- + src/gom-facebook-miner.c | 12 ++--- + src/gom-flickr-miner.c | 24 +++++----- + src/gom-gdata-miner.c | 31 ++++++------ + src/gom-media-server-miner.c | 10 ++-- + src/gom-miner.c | 40 ++++++++++++---- + src/gom-miner.h | 1 - + src/gom-owncloud-miner.c | 22 +++++---- + src/gom-tracker.c | 93 +++++++++++++++++------------------- + src/gom-tracker.h | 14 +++++- + src/gom-zpj-miner.c | 22 ++++----- + 10 files changed, 150 insertions(+), 119 deletions(-) + +diff --git a/src/gom-facebook-miner.c b/src/gom-facebook-miner.c +index ff42ca5..fc89096 100644 +--- a/src/gom-facebook-miner.c ++++ b/src/gom-facebook-miner.c +@@ -70,7 +70,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_PICTURES_GRAPH, identifier, + "nfo:RemoteDataObject", class, NULL); + + if (*error != NULL) +@@ -239,7 +239,7 @@ account_miner_job_process_album (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:url", album_link); + + if (*error != NULL) +@@ -248,7 +248,7 @@ account_miner_job_process_album (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:description", album_description); + + if (*error != NULL) +@@ -257,7 +257,7 @@ account_miner_job_process_album (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:title", album_name); + + if (*error != NULL) +@@ -274,7 +274,7 @@ account_miner_job_process_album (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nco:creator", contact_resource); + g_free (contact_resource); + +@@ -284,7 +284,7 @@ account_miner_job_process_album (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:contentCreated", album_created_time); + + if (*error != NULL) +diff --git a/src/gom-flickr-miner.c b/src/gom-flickr-miner.c +index 9ac338e..dc7349e 100644 +--- a/src/gom-flickr-miner.c ++++ b/src/gom-flickr-miner.c +@@ -143,14 +143,14 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_PICTURES_GRAPH, identifier, + "nfo:RemoteDataObject", class, NULL); + + if (*error != NULL) + goto out; + + gom_tracker_update_datasource (connection, datasource_urn, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -166,7 +166,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + parent_resource_urn = gom_tracker_sparql_connection_ensure_resource + (connection, cancellable, error, + NULL, +- datasource_urn, parent_identifier, ++ TRACKER_PICTURES_GRAPH, parent_identifier, + "nfo:RemoteDataObject", "nfo:DataContainer", NULL); + g_free (parent_identifier); + +@@ -176,7 +176,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:isPartOf", parent_resource_urn); + g_free (parent_resource_urn); + +@@ -187,7 +187,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:title", grl_media_get_title (entry->media)); + + if (*error != NULL) +@@ -202,7 +202,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + created_time = modification_date = grl_media_get_creation_date (entry->media); + new_mtime = g_date_time_to_unix (modification_date); + mtime_changed = gom_tracker_update_mtime (connection, new_mtime, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -221,7 +221,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:contentCreated", date); + g_free (date); + } +@@ -233,7 +233,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:url", url); + + if (*error != NULL) +@@ -242,7 +242,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:description", grl_media_get_description (entry->media)); + + if (*error != NULL) +@@ -254,7 +254,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:mimeType", mime); + g_free (mime); + +@@ -265,7 +265,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + contact_resource = gom_tracker_utils_ensure_contact_resource + (connection, + cancellable, error, +- datasource_urn, grl_media_get_author (entry->media)); ++ TRACKER_PICTURES_GRAPH, grl_media_get_author (entry->media)); + + if (*error != NULL) + goto out; +@@ -273,7 +273,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nco:creator", contact_resource); + g_free (contact_resource); + +diff --git a/src/gom-gdata-miner.c b/src/gom-gdata-miner.c +index 7872431..d0deb80 100644 +--- a/src/gom-gdata-miner.c ++++ b/src/gom-gdata-miner.c +@@ -120,7 +120,7 @@ account_miner_job_process_entry (TrackerSparqlConnection *connection, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_DOCUMENTS_GRAPH, identifier, + "nfo:RemoteDataObject", class, NULL); + + if (*error != NULL) +@@ -187,7 +187,7 @@ account_miner_job_process_entry (TrackerSparqlConnection *connection, + parent_resource_urn = gom_tracker_sparql_connection_ensure_resource + (connection, cancellable, error, + NULL, +- datasource_urn, parent_resource_id, ++ GOM_GRAPH, parent_resource_id, + "nfo:RemoteDataObject", "nfo:DataContainer", NULL); + g_free (parent_resource_id); + +@@ -219,7 +219,7 @@ account_miner_job_process_entry (TrackerSparqlConnection *connection, + gom_tracker_sparql_connection_toggle_favorite + (connection, + cancellable, error, +- resource, starred); ++ TRACKER_PICTURES_GRAPH, resource, starred); + + if (*error != NULL) + goto out; +@@ -400,14 +400,14 @@ account_miner_job_process_photo (TrackerSparqlConnection *connection, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_PICTURES_GRAPH, identifier, + "nfo:RemoteDataObject", "nmm:Photo", NULL); + + if (*error != NULL) + goto out; + + gom_tracker_update_datasource (connection, datasource_urn, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + if (*error != NULL) + goto out; +@@ -566,6 +566,7 @@ account_miner_job_process_photo (TrackerSparqlConnection *connection, + equipment_resource = gom_tracker_utils_ensure_equipment_resource (connection, + cancellable, + error, ++ TRACKER_PICTURES_GRAPH, + make, + model); + +@@ -665,7 +666,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_PICTURES_GRAPH, identifier, + "nfo:RemoteDataObject", "nfo:DataContainer", + NULL); + +@@ -674,7 +675,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + + gom_tracker_update_datasource + (connection, datasource_urn, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -685,7 +686,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + */ + new_mtime = gdata_entry_get_updated (GDATA_ENTRY (album)); + mtime_changed = gom_tracker_update_mtime (connection, new_mtime, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -703,7 +704,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:url", alternate_uri); + + if (*error != NULL) +@@ -713,7 +714,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:description", summary); + + if (*error != NULL) +@@ -723,7 +724,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:title", title); + + if (*error != NULL) +@@ -743,7 +744,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nco:creator", contact_resource); + g_free (contact_resource); + +@@ -755,7 +756,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:contentCreated", date); + g_free (date); + +@@ -865,7 +866,7 @@ insert_shared_content_photos (TrackerSparqlConnection *connection, + if (!gom_tracker_sparql_connection_insert_or_replace_triple (connection, + cancellable, + &local_error, +- datasource_urn, ++ TRACKER_PICTURES_GRAPH, + source_urn, + "nie:relatedTo", + photo_resource_urn)) +@@ -878,7 +879,7 @@ insert_shared_content_photos (TrackerSparqlConnection *connection, + if (!gom_tracker_sparql_connection_insert_or_replace_triple (connection, + cancellable, + &local_error, +- datasource_urn, ++ TRACKER_PICTURES_GRAPH, + photo_resource_urn, + "nie:links", + source_urn)) +diff --git a/src/gom-media-server-miner.c b/src/gom-media-server-miner.c +index 490869e..32e08c6 100644 +--- a/src/gom-media-server-miner.c ++++ b/src/gom-media-server-miner.c +@@ -65,14 +65,14 @@ account_miner_job_process_photo (GomAccountMinerJob *job, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_PICTURES_GRAPH, identifier, + "nfo:RemoteDataObject", class, NULL); + + if (*error != NULL) + goto out; + + gom_tracker_update_datasource (connection, datasource_urn, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + if (*error != NULL) + goto out; +@@ -81,7 +81,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:url", photo->url); + + if (*error != NULL) +@@ -90,7 +90,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:mimeType", photo->mimetype); + + if (*error != NULL) +@@ -99,7 +99,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:title", photo->name); + + if (*error != NULL) +diff --git a/src/gom-miner.c b/src/gom-miner.c +index f349d01..32892fa 100644 +--- a/src/gom-miner.c ++++ b/src/gom-miner.c +@@ -376,7 +376,7 @@ gom_miner_ensure_datasource (GomMiner *self, + " <%s> a nie:DataSource ; nao:identifier \"%s\" . " + " <%s> a nie:InformationElement ; nie:rootElementOf <%s> ; nie:version \"%d\"" + "}", +- datasource_urn, ++ GOM_GRAPH, + datasource_urn, klass->miner_identifier, + root_element_urn, datasource_urn, klass->version); + +@@ -401,8 +401,8 @@ gom_account_miner_job_query_existing (GomAccountMinerJob *job, + + select = g_string_new (NULL); + g_string_append_printf (select, +- "SELECT ?urn nao:identifier(?urn) WHERE { ?urn nie:dataSource <%s> }", +- job->datasource_urn); ++ "SELECT ?urn ?id WHERE { GRAPH <%s> { ?urn nie:dataSource <%s> ; nao:identifier ?id . } }", ++ GOM_GRAPH, job->datasource_urn); + + cursor = tracker_sparql_connection_query (job->connection, + select->str, +@@ -415,9 +415,21 @@ gom_account_miner_job_query_existing (GomAccountMinerJob *job, + + while (tracker_sparql_cursor_next (cursor, cancellable, error)) + { +- g_hash_table_insert (job->previous_resources, +- g_strdup (tracker_sparql_cursor_get_string (cursor, 1, NULL)), +- g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL))); ++ const gchar *urn, *identifier; ++ ++ urn = tracker_sparql_cursor_get_string (cursor, 0, NULL); ++ identifier = tracker_sparql_cursor_get_string (cursor, 1, NULL); ++ ++ if (identifier != NULL) ++ { ++ g_hash_table_insert (job->previous_resources, ++ g_strdup (identifier), ++ g_strdup (urn)); ++ } ++ else ++ { ++ g_warning ("Missing identifier for urn %s", urn); ++ } + } + + g_object_unref (cursor); +@@ -489,16 +501,19 @@ gom_account_miner_job (GTask *task, + if (error != NULL) + goto out; + ++ g_debug ("account miner: Querying existing accounts stored in database"); + gom_account_miner_job_query_existing (job, &error); + + if (error != NULL) + goto out; + ++ g_debug ("account miner: Querying remote server"); + gom_account_miner_job_query (job, &error); + + if (error != NULL) + goto out; + ++ g_debug ("account miner: Removing stale accounts"); + gom_account_miner_job_cleanup_previous (job, &error); + + if (error != NULL) +@@ -752,10 +767,15 @@ cleanup_job (gpointer data, + + /* find all our datasources in the tracker DB */ + select = g_string_new (NULL); +- g_string_append_printf (select, "SELECT ?datasource nie:version(?root) WHERE { " +- "?datasource a nie:DataSource . " +- "?datasource nao:identifier \"%s\" . " +- "OPTIONAL { ?root nie:rootElementOf ?datasource } }", ++ g_string_append_printf (select, ++ "SELECT ?datasource nie:version(?root) WHERE { " ++ " GRAPH <%s> { " ++ " ?datasource a nie:DataSource . " ++ " ?datasource nao:identifier \"%s\" . " ++ " OPTIONAL { ?root nie:rootElementOf ?datasource } " ++ " }" ++ "}", ++ GOM_GRAPH, + klass->miner_identifier); + + cursor = tracker_sparql_connection_query (self->priv->connection, +diff --git a/src/gom-miner.h b/src/gom-miner.h +index 5dcfc8d..8f83139 100644 +--- a/src/gom-miner.h ++++ b/src/gom-miner.h +@@ -61,7 +61,6 @@ typedef struct _GomMinerPrivate GomMinerPrivate; + typedef struct { + GomMiner *miner; + TrackerSparqlConnection *connection; +- gchar *bus_name; + + GoaAccount *account; + GHashTable *services; +diff --git a/src/gom-owncloud-miner.c b/src/gom-owncloud-miner.c +index 34d303b..623f2e1 100644 +--- a/src/gom-owncloud-miner.c ++++ b/src/gom-owncloud-miner.c +@@ -100,14 +100,14 @@ account_miner_job_process_file (GomAccountMinerJob *job, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_DOCUMENTS_GRAPH, identifier, + "nfo:RemoteDataObject", class, NULL); + + if (*error != NULL) + goto out; + + gom_tracker_update_datasource (connection, datasource_urn, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_DOCUMENTS_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -117,7 +117,7 @@ account_miner_job_process_file (GomAccountMinerJob *job, + modification_time = g_date_time_new_from_timeval_local (&tv); + new_mtime = g_date_time_to_unix (modification_time); + mtime_changed = gom_tracker_update_mtime (connection, new_mtime, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_DOCUMENTS_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -133,7 +133,7 @@ account_miner_job_process_file (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_DOCUMENTS_GRAPH, resource, + "nie:url", uri); + + if (*error != NULL) +@@ -156,7 +156,7 @@ account_miner_job_process_file (GomAccountMinerJob *job, + parent_resource_urn = gom_tracker_sparql_connection_ensure_resource + (connection, cancellable, error, + NULL, +- datasource_urn, parent_identifier, ++ GOM_GRAPH, parent_identifier, + "nfo:RemoteDataObject", "nfo:DataContainer", NULL); + g_checksum_reset (checksum); + g_free (parent_identifier); +@@ -168,7 +168,7 @@ account_miner_job_process_file (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_DOCUMENTS_GRAPH, resource, + "nie:isPartOf", parent_resource_urn); + g_free (parent_resource_urn); + +@@ -182,7 +182,7 @@ account_miner_job_process_file (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_DOCUMENTS_GRAPH, resource, + "nie:mimeType", mime); + + if (*error != NULL) +@@ -194,7 +194,7 @@ account_miner_job_process_file (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_DOCUMENTS_GRAPH, resource, + "nfo:fileName", display_name); + + if (*error != NULL) +@@ -416,6 +416,11 @@ query_owncloud (GomAccountMinerJob *job, + mount = g_volume_get_mount (volume); + if (mount == NULL) + { ++ g_autofree gchar *volume_name; ++ ++ volume_name = g_volume_get_name (volume); ++ g_debug ("Mounting Online Account volume %s", volume_name); ++ + data.error = error; + + context = g_main_context_new (); +@@ -436,6 +441,7 @@ query_owncloud (GomAccountMinerJob *job, + } + + root = g_mount_get_root (mount); ++ g_debug ("Got volume from gnome-online-accounts: root is %s", g_file_peek_path (root)); + account_miner_job_traverse_dir (job, connection, previous_resources, datasource_urn, root, TRUE, cancellable, error); + + g_object_unref (root); +diff --git a/src/gom-tracker.c b/src/gom-tracker.c +index 63a4c29..0d1766c 100644 +--- a/src/gom-tracker.c ++++ b/src/gom-tracker.c +@@ -26,16 +26,11 @@ + #include "gom-tracker.h" + #include "gom-utils.h" + +-static gchar * +-_tracker_utils_format_into_graph (const gchar *graph) +-{ +- return (graph != NULL) ? g_strdup_printf ("INTO <%s> ", graph) : g_strdup (""); +-} +- + static gboolean + gom_tracker_sparql_connection_get_string_attribute (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, ++ const gchar *graph, + const gchar *resource, + const gchar *attribute, + gchar **value) +@@ -45,8 +40,8 @@ gom_tracker_sparql_connection_get_string_attribute (TrackerSparqlConnection *con + const gchar *string_value = NULL; + gboolean res; + +- g_string_append_printf (select, "SELECT ?val { <%s> %s ?val }", +- resource, attribute); ++ g_string_append_printf (select, "SELECT ?val { GRAPH <%s> { <%s> %s ?val } }", ++ graph, resource, attribute); + cursor = tracker_sparql_connection_query (connection, + select->str, + cancellable, error); +@@ -86,7 +81,8 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti + const gchar *class, + ...) + { +- GString *select, *insert, *inner; ++ GString *select, *inner; ++ gchar *insert; + va_list args; + const gchar *arg; + TrackerSparqlCursor *cursor; +@@ -98,6 +94,8 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti + gchar *key = NULL, *val = NULL; + gboolean exists = FALSE; + ++ g_return_val_if_fail (graph != NULL, NULL); ++ + /* build the inner query with all the classes */ + va_start (args, class); + inner = g_string_new (NULL); +@@ -112,7 +110,7 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti + /* query if such a resource is already in the DB */ + select = g_string_new (NULL); + g_string_append_printf (select, +- "SELECT ?urn WHERE { ?urn %s }", inner->str); ++ "SELECT ?urn WHERE { GRAPH <%s> { ?urn %s } }", graph, inner->str); + + cursor = tracker_sparql_connection_query (connection, + select->str, +@@ -138,19 +136,12 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti + } + + /* not found, create the resource */ +- insert = g_string_new (NULL); +- graph_str = _tracker_utils_format_into_graph (graph); +- +- g_string_append_printf (insert, "INSERT %s { _:res %s }", +- graph_str, inner->str); +- g_free (graph_str); +- g_string_free (inner, TRUE); +- ++ insert = g_strdup_printf ("INSERT INTO <%s> { _:res %s }", ++ graph, inner->str); + insert_res = +- tracker_sparql_connection_update_blank (connection, insert->str, ++ tracker_sparql_connection_update_blank (connection, insert, + G_PRIORITY_DEFAULT, NULL, error); +- +- g_string_free (insert, TRUE); ++ g_free (insert); + + if (*error != NULL) + goto out; +@@ -194,10 +185,10 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection + const gchar *property_value) + { + GString *insert; +- gchar *graph_str, *quoted; ++ gchar *quoted; + gboolean retval = TRUE; + +- graph_str = _tracker_utils_format_into_graph (graph); ++ g_return_val_if_fail (graph != NULL, FALSE); + + /* the "null" value must not be quoted */ + if (property_value == NULL) +@@ -208,8 +199,8 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection + insert = g_string_new (NULL); + g_string_append_printf + (insert, +- "INSERT OR REPLACE %s { <%s> a nie:InformationElement, nie:DataObject ; %s %s }", +- graph_str, resource, property_name, quoted); ++ "INSERT OR REPLACE INTO <%s> { <%s> a nie:InformationElement, nie:DataObject ; %s %s }", ++ graph, resource, property_name, quoted); + g_free (quoted); + + g_debug ("Insert or replace triple: query %s", insert->str); +@@ -223,8 +214,6 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection + if (*error != NULL) + retval = FALSE; + +- g_free (graph_str); +- + return retval; + } + +@@ -271,6 +260,7 @@ gboolean + gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, ++ const gchar *graph, + const gchar *resource, + gboolean favorite) + { +@@ -279,15 +269,15 @@ gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connecti + gboolean retval = TRUE; + + if (favorite) +- op_str = "INSERT OR REPLACE"; ++ op_str = "INSERT OR REPLACE INTO"; + else +- op_str = "DELETE"; ++ op_str = "DELETE FROM"; + + update = g_string_new (NULL); + g_string_append_printf + (update, +- "%s { <%s> nao:hasTag nao:predefined-tag-favorite }", +- op_str, resource); ++ "%s <%s> { <%s> nao:hasTag nao:predefined-tag-favorite }", ++ op_str, graph, resource); + + g_debug ("Toggle favorite: query %s", update->str); + +@@ -321,9 +311,13 @@ gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection, + mail_uri = g_strconcat ("mailto:", email, NULL); + select = g_string_new (NULL); + g_string_append_printf (select, +- "SELECT ?urn WHERE { ?urn a nco:Contact . " +- "?urn nco:hasEmailAddress ?mail . " +- "FILTER (fn:contains(?mail, \"%s\" )) }", mail_uri); ++ "SELECT ?urn WHERE { " ++ " GRAPH <%s> { " ++ " ?urn a nco:Contact . " ++ " ?urn nco:hasEmailAddress ?mail . " ++ " FILTER (fn:contains(?mail, \"%s\" )) " ++ " }" ++ "}", TRACKER_CONTACTS_GRAPH, mail_uri); + + cursor = tracker_sparql_connection_query (connection, + select->str, +@@ -351,8 +345,9 @@ gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection, + insert = g_string_new (NULL); + + g_string_append_printf (insert, +- "INSERT { <%s> a nco:EmailAddress ; nco:emailAddress \"%s\" . " ++ "INSERT INTO <%s> { <%s> a nco:EmailAddress ; nco:emailAddress \"%s\" . " + "_:res a nco:Contact ; nco:hasEmailAddress <%s> ; nco:fullname \"%s\" . }", ++ TRACKER_CONTACTS_GRAPH, + mail_uri, email, + mail_uri, fullname); + +@@ -397,6 +392,7 @@ gchar * + gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, ++ const gchar *graph, + const gchar *make, + const gchar *model) + { +@@ -416,7 +412,7 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection + equip_uri = tracker_sparql_escape_uri_printf ("urn:equipment:%s:%s:", + make != NULL ? make : "", + model != NULL ? model : ""); +- select = g_strdup_printf ("SELECT <%s> WHERE { }", equip_uri); ++ select = g_strdup_printf ("ASK { GRAPH <%s> { <%s> a nfo:Equipment } }", graph, equip_uri); + + local_error = NULL; + cursor = tracker_sparql_connection_query (connection, select, cancellable, &local_error); +@@ -436,20 +432,19 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection + + if (res) + { +- const gchar *cursor_uri; +- +- cursor_uri = tracker_sparql_cursor_get_string (cursor, 0, NULL); +- if (g_strcmp0 (cursor_uri, equip_uri) == 0) ++ if (tracker_sparql_cursor_get_boolean (cursor, 0)) + { +- /* return the found resource */ +- retval = g_strdup (cursor_uri); ++ /* The resource exists */ ++ retval = equip_uri; ++ equip_uri = NULL; + g_debug ("Found resource in the store: %s", retval); + goto out; + } + } + + /* not found, create the resource */ +- insert = g_strdup_printf ("INSERT { <%s> a nfo:Equipment ; nfo:manufacturer \"%s\" ; nfo:model \"%s\" }", ++ insert = g_strdup_printf ("INSERT INTO <%s> { <%s> a nfo:Equipment ; nfo:manufacturer \"%s\" ; nfo:model \"%s\" }", ++ graph, + equip_uri, + make, + model); +@@ -480,7 +475,7 @@ void + gom_tracker_update_datasource (TrackerSparqlConnection *connection, + const gchar *datasource_urn, + gboolean resource_exists, +- const gchar *identifier, ++ const gchar *graph, + const gchar *resource, + GCancellable *cancellable, + GError **error) +@@ -498,7 +493,7 @@ gom_tracker_update_datasource (TrackerSparqlConnection *connection, + + res = gom_tracker_sparql_connection_get_string_attribute + (connection, cancellable, error, +- resource, "nie:dataSource", &old_value); ++ graph, resource, "nie:dataSource", &old_value); + g_clear_error (error); + + if (res) +@@ -514,7 +509,7 @@ gom_tracker_update_datasource (TrackerSparqlConnection *connection, + if (set_datasource) + gom_tracker_sparql_connection_set_triple + (connection, cancellable, error, +- identifier, resource, ++ graph, resource, + "nie:dataSource", datasource_urn); + } + +@@ -522,7 +517,7 @@ gboolean + gom_tracker_update_mtime (TrackerSparqlConnection *connection, + gint64 new_mtime, + gboolean resource_exists, +- const gchar *identifier, ++ const gchar *graph, + const gchar *resource, + GCancellable *cancellable, + GError **error) +@@ -536,7 +531,7 @@ gom_tracker_update_mtime (TrackerSparqlConnection *connection, + { + res = gom_tracker_sparql_connection_get_string_attribute + (connection, cancellable, error, +- resource, "nie:contentLastModified", &old_value); ++ graph, resource, "nie:contentLastModified", &old_value); + g_clear_error (error); + + if (res) +@@ -552,7 +547,7 @@ gom_tracker_update_mtime (TrackerSparqlConnection *connection, + date = gom_iso8601_from_timestamp (new_mtime); + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, cancellable, error, +- identifier, resource, ++ graph, resource, + "nie:contentLastModified", date); + g_free (date); + +diff --git a/src/gom-tracker.h b/src/gom-tracker.h +index 94a39e8..a5ae6fd 100644 +--- a/src/gom-tracker.h ++++ b/src/gom-tracker.h +@@ -29,6 +29,14 @@ + + G_BEGIN_DECLS + ++/* The graph where we store account meta information */ ++#define GOM_GRAPH "tracker.api.gnome.org/ontology/v3/gnome-online-miners" ++ ++/* Graphs where we store content information */ ++#define TRACKER_CONTACTS_GRAPH "http://tracker.api.gnome.org/ontology/v3/tracker#Contacts" ++#define TRACKER_DOCUMENTS_GRAPH "http://tracker.api.gnome.org/ontology/v3/tracker#Documents" ++#define TRACKER_PICTURES_GRAPH "http://tracker.api.gnome.org/ontology/v3/tracker#Pictures" ++ + gchar *gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, +@@ -57,6 +65,7 @@ gboolean gom_tracker_sparql_connection_set_triple (TrackerSparqlConnection *conn + gboolean gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, ++ const gchar *graph, + const gchar *resource, + gboolean favorite); + +@@ -69,20 +78,21 @@ gchar* gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *conne + gchar *gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, ++ const gchar *graph, + const gchar *make, + const gchar *model); + + void gom_tracker_update_datasource (TrackerSparqlConnection *connection, + const gchar *datasource_urn, + gboolean resource_exists, +- const gchar *identifier, ++ const gchar *graph, + const gchar *resource, + GCancellable *cancellable, + GError **error); + gboolean gom_tracker_update_mtime (TrackerSparqlConnection *connection, + gint64 new_mtime, + gboolean resource_exists, +- const gchar *identifier, ++ const gchar *graph, + const gchar *resource, + GCancellable *cancellable, + GError **error); +diff --git a/src/gom-zpj-miner.c b/src/gom-zpj-miner.c +index 6dff947..1372de5 100644 +--- a/src/gom-zpj-miner.c ++++ b/src/gom-zpj-miner.c +@@ -70,14 +70,14 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + (connection, + cancellable, error, + &resource_exists, +- datasource_urn, identifier, ++ TRACKER_PICTURES_GRAPH, identifier, + "nfo:RemoteDataObject", class, NULL); + + if (*error != NULL) + goto out; + + gom_tracker_update_datasource (connection, datasource_urn, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -86,7 +86,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + updated_time = zpj_skydrive_entry_get_updated_time (entry); + new_mtime = g_date_time_to_unix (updated_time); + mtime_changed = gom_tracker_update_mtime (connection, new_mtime, +- resource_exists, identifier, resource, ++ resource_exists, TRACKER_PICTURES_GRAPH, resource, + cancellable, error); + + if (*error != NULL) +@@ -102,7 +102,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:url", identifier); + + if (*error != NULL) +@@ -119,7 +119,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + parent_resource_urn = gom_tracker_sparql_connection_ensure_resource + (connection, cancellable, error, + NULL, +- datasource_urn, parent_identifier, ++ TRACKER_PICTURES_GRAPH, parent_identifier, + "nfo:RemoteDataObject", "nfo:DataContainer", NULL); + g_free (parent_identifier); + +@@ -129,7 +129,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:isPartOf", parent_resource_urn); + g_free (parent_resource_urn); + +@@ -142,7 +142,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:mimeType", mime); + g_free (mime); + +@@ -154,7 +154,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:description", zpj_skydrive_entry_get_description (entry)); + + if (*error != NULL) +@@ -163,7 +163,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nfo:fileName", name); + + if (*error != NULL) +@@ -180,7 +180,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nco:creator", contact_resource); + g_free (contact_resource); + +@@ -192,7 +192,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job, + gom_tracker_sparql_connection_insert_or_replace_triple + (connection, + cancellable, error, +- datasource_urn, resource, ++ TRACKER_PICTURES_GRAPH, resource, + "nie:contentCreated", date); + g_free (date); + +-- +GitLab + + +From 34259944dd9e6e167663c97080142f6e8b7f00f2 Mon Sep 17 00:00:00 2001 +From: Sam Thursfield +Date: Mon, 27 Jul 2020 23:48:49 +0200 +Subject: [PATCH 5/5] Update for API changes in Tracker 2.99 + +--- + src/gom-miner.c | 3 --- + src/gom-tracker.c | 22 ++++++---------------- + 2 files changed, 6 insertions(+), 19 deletions(-) + +diff --git a/src/gom-miner.c b/src/gom-miner.c +index 32892fa..d9ccf67 100644 +--- a/src/gom-miner.c ++++ b/src/gom-miner.c +@@ -382,7 +382,6 @@ gom_miner_ensure_datasource (GomMiner *self, + + tracker_sparql_connection_update (self->priv->connection, + datasource_insert->str, +- G_PRIORITY_DEFAULT, + cancellable, + error); + +@@ -469,7 +468,6 @@ gom_account_miner_job_cleanup_previous (GomAccountMinerJob *job, + + tracker_sparql_connection_update (job->connection, + delete->str, +- G_PRIORITY_DEFAULT, + cancellable, + error); + +@@ -709,7 +707,6 @@ cleanup_job_do_cleanup (CleanupJob *job, GCancellable *cancellable) + + tracker_sparql_connection_update (self->priv->connection, + update->str, +- G_PRIORITY_DEFAULT, + cancellable, + &error); + g_string_free (update, TRUE); +diff --git a/src/gom-tracker.c b/src/gom-tracker.c +index 0d1766c..5f49f73 100644 +--- a/src/gom-tracker.c ++++ b/src/gom-tracker.c +@@ -138,9 +138,7 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti + /* not found, create the resource */ + insert = g_strdup_printf ("INSERT INTO <%s> { _:res %s }", + graph, inner->str); +- insert_res = +- tracker_sparql_connection_update_blank (connection, insert, +- G_PRIORITY_DEFAULT, NULL, error); ++ insert_res = tracker_sparql_connection_update_blank (connection, insert, NULL, error); + g_free (insert); + + if (*error != NULL) +@@ -205,9 +203,7 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection + + g_debug ("Insert or replace triple: query %s", insert->str); + +- tracker_sparql_connection_update (connection, insert->str, +- G_PRIORITY_DEFAULT, cancellable, +- error); ++ tracker_sparql_connection_update (connection, insert->str, cancellable, error); + + g_string_free (insert, TRUE); + +@@ -235,9 +231,7 @@ gom_tracker_sparql_connection_set_triple (TrackerSparqlConnection *connection, + "DELETE { <%s> %s ?val } WHERE { <%s> %s ?val }", resource, + property_name, resource, property_name); + +- tracker_sparql_connection_update (connection, delete->str, +- G_PRIORITY_DEFAULT, cancellable, +- error); ++ tracker_sparql_connection_update (connection, delete->str, cancellable, error); + + g_string_free (delete, TRUE); + if (*error != NULL) +@@ -281,9 +275,7 @@ gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connecti + + g_debug ("Toggle favorite: query %s", update->str); + +- tracker_sparql_connection_update (connection, update->str, +- G_PRIORITY_DEFAULT, cancellable, +- error); ++ tracker_sparql_connection_update (connection, update->str, cancellable, error); + + g_string_free (update, TRUE); + +@@ -351,9 +343,7 @@ gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection, + mail_uri, email, + mail_uri, fullname); + +- insert_res = +- tracker_sparql_connection_update_blank (connection, insert->str, +- G_PRIORITY_DEFAULT, cancellable, error); ++ insert_res = tracker_sparql_connection_update_blank (connection, insert->str, cancellable, error); + + g_string_free (insert, TRUE); + +@@ -450,7 +440,7 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection + model); + + local_error = NULL; +- tracker_sparql_connection_update (connection, insert, G_PRIORITY_DEFAULT, cancellable, &local_error); ++ tracker_sparql_connection_update (connection, insert, cancellable, &local_error); + if (local_error != NULL) + { + g_propagate_error (error, local_error); +-- +GitLab +