[tracker-miners/wip/carlosg/moved-files: 1/4] tracker-miner-fs: Handle moving nfo:FileDataObject information in data graphs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/moved-files: 1/4] tracker-miner-fs: Handle moving nfo:FileDataObject information in data graphs
- Date: Tue, 15 Sep 2020 13:47:40 +0000 (UTC)
commit 82c728f878858611d2e3793dcecd5ac67d2ca0e9
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Sep 15 13:04:32 2020 +0200
tracker-miner-fs: Handle moving nfo:FileDataObject information in data graphs
If a file/dir is renamed, we handled both the nie:InformationElement in the
data graphs, and the nfo:FileDataObject in the filesystem graph. This got
broken when we started adding the nfo:FileDataObject shim information in the
data graphs.
Handle this, and split/comment the other queries so the role of each one is
clearer.
Fixes: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/136
src/miners/fs/tracker-miner-files.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index c8670c3ca..4b4c25a61 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2467,6 +2467,7 @@ miner_files_move_file (TrackerMinerFS *fs,
g_free (new_parent_id);
}
+ /* Update nie:isStoredAs in the nie:InformationElement */
g_string_append_printf (sparql,
"DELETE { "
" GRAPH ?g {"
@@ -2480,7 +2481,10 @@ miner_files_move_file (TrackerMinerFS *fs,
" GRAPH ?g {"
" ?ie nie:isStoredAs <%s> "
" }"
- "}; "
+ "}; ",
+ source_uri, uri, source_uri);
+ /* Update tracker:FileSystem nfo:FileDataObject information */
+ g_string_append_printf (sparql,
"WITH " DEFAULT_GRAPH " "
"DELETE { "
" <%s> a rdfs:Resource . "
@@ -2494,10 +2498,26 @@ miner_files_move_file (TrackerMinerFS *fs,
" <%s> ?p ?o ; "
" FILTER (?p != nfo:fileName && ?p != nie:url && ?p !=
nfo:belongsToContainer) . "
"} ",
- source_uri, uri, source_uri,
source_uri,
uri, display_name, uri, container_clause,
source_uri);
+ /* Update nfo:FileDataObject in data graphs */
+ g_string_append_printf (sparql,
+ "DELETE { "
+ " GRAPH ?g {"
+ " <%s> a rdfs:Resource "
+ " }"
+ "} INSERT {"
+ " GRAPH ?g {"
+ " <%s> a nfo:FileDataObject ; "
+ " ?p ?o "
+ " }"
+ "} WHERE {"
+ " GRAPH ?g {"
+ " <%s> ?p ?o "
+ " }"
+ "}",
+ source_uri, uri, source_uri);
g_free (container_clause);
if (recursive) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]