aboutsummaryrefslogtreecommitdiffstats
path: root/bsie/utils
diff options
context:
space:
mode:
Diffstat (limited to 'bsie/utils')
-rw-r--r--bsie/utils/bsfs.py5
-rw-r--r--bsie/utils/namespaces.py3
-rw-r--r--bsie/utils/node.py20
3 files changed, 23 insertions, 5 deletions
diff --git a/bsie/utils/bsfs.py b/bsie/utils/bsfs.py
index 1ae657c..a4b7626 100644
--- a/bsie/utils/bsfs.py
+++ b/bsie/utils/bsfs.py
@@ -8,14 +8,17 @@ Author: Matthias Baumgartner, 2022
import typing
# bsfs imports
+from bsfs import schema
from bsfs.namespace import Namespace
-from bsfs.utils import URI, typename
+from bsfs.utils import URI, typename, uuid
# exports
__all__: typing.Sequence[str] = (
'Namespace',
'URI',
+ 'schema',
'typename',
+ 'uuid',
)
## EOF ##
diff --git a/bsie/utils/namespaces.py b/bsie/utils/namespaces.py
index 67ccc71..13be96b 100644
--- a/bsie/utils/namespaces.py
+++ b/bsie/utils/namespaces.py
@@ -7,13 +7,14 @@ Author: Matthias Baumgartner, 2022
# imports
import typing
-# bsie imports
+# inner-module imports
from . import bsfs as _bsfs
# constants
bse = _bsfs.Namespace('http://bsfs.ai/schema/Entity#')
bsfs = _bsfs.Namespace('http://bsfs.ai/schema/')
bsm = _bsfs.Namespace('http://bsfs.ai/schema/meta#')
+xsd = _bsfs.Namespace('http://www.w3.org/2001/XMLSchema#')
# export
__all__: typing.Sequence[str] = (
diff --git a/bsie/utils/node.py b/bsie/utils/node.py
index 60863a4..c9c494f 100644
--- a/bsie/utils/node.py
+++ b/bsie/utils/node.py
@@ -7,12 +7,12 @@ Author: Matthias Baumgartner, 2022
# imports
import typing
-# inner-module imports
-from bsie.utils.bsfs import URI
+# bsie imports
+from bsie.utils.bsfs import URI, typename
# exports
__all__: typing.Sequence[str] = (
- 'Node'
+ 'Node',
)
@@ -36,4 +36,18 @@ class Node():
self.node_type = URI(node_type)
self.uri = URI(uri)
+ def __eq__(self, other: typing.Any) -> bool:
+ return isinstance(other, Node) \
+ and other.node_type == self.node_type \
+ and other.uri == self.uri
+
+ def __hash__(self) -> int:
+ return hash((type(self), self.node_type, self.uri))
+
+ def __str__(self) -> str:
+ return f'{typename(self)}({self.node_type}, {self.uri})'
+
+ def __repr__(self) -> str:
+ return f'{typename(self)}({self.node_type}, {self.uri})'
+
## EOF ##