Implementations¶
Graphs¶
-
class
ruruki.graphs.
PersistentGraph
(path, auto_create=True)¶ Persistent Graph database storing data to a file system.
See
IGraph
for doco.Note
Verices and Edges ID’s are retained when the path is loaded.
path |_ vertices | |_ constraints.json (file) | |_ label | | |_ 0 | | |_ properties.json (file) | | |_ in-edges | | | |_ 0 -> ../../../../edges/label/0 (symlink) | | |_ out-edges | | |_ | | | |_ label | | |_ 1 | | |_ properties.json (file) | | |_ in-edges | | | |_ | | |_ out-edges | | |_ 0 -> ../../../../edges/label/0 (symlink) | |_ edges |_ label | |_0 |_ properties.json (file) |_ head | |_ 0 -> ../../../vertices/0 (symlink) |_ tail |_ 1 -> ../../../vertices/1 (symlink)
Parameters: - path (
str
) – Path to ruruki graph data on disk. - auto_create (
bool
) – If True, then missingvertices
oredges
directories will be created.
Raises: DatabasePathLocked – If the path is already locked by another persistence graph instance.
- path (
Entities¶
-
class
ruruki.entities.
EntitySet
(entities=None)¶ EntitySet used for storing, filtering, and iterating over
IEntity
objects.Note
See
IEntitySet
for documenation.Parameters: entities (Iterable of IEntity
) – Entities being added to the set.-
clear
()¶ This is slow (creates N new iterators!) but effective.
-
discard
(entity)¶ Remove a entity from the current set.
Parameters: entity ( IEntity
) – Entity to be removed from the set.Raises: KeyError – KeyError is raised if the entity being discared does not exists in the set.
-
isdisjoint
(other)¶ Return True if two sets have a null intersection.
-
pop
()¶ Return the popped value. Raise KeyError if empty.
-
-
class
ruruki.entities.
Entity
(label=None, **kwargs)¶ Base class for containing the common methods used for the other entities like vertices and edges.
Note
See
IEntity
for doco.Parameters:
-
class
ruruki.entities.
Vertex
(label=None, **kwargs)¶ Vertex/Node is the representation of a entity. It can be anything and contains properties for additional information.
Note
See
IVertex
for doco.Parameters:
-
class
ruruki.entities.
PersistentVertex
(*args, **kwargs)¶ Persistent Vertex behaves exactly the same as a
Vertex
but has an additional path attribute which is the disk location.
Locks¶
-
class
ruruki.locks.
Lock
¶ Base locking class.
See
ILock
for doco.-
locked
¶ Return the stats of the lock.
Returns: True if the lock is acquired. Return type: bool
-