LlamaIndex Graph Stores Integration: ApertureDB
ApertureDB is a Multimodal Database. The storage is modelled as a graph.
It can be used off cloud, On premise, and it comes with a public community edition which can run on a laptop too.
This integration implements the PropertyGraph interface of llama_index, which can be used to Store and query a Knowledge Graph using ApertureDB as the store.
Assuming a working and accessible instance of ApertureDB the following examples would work for adding nodes to your graph, and retrieving them.
from llama_index.core.graph_stores.types import Relation, EntityNode
from llama_index.graph_stores.ApertureDB import ApertureDBGraphStore
entities = [
EntityNode(label="PERSON", name="James"),
EntityNode(label="DISH", name="Butter Chicken"),
EntityNode(label="DISH", name="Scrambled Eggs"),
EntityNode(label="INGREDIENT", name="Butter"),
EntityNode(label="INGREDIENT", name="Chicken"),
EntityNode(label="INGREDIENT", name="Eggs"),
EntityNode(label="INGREDIENT", name="Salt"),
]
relations = [
Relation(
label="EATS",
source_id=entities[0].id,
target_id=entities[1].id,
),
Relation(
label="EATS",
source_id=entities[0].id,
target_id=entities[2].id,
),
Relation(
label="CONTAINS",
source_id=entities[1].id,
target_id=entities[3].id,
),
Relation(
label="HAS",
source_id=entities[1].id,
target_id=entities[4].id,
),
Relation(
label="COMPRISED_OF",
source_id=entities[2].id,
target_id=entities[5].id,
),
Relation(
label="GOT",
source_id=entities[2].id,
target_id=entities[6].id,
),
]
graph_store = ApertureDBGraphStore()
graph_store.upsert_nodes(entities)
graph_store.upsert_relations(relations)
Retrieve nodes:
# get all.
print(pg_store.get())
# get nodes by ID.
kg_nodes = pg_store.get(ids=[entities[0].id])
print(kg_nodes)
# get paths from a node
paths = pg_store.get_rel_map(kg_nodes, depth=2)
import json
print(json.dumps(paths, indent=2, default=str))
Metadata
Release files for llama-index-graph-stores-ApertureDB 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_graph_stores_aperturedb-0.4.0.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_graph_stores_aperturedb-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / llama_index_graph_stores_aperturedb-0.4.0.tar.gz
| Download URL | llama_index_graph_stores_aperturedb-0.4.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56dca09fd9349174a296139e0b4fc30034e3b66fae805747febf3d60cb5a0e3c
|
|
BLAKE2b-256 checksum How to use checksums |
e8e50046866942a98021c7f147644b4770e9627ecc6bcaed48bbbfc92a7b594a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_graph_stores_aperturedb-0.4.0-py3-none-any.whl
| Download URL | llama_index_graph_stores_aperturedb-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8ddf2f75721813dfb472d6a019e3caba77e9e0b7f2ee6909705e60a8021206f
|
|
BLAKE2b-256 checksum How to use checksums |
8dac1aa1296c5694326db7cfb1b118d78b8ae33ac2fc6b8652767097e171e925
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|