bsie.utils.bsfs module#

BSFS bridge, provides BSFS bindings for BSIE.

class bsie.utils.bsfs.Namespace(value: str)#

Bases: URI

The Namespace allows you to incrementally append path segments to an URI.

Segments are separated by Namespace.sep (‘/’). The __call__ method signals that the URI is complete until the query part.

sep: str = '/'#
bsie.utils.bsfs.Open(cfg: Any) Graph#

Open a BSFS storage and return a bsfs.graph.Graph instance.

class bsie.utils.bsfs.URI(value: str)#

Bases: str

URI additions to built-in strings.

Provides properties to access the different components of an URI, according to RFC 3986 (https://datatracker.ietf.org/doc/html/rfc3986).

Note that this class does not actually validate an URI but only offers access to components of a well-formed URI. Use urllib.parse for more advanced purposes.

property authority: str#

Return the authority part of the URI, including userinfo and port.

static compose(path: str, scheme: str | None = None, authority: str | None = None, user: str | None = None, host: str | None = None, port: int | None = None, query: str | None = None, fragment: str | None = None)#

URI composition from components.

If the host argument is supplied, the authority is composed of user, host, and port arguments, and the authority argument is ignored. Note that if the host is an IPv6 address, it must be enclosed in brackets.

property fragment: str#

Return the fragment part of the URI.

get(component: str, default: Any | None = None) Any | None#

Return the component or a default value.

property host: str#

Return the host part of the URI.

static is_parseable(query: str) bool#

Return True if the query can be decomposed into the URI components.

Note that a valid URI is always parseable, however, an invalid URI might be parseable as well. The return value of this method makes no claim about the validity of an URI!

join(*args) URI#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

lower(*args) URI#

Return a copy of the string converted to lowercase.

lstrip(*args) URI#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

property path: str#

Return the path part of the URI.

property port: int#

Return the port part of the URI.

property query: str#

Return the query part of the URI.

replace(*args) URI#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rstrip(*args) URI#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

property scheme: str#

Return the protocol/scheme part of the URI.

strip(*args) URI#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

upper(*args) URI#

Return a copy of the string converted to uppercase.

property userinfo: str#

Return the userinfo part of the URI.

bsie.utils.bsfs.init_sparql_store(user) Any#

Initialize a SparqlStore backend. Returns a configuration to load it.

bsie.utils.bsfs.typename(obj) str#

Return the type name of obj.