aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/graph/nodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'bsfs/graph/nodes.py')
-rw-r--r--bsfs/graph/nodes.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/bsfs/graph/nodes.py b/bsfs/graph/nodes.py
index a4ba45f..18ab30d 100644
--- a/bsfs/graph/nodes.py
+++ b/bsfs/graph/nodes.py
@@ -19,6 +19,7 @@ from bsfs.utils import errors, URI, typename
# inner-module imports
from . import ac
from . import result
+from . import walk
# exports
__all__: typing.Sequence[str] = (
@@ -87,6 +88,18 @@ class Nodes():
"""Return all node guids."""
return iter(self._guids)
+ @property
+ def schema(self) -> bsc.Schema:
+ """Return the store's local schema."""
+ return self._backend.schema
+
+ def __getattr__(self, name: str):
+ try:
+ return super().__getattr__(name) # type: ignore [misc] # parent has no getattr
+ except AttributeError:
+ pass
+ return walk.Walk(self, walk.Walk.step(self.schema, self.node_type, name))
+
def set(
self,
pred: URI, # FIXME: URI or bsc.Predicate?
@@ -141,7 +154,7 @@ class Nodes():
if view not in (dict, list):
raise ValueError(f'expected dict or list, found {view}')
# process paths: create fetch ast, build name mapping, and find unique paths
- schema = self._backend.schema
+ schema = self.schema
statements = set()
name2path = {}
unique_paths = set() # paths that result in a single (unique) value