[tracker/wip/carlosg/graphs: 4/4] libtracker-data: Don't assert on NULL subject
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/graphs: 4/4] libtracker-data: Don't assert on NULL subject
- Date: Thu, 30 Apr 2020 09:44:37 +0000 (UTC)
commit 3bbeffaaa99e39c33fea7b02b3daf5384ad41716
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Apr 29 19:00:23 2020 +0200
libtracker-data: Don't assert on NULL subject
Getting a NULL subject in TriplesSameSubject handling is possible
in queries like:
DELETE {
?b a rdfs:Resource
} WHERE {
OPTIONAL { ?a nie:isStoredAs ?b }
}
If ?b didn't happen to get resolved to anything. In those cases,
the SPARQL update definition says:
If any solution produces a triple containing an unbound variable
or an illegal RDF construct, such as a literal in a subject or
predicate position, then that triple is not included when processing
the operation: INSERT will not instantiate new data in the output
graph, and DELETE will not remove anything.
So we shouldn't assert here, and we should let the operation be
optimized away. The latter is already handled, so remove the asserts.
src/libtracker-data/tracker-sparql.c | 2 --
1 file changed, 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 5eea62dfb..b17b99f1b 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -5319,12 +5319,10 @@ translate_TriplesSameSubject (TrackerSparql *sparql,
if (rule == NAMED_RULE_VarOrTerm) {
_call_rule (sparql, rule, error);
- g_assert (!tracker_token_is_empty (&sparql->current_state.subject));
sparql->current_state.token = &sparql->current_state.object;
_call_rule (sparql, NAMED_RULE_PropertyListNotEmpty, error);
} else if (rule == NAMED_RULE_TriplesNode) {
_call_rule (sparql, rule, error);
- g_assert (!tracker_token_is_empty (&sparql->current_state.subject));
sparql->current_state.token = &sparql->current_state.object;
_call_rule (sparql, NAMED_RULE_PropertyList, error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]