aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/triple_store/sparql
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-01-12 10:26:30 +0100
committerMatthias Baumgartner <dev@igsor.net>2023-01-12 10:26:30 +0100
commitb0ff4ed674ad78bf113c3cc0c2ccd187ccb91048 (patch)
treeadfc97349cac6a6856970c5e1dc187c2ed8f878c /bsfs/triple_store/sparql
parent7e7284d5fc01c0a081aa79d67736f51069864a7d (diff)
downloadbsfs-b0ff4ed674ad78bf113c3cc0c2ccd187ccb91048.tar.gz
bsfs-b0ff4ed674ad78bf113c3cc0c2ccd187ccb91048.tar.bz2
bsfs-b0ff4ed674ad78bf113c3cc0c2ccd187ccb91048.zip
number literal adaptions
Diffstat (limited to 'bsfs/triple_store/sparql')
-rw-r--r--bsfs/triple_store/sparql/parse_filter.py1
-rw-r--r--bsfs/triple_store/sparql/sparql.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/bsfs/triple_store/sparql/parse_filter.py b/bsfs/triple_store/sparql/parse_filter.py
index 0297cbc..18a3288 100644
--- a/bsfs/triple_store/sparql/parse_filter.py
+++ b/bsfs/triple_store/sparql/parse_filter.py
@@ -242,7 +242,6 @@ class Filter():
# predicate count expression (fetch number of predicates at *head*)
num_preds = f'{{ SELECT (COUNT(distinct {inner}) as {outer}) WHERE {{ {head} {pred} {inner} }} }}'
# count expression
- # FIXME: We have to ensure that ns.xsd.integer is always known in the schema!
count_bounds = self._parse_filter_expression(self.schema.literal(ns.xsd.integer), node.count, outer)
# combine
return num_preds + ' . ' + count_bounds
diff --git a/bsfs/triple_store/sparql/sparql.py b/bsfs/triple_store/sparql/sparql.py
index ddace35..87467ff 100644
--- a/bsfs/triple_store/sparql/sparql.py
+++ b/bsfs/triple_store/sparql/sparql.py
@@ -11,6 +11,7 @@ import rdflib
# bsfs imports
from bsfs import schema as bsc
+from bsfs.namespace import ns
from bsfs.query import ast
from bsfs.utils import errors, URI
@@ -94,7 +95,8 @@ class SparqlStore(base.TripleStoreBase):
super().__init__(None)
self._graph = rdflib.Graph()
self._transaction = _Transaction(self._graph)
- self._schema = bsc.Schema()
+ # NOTE: parsing bsfs.query.ast.filter.Has requires xsd:integer.
+ self._schema = bsc.Schema(literals={bsc.ROOT_NUMBER.child(ns.xsd.integer)})
self._filter_parser = parse_filter.Filter(self._schema)
# NOTE: mypy and pylint complain about the **kwargs not being listed (contrasting super)