diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-01-02 19:26:31 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-01-19 11:40:32 +0100 |
commit | 87e710755900901da0630eae51228d8b9e6c89da (patch) | |
tree | fd4e5e9a9ff82a739afe474512be1dfd1b41c27d | |
parent | a9d09d9539ae06e66840d96bc4553e883bed2072 (diff) | |
download | tracker-87e710755900901da0630eae51228d8b9e6c89da.tar.gz |
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
-rw-r--r-- | 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 78e7d8e29..c9c56046d 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); @@ -1261,6 +1281,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); |