[tracker: 9/21] TrackerProperty: add the definition position in the ontology
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 9/21] TrackerProperty: add the definition position in the ontology
- Date: Tue, 5 Oct 2021 14:16:17 +0000 (UTC)
commit e2b58e982de2d9adef98286a6a7dc4512b92e9b7
Author: Abanoub Ghadban <abanoub gdb gmail com>
Date: Wed Aug 18 14:30:48 2021 +0200
TrackerProperty: add the definition position in the ontology
Adds information to TrackerProperty class to hold the position in the ontology file where the property is
defined.
It adds ontology_path, definition_line_no and definition_column_no to the class.
src/libtracker-data/tracker-data-manager.c | 6 +++
src/libtracker-data/tracker-property.c | 85 ++++++++++++++++++++++++++++++
src/libtracker-data/tracker-property.h | 9 ++++
3 files changed, 100 insertions(+)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 88df03b29..b77921b03 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -788,6 +788,9 @@ tracker_data_ontology_load_statement (TrackerDataManager *manager,
tracker_property_set_is_inverse_functional_property (property, FALSE);
tracker_property_set_multiple_values (property, TRUE);
tracker_property_set_fulltext_indexed (property, FALSE);
+ tracker_property_set_ontology_path (property, ontology_path);
+ tracker_property_set_definition_line_no (property, object_line_no);
+ tracker_property_set_definition_column_no (property,
object_column_no);
}
goto out;
}
@@ -806,6 +809,9 @@ tracker_data_ontology_load_statement (TrackerDataManager *manager,
tracker_property_set_uri (property, subject);
tracker_property_set_id (property, subject_id);
tracker_property_set_multiple_values (property, TRUE);
+ tracker_property_set_ontology_path (property, ontology_path);
+ tracker_property_set_definition_line_no (property, object_line_no);
+ tracker_property_set_definition_column_no (property, object_column_no);
tracker_ontologies_add_property (manager->ontologies, property);
tracker_ontologies_add_id_uri_pair (manager->ontologies, subject_id, subject);
diff --git a/src/libtracker-data/tracker-property.c b/src/libtracker-data/tracker-property.c
index 3446a9d8e..7d84a7b35 100644
--- a/src/libtracker-data/tracker-property.c
+++ b/src/libtracker-data/tracker-property.c
@@ -86,6 +86,10 @@ struct _TrackerPropertyPrivate {
guint cardinality_changed : 1;
guint orig_multiple_values : 1;
+ gchar *ontology_path;
+ goffset definition_line_no;
+ goffset definition_column_no;
+
TrackerProperty *secondary_index;
GPtrArray *is_new_domain_index;
@@ -192,6 +196,10 @@ property_finalize (GObject *object)
g_object_unref (priv->range);
}
+ if (priv->ontology_path) {
+ g_free (priv->ontology_path);
+ }
+
if (priv->secondary_index) {
g_object_unref (priv->secondary_index);
}
@@ -637,6 +645,42 @@ tracker_property_get_orig_multiple_values (TrackerProperty *property)
return priv->orig_multiple_values;
}
+const gchar *
+tracker_property_get_ontology_path (TrackerProperty *property)
+{
+ TrackerPropertyPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (property), FALSE);
+
+ priv = tracker_property_get_instance_private (property);
+
+ return priv->ontology_path;
+}
+
+goffset
+tracker_property_get_definition_line_no (TrackerProperty *property)
+{
+ TrackerPropertyPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (property), FALSE);
+
+ priv = tracker_property_get_instance_private (property);
+
+ return priv->definition_line_no;
+}
+
+goffset
+tracker_property_get_definition_column_no (TrackerProperty *property)
+{
+ TrackerPropertyPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (property), FALSE);
+
+ priv = tracker_property_get_instance_private (property);
+
+ return priv->definition_column_no;
+}
+
gboolean
tracker_property_get_is_inverse_functional_property (TrackerProperty *property)
{
@@ -1023,6 +1067,47 @@ tracker_property_set_orig_multiple_values (TrackerProperty *property,
priv->orig_multiple_values = !!value;
}
+void
+tracker_property_set_ontology_path (TrackerProperty *property,
+ const gchar *value)
+{
+ TrackerPropertyPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (property));
+
+ priv = tracker_property_get_instance_private (property);
+
+ if (priv->ontology_path)
+ g_free (priv->ontology_path);
+
+ priv->ontology_path = g_strdup (value);
+}
+
+void
+tracker_property_set_definition_line_no (TrackerProperty *property,
+ goffset value)
+{
+ TrackerPropertyPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (property));
+
+ priv = tracker_property_get_instance_private (property);
+
+ priv->definition_line_no = value;
+}
+
+void
+tracker_property_set_definition_column_no (TrackerProperty *property,
+ goffset value)
+{
+ TrackerPropertyPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_PROPERTY (property));
+
+ priv = tracker_property_get_instance_private (property);
+
+ priv->definition_column_no = value;
+}
void
tracker_property_set_is_inverse_functional_property (TrackerProperty *property,
diff --git a/src/libtracker-data/tracker-property.h b/src/libtracker-data/tracker-property.h
index 8843eeb88..6ad6b9fda 100644
--- a/src/libtracker-data/tracker-property.h
+++ b/src/libtracker-data/tracker-property.h
@@ -90,6 +90,9 @@ gboolean tracker_property_get_fulltext_indexed (TrackerProperty
gboolean tracker_property_get_multiple_values (TrackerProperty *property);
gboolean tracker_property_get_last_multiple_values(TrackerProperty *property);
gboolean tracker_property_get_orig_multiple_values(TrackerProperty *property);
+const gchar * tracker_property_get_ontology_path (TrackerProperty *property);
+goffset tracker_property_get_definition_line_no (TrackerProperty *property);
+goffset tracker_property_get_definition_column_no(TrackerProperty *property);
gboolean tracker_property_get_is_new (TrackerProperty *property);
gboolean tracker_property_get_is_new_domain_index (TrackerProperty *property,
TrackerClass *class);
@@ -128,6 +131,12 @@ void tracker_property_set_last_multiple_values(TrackerProperty
gboolean value);
void tracker_property_set_orig_multiple_values(TrackerProperty *property,
gboolean value);
+void tracker_property_set_ontology_path (TrackerProperty *property,
+ const gchar *value);
+void tracker_property_set_definition_line_no (TrackerProperty *property,
+ goffset value);
+void tracker_property_set_definition_column_no(TrackerProperty *property,
+ goffset value);
void tracker_property_set_is_new (TrackerProperty *property,
gboolean value);
void tracker_property_set_is_new_domain_index (TrackerProperty *property,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]