[tracker/wip/carlosg/sparql1.1: 56/145] libtracker-data: Add support for SERVICE{} syntax
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/sparql1.1: 56/145] libtracker-data: Add support for SERVICE{} syntax
- Date: Thu, 18 Jul 2019 22:28:44 +0000 (UTC)
commit a2e8ae6e5e2b3e1b486d7540e9fd23a5488a2722
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu May 30 13:55:58 2019 +0200
libtracker-data: Add support for SERVICE{} syntax
src/libtracker-data/tracker-db-interface-sqlite.c | 2 ++
src/libtracker-data/tracker-sparql.c | 37 ++++++++++++++---------
2 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 52eca4a9f..e1c797815 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -56,6 +56,7 @@
#include "tracker-db-manager.h"
#include "tracker-data-enum-types.h"
#include "tracker-uuid.h"
+#include "tracker-vtab-service.h"
#include "tracker-vtab-triples.h"
typedef struct {
@@ -3171,6 +3172,7 @@ tracker_db_interface_init_vtabs (TrackerDBInterface *db_interface,
TrackerOntologies *ontologies)
{
tracker_vtab_triples_init (db_interface->db, ontologies);
+ tracker_vtab_service_init (db_interface->db, ontologies);
return TRUE;
}
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index d457a7603..ce730465a 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -2423,26 +2423,33 @@ translate_Create (TrackerSparql *sparql,
silent = TRUE;
_call_rule (sparql, NAMED_RULE_GraphRef, error);
+ g_assert (!tracker_token_is_empty (&sparql->current_state.graph));
- if (!tracker_token_is_empty (&sparql->current_state.graph)) {
- const gchar *graph_name;
+ graph_name = tracker_token_get_idstring (&sparql->current_state.graph);
- graph_name = tracker_token_get_idstring (&sparql->current_state.graph);
-
- if (!tracker_data_manager_create_graph (sparql->data_manager,
- graph_name,
- &inner_error)) {
- if (silent) {
- g_error_free (inner_error);
- return TRUE;
- } else {
- g_propagate_error (error, inner_error);
- return FALSE;
- }
- }
+ if (tracker_data_manager_find_graph (sparql->data_manager, graph_name) != 0) {
+ inner_error = g_error_new (TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "Graph '%s' already exists",
+ graph_name);
+ goto error;
}
+ if (!tracker_data_manager_create_graph (sparql->data_manager,
+ graph_name,
+ &inner_error))
+ goto error;
+
return TRUE;
+
+error:
+ if (silent) {
+ g_error_free (inner_error);
+ return TRUE;
+ } else {
+ g_propagate_error (error, inner_error);
+ return FALSE;
+ }
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]