aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/triple_store/sparql
diff options
context:
space:
mode:
Diffstat (limited to 'bsfs/triple_store/sparql')
-rw-r--r--bsfs/triple_store/sparql/parse_filter.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/bsfs/triple_store/sparql/parse_filter.py b/bsfs/triple_store/sparql/parse_filter.py
index a851888..0297cbc 100644
--- a/bsfs/triple_store/sparql/parse_filter.py
+++ b/bsfs/triple_store/sparql/parse_filter.py
@@ -140,12 +140,10 @@ class Filter():
raise errors.ConsistencyError(f'ranges {subrng} and {rng} are not related')
except TypeError as err: # subrng and rng are not comparable
raise errors.ConsistencyError(f'ranges {subrng} and {rng} are not related') from err
- if rng is None:
- # for mypy to be certain of the rng type
- # if rng were None, we'd have gotten a TypeError above (None > None)
- raise errors.UnreachableError()
# return joint predicate expression and next range
- return '|'.join(suburi), rng
+ # OneOf guarantees at least one expression, rng is always a bsc.Vertex.
+ # mypy does not realize this, hence we ignore the warning.
+ return '|'.join(suburi), rng # type: ignore [return-value]
def _predicate(self, node_type: bsc.Vertex, node: ast.filter.Predicate) -> typing.Tuple[str, bsc.Vertex]:
"""
@@ -159,9 +157,8 @@ class Filter():
if not self.schema.has_predicate(puri):
raise errors.ConsistencyError(f'predicate {puri} is not in the schema')
pred = self.schema.predicate(puri)
- if pred.range is None:
- # FIXME: It is a design error that Predicates can have a None range...
- raise errors.BackendError(f'predicate {pred} has no range')
+ if not isinstance(pred.range, (bsc.Node, bsc.Literal)):
+ raise errors.BackendError(f'the range of predicate {pred} is undefined')
dom, rng = pred.domain, pred.range
# encapsulate predicate uri
puri = f'<{puri}>' # type: ignore [assignment] # variable re-use confuses mypy