API reference¶
The stable surface — kglite::api::* — that gets semver
guarantees. Items outside this surface (kglite::graph::*,
kglite::datatypes::*, etc.) are implementation details and may
move between minor releases.
For per-symbol API docs (function signatures, struct fields, trait method docs), use docs.rs/kglite. This page is the curated inventory. If you’re building a library that produces kglite graphs, see Building on kglite.
Stability policy¶
kglite::api::* — and the kglite-mcp-server library surface — are
exact-baseline-locked in CI (cargo-public-api, pinned nightly): accidental
drift cannot merge, because the generated public-API listing is diffed against a
committed baseline on every PR. The include/kglite.h C header is drift-checked
the same way (cbindgen vs the committed header).
Pre-1.0, the policy is:
PATCH releases never break the API — additive or internal only.
MINOR releases may break it deliberately. Every intentional break ships with a
CHANGELOG.mdentry and, when user-visible, a migration guide. The minor bump is the pre-1.0 breaking-change signal — we never patch-bump a removal.New options land under 0.14’s options-struct convention (
*Optionsstructs,#[non_exhaustive]+Default), so adding an option is a non-breaking change rather than a signature break.
1.0 criterion: the 0.14 surface — after the options-struct pass on
api::algorithms — soaks across releases without needing a breaking correction.
When the curated facade proves stable in the field, we cut 1.0 and the pre-1.0
“minor may break” latitude ends.
Engine types¶
Item |
Path |
Purpose |
|---|---|---|
|
|
The in-memory graph. Owned by your binding’s “graph handle”. |
|
|
Every value Cypher can return: scalars, |
|
|
Per-variant carriers; pattern-match into them without deriving accessors. |
|
|
Typed error enum (16 variants). Map to your binding’s error idiom. File I/O: |
|
|
Pluggable text-embedding backend for |
|
|
Rust-native ONNX embedder. |
|
|
Code-entity location lookup result types. |
|
|
Codebase exploration as a markdown report. |
I/O¶
Item |
Path |
Purpose |
|---|---|---|
|
|
Read a |
|
|
Load an in-memory graph from a |
|
|
Write an |
|
|
Atomic (temp+rename) + durable ( |
|
|
Serialize the |
DirGraph::copy_embeddings_from(&src) carries embedding stores across a rebuild
by node id (the core behind the Python copy_embeddings_from). The other new
0.11.0 methods — embedding_info / embedding_dim, replace_connections,
embed_texts(mode=…), freeze — are binding-surface (Python KnowledgeGraph)
methods, documented in the Python track, not raw kglite::api functions.
Schema introspection¶
Item |
Path |
Purpose |
|---|---|---|
|
|
XML schema description for agent system prompts. |
|
|
Structured |
|
|
Structured introspection types. |
Cypher pipeline (kglite::api::cypher)¶
For building custom pipelines. For the canonical pipeline, use
the session module instead.
Item |
Purpose |
|---|---|
|
Parse a query string → |
|
Schema-check a parsed query against a graph. |
|
Lower |
|
Mark queries eligible for streaming materialization. |
|
Run the optimizer passes; introspect the pipeline. |
|
Execute a planned query against a graph. |
|
Mutation execution path. |
|
Heuristic: does this query mutate? |
|
Build an EXPLAIN-style plan as a CypherResult. |
|
Data types. |
Session (canonical query + transaction surface)¶
The Phase E “single source of truth” — all bindings flow through here.
Item |
Path |
Purpose |
|---|---|---|
|
|
Shared graph state with commit-swap semantics. |
|
|
Snapshot/working CoW transaction state. |
|
|
|
|
|
Params + deadline + max_rows + lazy hint + embedder. |
|
|
|
|
|
Run a read query. |
|
|
Run a mutation. |
Dataset loaders¶
The pre-packaged dataset loaders (SEC EDGAR, Sodir, Wikidata) are no
longer part of the kglite core API surface — they live in the
separate kglite-datasets project, and kglite::api::datasets::* (and
the sec / sodir / wikidata Cargo features) have been removed.
kglite loads the graphs those loaders produce via the ordinary
lifecycle API. To ingest RDF directly, use the kept RDF/N-Triples
loaders.
Semver¶
kglite::api::* items above get semver guarantees within a minor
release. Anything outside that surface — kglite::graph::*,
kglite::datatypes::*, raw module paths — is internal and may
move freely between minor releases.
Change kind |
Bumps |
|---|---|
New item in |
Minor ( |
Breaking change to an item already in |
Major ( |
Internal rearrangement (non-api items) |
Patch ( |
The .kgl file format has its own version (v3, v4, …)
tracked separately. Format bumps land with their decoder and
require a graph rebuild from source.
Where to find each item¶
kglite:: (the crate root)
├── api:: (this stable surface)
│ ├── cypher:: (parse / plan / execute primitives)
│ └── session:: (canonical Cypher pipeline + transactions)
├── datatypes:: (internal — use api::Value)
├── error (internal — use api::KgError)
├── graph:: (internal — engine submodules)