bsfs.graph package#

class bsfs.graph.Graph(backend: TripleStoreBase, access_control: AccessControlBase)#

Bases: object

The Graph class provides a convenient interface to query and access a graph. Since it logically builds on the concept of graphs it is easier to navigate than raw triple stores. Naturally, it uses a triple store as backend. It also controls actions via access permissions to a user.

all(node_type: URI) Nodes#

Return all instances of type node_type.

empty(node_type: URI) Nodes#

Return a Nodes instance with type node_type but no nodes.

get(node_type: URI, query: FilterExpression | None) Nodes#

Return a Nodes instance over all nodes of type node_type that match the query.

migrate(schema: Schema, append: bool = True) Graph#

Migrate the current schema to a new schema.

Appends to the current schema by default; control this via append. The Graph may add additional classes to the schema that are required for its interals.

node(node_type: URI, guid: URI) Nodes#

Return node guid of type node_type as a bsfs.graph.Nodes instance.

Note that the guid 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.

nodes(node_type: URI, guids: Iterable[URI]) Nodes#

Return nodes guids 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). Inexistent guids will be created (using node_type) once some data is assigned to them.

property schema: Schema#

Return the store’s local schema.

sorted(node_type: URI, query: FilterExpression | None) Iterator[Nodes]#

Return a iterator over Nodes instances over all nodes of type node_type that match the query.

Subpackages#

Submodules#