Graph data store
Graph data store interface module.
This module defines the BaseGraphDataStore abstract base class, which provides an interface for graph database operations.
References
NONE
BaseGraphDataStore
Bases: ABC
Abstract base class for an async graph data store interface.
This class defines the asynchronous interface for all graph data store implementations. It provides methods for creating, updating, and querying graph data.
close()
abstractmethod
async
Close the graph data store.
delete_node(label, identifier_key, identifier_value)
abstractmethod
async
Delete a node from the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label |
str
|
The label of the node. |
required |
identifier_key |
str
|
The key of the identifier. |
required |
identifier_value |
str
|
The identifier of the node. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The result of the operation. |
delete_relationship(node_source_key, node_source_value, relation, node_target_key, node_target_value)
abstractmethod
async
Delete a relationship between two nodes in the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_source_key |
str
|
The key of the source node. |
required |
node_source_value |
str
|
The identifier of the source node. |
required |
relation |
str
|
The type of the relationship. |
required |
node_target_key |
str
|
The key of the target node. |
required |
node_target_value |
str
|
The identifier of the target node. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The result of the operation. |
query(query, parameters=None)
abstractmethod
async
Query the graph data store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The query to be executed. |
required |
parameters |
dict[str, Any] | None
|
The parameters of the query. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
list[dict[str, Any]]
|
list[dict[str, Any]]: The result of the query as a list of dictionaries. |
upsert_node(label, identifier_key, identifier_value, properties)
abstractmethod
async
Upsert a node in the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label |
str
|
The label of the node. |
required |
identifier_key |
str
|
The key of the identifier. |
required |
identifier_value |
str
|
The value of the identifier. |
required |
properties |
dict[str, Any] | None
|
The properties of the node. Defaults to None. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The result of the operation. |
upsert_relationship(node_source_key, node_source_value, relation, node_target_key, node_target_value, properties)
abstractmethod
async
Upsert a relationship between two nodes in the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_source_key |
str
|
The key of the source node. |
required |
node_source_value |
str
|
The value of the source node. |
required |
relation |
str
|
The type of the relationship. |
required |
node_target_key |
str
|
The key of the target node. |
required |
node_target_value |
str
|
The value of the target node. |
required |
properties |
dict[str, Any] | None
|
The properties of the relationship. Defaults to None. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The result of the operation. |