Index
GraphStore #
Bases: Protocol
Abstract graph store protocol.
This protocol defines the interface for a graph store, which is responsible for storing and retrieving knowledge graph data.
Attributes:
Name | Type | Description |
---|---|---|
client |
Any
|
Any: The client used to connect to the graph store. |
get |
List[List[str]]
|
Callable[[str], List[List[str]]]: Get triplets for a given subject. |
get_rel_map |
Dict[str, List[List[str]]]
|
Callable[[Optional[List[str]], int], Dict[str, List[List[str]]]]: Get subjects' rel map in max depth. |
upsert_triplet |
None
|
Callable[[str, str, str], None]: Upsert a triplet. |
delete |
None
|
Callable[[str, str, str], None]: Delete a triplet. |
persist |
None
|
Callable[[str, Optional[fsspec.AbstractFileSystem]], None]: Persist the graph store to a file. |
get_schema |
str
|
Callable[[bool], str]: Get the schema of the graph store. |
Source code in llama-index-core/llama_index/core/graph_stores/types.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
get #
get(subj: str) -> List[List[str]]
Get triplets.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
35 36 37 |
|
get_rel_map #
get_rel_map(subjs: Optional[List[str]] = None, depth: int = 2, limit: int = 30) -> Dict[str, List[List[str]]]
Get depth-aware rel map.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
39 40 41 42 43 |
|
upsert_triplet #
upsert_triplet(subj: str, rel: str, obj: str) -> None
Add triplet.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
45 46 47 |
|
delete #
delete(subj: str, rel: str, obj: str) -> None
Delete triplet.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
49 50 51 |
|
persist #
persist(persist_path: str, fs: Optional[AbstractFileSystem] = None) -> None
Persist the graph store to a file.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
53 54 55 56 57 |
|
get_schema #
get_schema(refresh: bool = False) -> str
Get the schema of the graph store.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
59 60 61 |
|
query #
query(query: str, param_map: Optional[Dict[str, Any]] = {}) -> Any
Query the graph store with statement and parameters.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
63 64 65 |
|