aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/triple_store
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2022-12-19 13:32:34 +0100
committerMatthias Baumgartner <dev@igsor.net>2022-12-19 13:32:34 +0100
commit791918039979d0743fd2ea4b9a5e74593ff96fd0 (patch)
treec8e6703325ae14e02d2f92e4f6658aa41a6f4701 /bsfs/triple_store
parente94368c75468e3e94382b12705e55d396249eaca (diff)
downloadbsfs-791918039979d0743fd2ea4b9a5e74593ff96fd0.tar.gz
bsfs-791918039979d0743fd2ea4b9a5e74593ff96fd0.tar.bz2
bsfs-791918039979d0743fd2ea4b9a5e74593ff96fd0.zip
query ast file structures and essential interfaces
Diffstat (limited to 'bsfs/triple_store')
-rw-r--r--bsfs/triple_store/base.py8
-rw-r--r--bsfs/triple_store/sparql/__init__.py18
-rw-r--r--bsfs/triple_store/sparql/sparql.py (renamed from bsfs/triple_store/sparql.py)3
3 files changed, 29 insertions, 0 deletions
diff --git a/bsfs/triple_store/base.py b/bsfs/triple_store/base.py
index 6561262..28ebb86 100644
--- a/bsfs/triple_store/base.py
+++ b/bsfs/triple_store/base.py
@@ -109,6 +109,14 @@ class TripleStoreBase(abc.ABC):
"""
@abc.abstractmethod
+ def get(
+ self,
+ node_type: bsc.Node,
+ query: ast.filter.FilterExpression,
+ ) -> typing.Iterator[URI]:
+ """Return guids of nodes of type *node_type* that match the *query*."""
+
+ @abc.abstractmethod
def exists(
self,
node_type: _schema.Node,
diff --git a/bsfs/triple_store/sparql/__init__.py b/bsfs/triple_store/sparql/__init__.py
new file mode 100644
index 0000000..285334a
--- /dev/null
+++ b/bsfs/triple_store/sparql/__init__.py
@@ -0,0 +1,18 @@
+"""
+
+Part of the BlackStar filesystem (bsfs) module.
+A copy of the license is provided with the project.
+Author: Matthias Baumgartner, 2022
+"""
+# imports
+import typing
+
+# inner-module imports
+from .sparql import SparqlStore
+
+# exports
+__all__: typing.Sequence[str] = (
+ 'SparqlStore',
+ )
+
+## EOF ##
diff --git a/bsfs/triple_store/sparql.py b/bsfs/triple_store/sparql/sparql.py
index 7516dff..fff540a 100644
--- a/bsfs/triple_store/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.query import ast
from bsfs.utils import errors, URI
# inner-module imports
@@ -152,6 +153,8 @@ class SparqlStore(base.TripleStoreBase):
# migrate schema
self._schema = schema
+ def get(self, node_type: bsc.Node, query: ast.filter.FilterExpression) -> typing.Iterator[URI]:
+ raise NotImplementedError()
def _has_type(self, subject: URI, node_type: bsc.Node) -> bool:
"""Return True if *subject* is a node of class *node_type* or a subclass thereof."""