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
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
get #
get(subj: str) -> List[List[str]]
Get triplets.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
241 242 243 |
|
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
245 246 247 248 249 |
|
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
251 252 253 |
|
delete #
delete(subj: str, rel: str, obj: str) -> None
Delete triplet.
Source code in llama-index-core/llama_index/core/graph_stores/types.py
255 256 257 |
|
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
259 260 261 262 263 |
|
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
265 266 267 |
|
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
269 270 271 |
|