SqliteGraph class

A persistent graph implementation backed by SQLite.

Stores Node and Relation objects with their properties as key/value pairs in separate tables:

  • nodes: id, type, labelProperty, uniqueProperty, urlProperty, icon
  • relations: id, type, fromNodeId, toNodeId, labelProperty
  • node_properties: nodeId, key, value (key/value pairs for each node)
  • relation_properties: relationId, key, value (key/value pairs for each relation)
Inheritance

Constructors

SqliteGraph({required String dbPath})
Creates a SqliteGraph storing data at dbPath.

Properties

dbPath String
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addNode(Node node, {bool replaceIfExists = true}) → void
Add a new node to graph
override
addRelation(Relation relation, {bool replaceIfExists = true}) → void
Add a new relation to the graph
override
allNodes() Iterable<Node>
Get all nodes.
override
allRelations() Iterable<Relation>
Get all relations.
override
clear() → void
Clear the graph. This removes all nodes and relations from the graph.
override
dispose() → void
Closes the database connection and releases associated resources.
getNode(String nodeId) Node
Get node (by id)
override
getRelation(String relationId) Relation
Get a relation (by id)
override
getRelationsBetween(String fromNodeId, String toNodeId, {bool bothDirections = true}) Iterable<Relation>
Get relations from a given node to another (by id)
override
getRelationsFrom(String nodeId) Iterable<Relation>
Get relations starting from this node
override
getRelationsTo(String nodeId) Iterable<Relation>
Get relations ending at this node
override
nodeDoesNotExist(String nodeId) bool
Opposite of nodeDoesNotExist
inherited
nodeExists(String nodeId) bool
Check if a node exists (by id)
override
nodeIsConnected(String nodeId) bool
Check if a Node has at least one Relation to or from it.
override
nodeIsDisconnected(String nodeId) bool
Opposite of nodeIsConnected
inherited
nodeIsLeaf(String nodeId) bool
Check if a Node has at least one Relation to it, but none from it.
override
nodeIsNotLeaf(String nodeId) bool
Opposite of nodeIsLeaf
inherited
nodeIsNotOrphan(String nodeId) bool
Opposite of nodeIsOrphan
inherited
nodeIsOrphan(String nodeId) bool
Check if a Node has no Relations to or from it.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
relationExists(String relationId) bool
Check if a relation exists (by id)
override
removeNode(String nodeId) → void
Remove a node from the graph (by id)
override
removeRelation(String relationId) → void
Remove a relation (by id)
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited