[tracker] libtracker-sparql: Fix sparql/turtle generation of builtin classes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-sparql: Fix sparql/turtle generation of builtin classes
- Date: Wed, 18 Jan 2017 11:10:29 +0000 (UTC)
commit ad26b15dd3ddc513730229b56c7fee0b900cbd05
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jan 2 19:26:31 2017 +0100
libtracker-sparql: Fix sparql/turtle generation of builtin classes
We don't need to generate sparql/turtle for builtin classes
(eg. nmm:flash-on).
https://bugzilla.gnome.org/show_bug.cgi?id=776723
src/libtracker-sparql/tracker-resource.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-sparql/tracker-resource.c b/src/libtracker-sparql/tracker-resource.c
index f97f4be..f18d001 100644
--- a/src/libtracker-sparql/tracker-resource.c
+++ b/src/libtracker-sparql/tracker-resource.c
@@ -963,10 +963,30 @@ is_blank_node (const char *uri_or_curie_or_blank)
return (strncmp(uri_or_curie_or_blank, "_:", 2) == 0);
}
+gboolean
+is_builtin_class (const gchar *uri_or_curie,
+ TrackerNamespaceManager *namespaces)
+{
+ gchar *prefix = NULL;
+
+ prefix = g_uri_parse_scheme (uri_or_curie);
+
+ if (prefix &&
+ tracker_namespace_manager_has_prefix (namespaces, prefix))
+ return TRUE;
+
+ return FALSE;
+}
+
void
generate_nested_turtle_resource (TrackerResource *resource,
GenerateTurtleData *data)
{
+ /* We don't need to produce turtle for builtin classes */
+ if (is_builtin_class (tracker_resource_get_identifier (resource),
+ data->all_namespaces))
+ return;
+
if (g_list_find_custom (data->done_list, resource, (GCompareFunc) tracker_resource_compare) == NULL) {
generate_turtle (resource, data);
@@ -1264,6 +1284,11 @@ generate_sparql_relation_inserts_foreach (gpointer key,
if (G_VALUE_HOLDS (value, TRACKER_TYPE_RESOURCE)) {
TrackerResource *relation = g_value_get_object (value);
+ /* We don't need to produce inserts for builtin classes */
+ if (is_builtin_class (tracker_resource_get_identifier (relation),
+ data->namespaces))
+ return;
+
if (g_list_find_custom (data->done_list, relation, (GCompareFunc) tracker_resource_compare)
== NULL) {
generate_sparql_insert_pattern (relation, data);
data->done_list = g_list_prepend (data->done_list, relation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]