[tracker/ontology-cache: 4/5] libtracker-data: Add function to load ontologies gvdb file
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/ontology-cache: 4/5] libtracker-data: Add function to load ontologies gvdb file
- Date: Wed, 1 Dec 2010 15:55:47 +0000 (UTC)
commit 545c9408ecc1573c1a44f861c4cb585da4bf08b1
Author: Jürg Billeter <j bitron ch>
Date: Wed Dec 1 16:02:29 2010 +0100
libtracker-data: Add function to load ontologies gvdb file
src/libtracker-data/tracker-ontologies.c | 31 ++++++++++++++++++++++++++++++
src/libtracker-data/tracker-ontologies.h | 2 +
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-ontologies.c b/src/libtracker-data/tracker-ontologies.c
index 8f46dae..bd5c29d 100644
--- a/src/libtracker-data/tracker-ontologies.c
+++ b/src/libtracker-data/tracker-ontologies.c
@@ -26,6 +26,7 @@
#include <glib.h>
#include <gvdb/gvdb-builder.h>
+#include <gvdb/gvdb-reader.h>
#include <libtracker-common/tracker-ontologies.h>
#include "tracker-ontologies.h"
@@ -65,6 +66,11 @@ static GHashTable *id_uri_pairs;
/* rdf:type */
static TrackerProperty *rdf_type = NULL;
+static GvdbTable *gvdb_table;
+static GvdbTable *gvdb_namespaces_table;
+static GvdbTable *gvdb_classes_table;
+static GvdbTable *gvdb_properties_table;
+
void
tracker_ontologies_init (void)
{
@@ -155,6 +161,20 @@ tracker_ontologies_shutdown (void)
rdf_type = NULL;
}
+ if (gvdb_table) {
+ gvdb_table_unref (gvdb_properties_table);
+ gvdb_properties_table = NULL;
+
+ gvdb_table_unref (gvdb_classes_table);
+ gvdb_classes_table = NULL;
+
+ gvdb_table_unref (gvdb_namespaces_table);
+ gvdb_namespaces_table = NULL;
+
+ gvdb_table_unref (gvdb_table);
+ gvdb_table = NULL;
+ }
+
initialized = FALSE;
}
@@ -390,3 +410,14 @@ tracker_ontologies_write_gvdb (const gchar *filename,
g_hash_table_unref (table);
}
+
+void
+tracker_ontologies_load_gvdb (const gchar *filename,
+ GError **error)
+{
+ gvdb_table = gvdb_table_new (filename, TRUE, error);
+
+ gvdb_namespaces_table = gvdb_table_get_table (gvdb_table, "namespaces");
+ gvdb_classes_table = gvdb_table_get_table (gvdb_table, "classes");
+ gvdb_properties_table = gvdb_table_get_table (gvdb_table, "properties");
+}
diff --git a/src/libtracker-data/tracker-ontologies.h b/src/libtracker-data/tracker-ontologies.h
index b4a5a71..d6868df 100644
--- a/src/libtracker-data/tracker-ontologies.h
+++ b/src/libtracker-data/tracker-ontologies.h
@@ -61,6 +61,8 @@ void tracker_ontologies_add_id_uri_pair (gint id
void tracker_ontologies_write_gvdb (const gchar *filename,
GError **error);
+void tracker_ontologies_load_gvdb (const gchar *filename,
+ GError **error);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]