[tracker/wip/carlosg/update-perf: 19/72] libtracker-data: Shuffle handling of properties not belonging to a class
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 19/72] libtracker-data: Shuffle handling of properties not belonging to a class
- Date: Tue, 30 Aug 2022 15:39:40 +0000 (UTC)
commit 463dec11eeea39d272e6cda440e9bb2ac704eb52
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 18 14:13:22 2022 +0100
libtracker-data: Shuffle handling of properties not belonging to a class
We currently warn if we are setting a property on a resource that is not
expected due to missing rdf:type. This is only relevant while handling
insertion of new data, all other places use get_old_property_values() in
places where either data is being deleted, or we know we deal with
properties in the domain of the resource.
Move this error to the place where it should be handled, instead of doing
it generically from get_old_property_values().
src/libtracker-sparql/core/tracker-data-update.c | 59 +++++++++++-------------
1 file changed, 28 insertions(+), 31 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index b5f6c660f..b30366823 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -1639,38 +1639,8 @@ get_old_property_values (TrackerData *data,
/* read existing property values */
old_values = g_hash_table_lookup (data->resource_buffer->predicates, property);
- if (old_values == NULL) {
- if (!check_property_domain (data, property)) {
- if (data->implicit_create) {
- if (!cache_create_service_decomposed (data,
- tracker_property_get_domain (property),
- error))
- return NULL;
- } else {
- TrackerDBInterface *iface;
- gchar *resource;
-
- iface = tracker_data_manager_get_writable_db_interface (data->manager);
- resource = tracker_data_query_resource_urn (data->manager,
- iface,
- data->resource_buffer->id);
-
- g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_CONSTRAINT,
- "%s %s is not is not a %s, cannot have property `%s'",
- resource ? "Subject" : "Blank node",
- resource ? resource : "",
- tracker_class_get_name (tracker_property_get_domain (property)),
- tracker_property_get_name (property));
- g_free (resource);
-
- return NULL;
- }
- }
-
- data->resource_buffer->fts_updated |=
- tracker_property_get_fulltext_indexed (property);
+ if (old_values == NULL)
old_values = get_property_values (data, property, error);
- }
return old_values;
}
@@ -1788,6 +1758,33 @@ cache_insert_metadata_decomposed (TrackerData *data,
GError *new_error = NULL;
gboolean change = FALSE;
+ if (!check_property_domain (data, property)) {
+ if (data->implicit_create) {
+ if (!cache_create_service_decomposed (data,
+ tracker_property_get_domain (property),
+ error))
+ return FALSE;
+ } else {
+ TrackerDBInterface *iface;
+ gchar *resource;
+
+ iface = tracker_data_manager_get_writable_db_interface (data->manager);
+ resource = tracker_data_query_resource_urn (data->manager,
+ iface,
+ data->resource_buffer->id);
+
+ g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "%s %s is not is not a %s, cannot have property `%s'",
+ resource ? "Subject" : "Blank node",
+ resource ? resource : "",
+ tracker_class_get_name (tracker_property_get_domain (property)),
+ tracker_property_get_name (property));
+ g_free (resource);
+
+ return FALSE;
+ }
+ }
+
/* read existing property values */
old_values = get_old_property_values (data, property, &new_error);
if (new_error) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]