From 8ed8dbb4010a9a75cf6e61d185327825fe783776 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sun, 18 Dec 2022 14:16:40 +0100 Subject: Graph.node interface --- bsfs/graph/graph.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bsfs') diff --git a/bsfs/graph/graph.py b/bsfs/graph/graph.py index 87f7a31..b7b9f1c 100644 --- a/bsfs/graph/graph.py +++ b/bsfs/graph/graph.py @@ -99,4 +99,15 @@ class Graph(): # NOTE: Nodes constructor materializes guids. return _nodes.Nodes(self._backend, self._user, type_, guids) + def node(self, node_type: URI, guid: URI) -> _nodes.Nodes: + """Return node *guid* of type *node_type* as a `bsfs.graph.Nodes` instance. + + Note that the *guids* need not to exist (however, the *node_type* has + to be part of the schema). An inexistent guid will be created (using + *node_type*) once some data is assigned to them. + + """ + type_ = self.schema.node(node_type) + return _nodes.Nodes(self._backend, self._user, type_, {guid}) + ## EOF ## -- cgit v1.2.3