Relation Class API Reference¶
A relation between two nodes in the database. Has a base type, source and target node IDs, and properties from base type.
Relation class is designed to be instanced by an engine:
Note
Relations are designed to be always unique! Even when you load a database from save of
another one. It means you have same relation between same nodes, with same type,
and even same values. In short, Graphite is a multigraph. They are hashable based on
Python's id() function.
Subject To Change
Other type of graphs, is planned to be available.
Attributes:
-
type_name(str) –Name of base
RelationType. -
from_node(str) –Source node's ID.
-
to_node(str) –Target node's ID.
-
values(dict[str, Any]) –A dictionary holding field values. Use
set()andget()methods to use it.Tip
Values can be accessed with
node["field_name"]too. -
type_ref(RelationType | None) –Reference to
RelationType.
Methods: