[tracker/wip/carlosg/ontology-single-value-updates: 1/2] libtracker-data: Improve changes over single valued ontology properties
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/ontology-single-value-updates: 1/2] libtracker-data: Improve changes over single valued ontology properties
- Date: Wed, 13 May 2020 17:47:51 +0000 (UTC)
commit 46149017b63f4d5671cc6d1d40e5319d8ebf1e1d
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed May 13 19:41:55 2020 +0200
libtracker-data: Improve changes over single valued ontology properties
Things like rdfs:label and rdfs:comment that are not tracker through the
TrackerOntology and are single-valued may result in errors if there's
changes on those.
Handle those better by replacing the value instead of trying to insert
over it.
src/libtracker-data/tracker-data-manager.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 9ef0096c7..316fe3465 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1917,6 +1917,7 @@ tracker_data_ontology_process_statement (TrackerDataManager *manager,
const gchar *object,
gboolean in_update)
{
+ TrackerProperty *property;
GError *error = NULL;
GBytes *bytes;
@@ -1994,10 +1995,19 @@ tracker_data_ontology_process_statement (TrackerDataManager *manager,
}
bytes = g_bytes_new (object, strlen (object) + 1);
+ property = tracker_ontologies_get_property_by_uri (manager->ontologies, predicate);
+
+ if (tracker_property_get_is_new (property) ||
+ tracker_property_get_multiple_values (property)) {
+ tracker_data_insert_statement (manager->data_update, NULL,
+ subject, predicate, bytes,
+ &error);
+ } else {
+ tracker_data_update_statement (manager->data_update, NULL,
+ subject, predicate, bytes,
+ &error);
+ }
- tracker_data_insert_statement (manager->data_update, NULL, subject,
- predicate, bytes,
- &error);
g_bytes_unref (bytes);
if (error != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]