[tracker/wip/carlosg/update-perf: 33/61] libtracker-sparql/core: Set nrl:modified/added consistently
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 33/61] libtracker-sparql/core: Set nrl:modified/added consistently
- Date: Mon, 22 Aug 2022 22:07:43 +0000 (UTC)
commit 7620c650ed6539496dea1dfe9d963f69ec46f4ad
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 2 23:47:42 2022 +0200
libtracker-sparql/core: Set nrl:modified/added consistently
For nrl:modified, we had some double handling since the modifier was
pushed as a property change, but also dealt with directly when flushing
the buffer.
Since these are essentially properties (even though changed automatically),
it makes sense to stick to the former, also for nrl:added. Do that, and
drop the special handling of these 2 properties when flushing the buffer.
This commit also changes the expected output of a serialization test,
since nrl:added is added now on more graphs than the first one that sees
a resource, this slightly changes the spacing after filtering the test
filters nrl:added/nrl:modified.
src/libtracker-sparql/core/tracker-data-update.c | 31 ++++++++++++----------
.../serialize/describe-graph-trig.out | 1 -
2 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index fb4b338a5..528f19c14 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -1005,11 +1005,6 @@ tracker_data_resource_buffer_flush (TrackerData *data,
if (table->insert) {
g_string_append (sql, " (ID");
-
- if (strcmp (table_name, "rdfs:Resource") == 0) {
- g_string_append (sql, ", \"nrl:added\", \"nrl:modified\"");
- g_string_append (values_sql, ", ?, ?");
- }
} else {
g_string_append (sql, " SET ");
}
@@ -1061,15 +1056,7 @@ tracker_data_resource_buffer_flush (TrackerData *data,
if (table->insert) {
tracker_db_statement_bind_int (stmt, 0, resource->id);
-
- if (strcmp (table_name, "rdfs:Resource") == 0) {
- g_warn_if_fail (data->resource_time != 0);
- tracker_db_statement_bind_int (stmt, 1, (gint64) data->resource_time);
- tracker_db_statement_bind_int (stmt, 2, get_transaction_modseq
(data));
- param = 3;
- } else {
- param = 1;
- }
+ param = 1;
} else {
param = 0;
}
@@ -1436,6 +1423,22 @@ cache_create_service_decomposed (TrackerData *data,
&gvalue);
tracker_data_resource_ref (data, class_id, TRUE);
+ if (data->resource_buffer->create &&
+ strcmp (tracker_class_get_uri (cl), TRACKER_PREFIX_RDFS "Resource") == 0) {
+ /* Add nrl:added for the new rdfs:Resource */
+ TrackerOntologies *ontologies;
+ TrackerProperty *added;
+ GValue gvalue = { 0 };
+
+ ontologies = tracker_data_manager_get_ontologies (data->manager);
+ added = tracker_ontologies_get_property_by_uri (ontologies,
+ TRACKER_PREFIX_NRL "added");
+
+ g_value_init (&gvalue, G_TYPE_INT64);
+ g_value_set_int64 (&gvalue, data->resource_time);
+ cache_insert_value (data, NULL, added, &gvalue);
+ }
+
tracker_data_dispatch_insert_statement_callbacks (data,
tracker_property_get_id
(tracker_ontologies_get_rdf_type (ontologies)),
class_id);
diff --git a/tests/libtracker-sparql/serialize/describe-graph-trig.out
b/tests/libtracker-sparql/serialize/describe-graph-trig.out
index 07165da63..34c832c29 100644
--- a/tests/libtracker-sparql/serialize/describe-graph-trig.out
+++ b/tests/libtracker-sparql/serialize/describe-graph-trig.out
@@ -33,7 +33,6 @@ GRAPH <A> {
}
GRAPH <B> {
-
}
GRAPH <A> {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]