Commit 87e71075 authored by Carlos Garnacho's avatar Carlos Garnacho

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
parent a9d09d95
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment