[tracker/wip/carlosg/graphs: 12/12] 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: 12/12] libtracker-data: Don't assert on NULL subject
- Date: Wed, 29 Apr 2020 20:34:02 +0000 (UTC)
commit 8bdf2f3b5bd7c6fa6fb1f64ebcd911ba3be1b7d9
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]