hyper-kg
A small, typed knowledge-graph interface for reified-infon facts — ingest a pile of infons, store them as a property graph, and retrieve with typed primitives. Dependency-free core (stdlib SQLite), with a bring-your-own data layer via one protocol.
An infon is a reified hyperedge: a fact promoted to a first-class, addressable node binding typed role-participants (subject, object, …), carrying polarity, an evidence-mass triple, and provenance — so other facts can point at it.
from hyper_kg import KG
kg = KG.open("sqlite:///world.db") # or "sqlite://:memory:", or a custom scheme
# write a pile of infons (the {subject,predicate,object,polarity,mass,...} dict shape)
kg.write_infons("doc1", pile) # dedup → fan out → one transaction → idempotent
# typed retrieval
kg.find(predicate="supplies", polarity="affirmed")
kg.neighbors("Samsung SDI", hops=2)
# optional: extract straight from text (needs `pip install hyper-kg[extract]`)
kg.ingest("Samsung SDI supplies cells to BMW.", doc_id="doc2")
What it does
write_infons(doc_id, pile)— each infon fans out into an:Infonnode + canonical:Entitynodes +HAS_INFON/S_OF/O_OFedges, batched in one transaction. Idempotent by content-hash id (re-ingest is a no-op). Deduped by(subject, predicate, object, polarity).- Typed retrieval —
find(...)(indexed by subject/predicate/object/polarity),neighbors(node, hops=...)(graph walk),get_infon(id),anchors(). - Bring your own backend — implement the
KGStoreprotocol and register it:KG.register_backend("mydb", MyStoreClass) kg = KG.open("mydb://...")
Design
- Entities arrive canonical. Subject/object are expected to be already-normalized canonical
ids (e.g. resolved at extraction time), so there is no entity-resolution pass — the graph stays
connected by construction. Un-anchored novel entities can be flagged
provisional. - Generic property graph.
nodes(id, labels, props_json + virtual indexed columns)andedges(src, dst, type, props_json)— no per-fact schema migration. - Typed ops, not query strings. The interface is a small typed method API every backend implements natively, so SQL and custom backends are first-class. A graph-native backend may expose an optional query escape hatch.
License
Apache-2.0.
Metadata
Release files for hyper-kg 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hyper_kg-0.1.6.tar.gz | 24.4 kB | Without provenance | Details for hyper_kg-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hyper_kg-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for hyper_kg-0.1.6-py3-none-any.whl |
Total release size: 51.1 kB
Release files / hyper_kg-0.1.6.tar.gz
| Download URL | hyper_kg-0.1.6.tar.gz |
|---|---|
| Size | 24.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de63acf2098dc5b6c351238d7ac5c7fc616591bbcdcf054dab0cf96f4a07a648
|
|
BLAKE2b-256 checksum How to use checksums |
db48b6dcada3464de9332724d789d1e26b6bbe002c86edf38ae5eade7c3bd03c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / hyper_kg-0.1.6-py3-none-any.whl
| Download URL | hyper_kg-0.1.6-py3-none-any.whl |
|---|---|
| Size | 26.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a1be9b2a4ad874266ae3e0e8f5907b9fa72fbf2ab120924c917354261374c39
|
|
BLAKE2b-256 checksum How to use checksums |
ee6afe0e6cc0e5b5527d53031b55190f4993f619553d9004063a61e9342460a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for hyper-kg 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.