| --- |
| license: cc-by-4.0 |
| language: |
| - en |
| tags: |
| - mathematics |
| - knowledge-graph |
| - sqlite |
| - tool-use |
| pretty_name: Filtered Math Knowledge Base (SQLite) |
| --- |
| |
| # Knowledgebase Filtered (SQLite) |
|
|
| College-math knowledge graph as a queryable SQLite + FTS5 database, designed |
| for retrieval / tool-call agents (`kg_search_statement`, `kg_get_statement`, |
| `kg_get_dependencies`, `md_fetch_section`, ...). |
|
|
| ## What's filtered |
|
|
| The full corpus (887,223 statement nodes) is retained so dependency lookups and |
| full-text search stay complete. Two annotation columns were added to mark the |
| cleaned **anchor pool** — statements good enough to seed an exam question: |
|
|
| | column | meaning | |
| |---|---| |
| | `anchor_eligible` | `1` for the **23,182** complete anchors | |
| | `completeness_verdict` | `self_contained` / `incomplete` / `NULL` | |
|
|
| ### How the 23,182 anchors were selected |
| - Base filter: `has_proof=1 AND is_closed=1 AND has ≥1 dependency` |
| - **11,750** long anchors (200–4000 chars) — kept directly |
| - **11,432** short anchors (50–199 chars) — **rescued** by an LLM completeness |
| check (`qwen3.5-35b-a3b`, no-think): judged `self_contained` |
| - 8,086 short anchors judged `incomplete` are flagged but **not** anchor-eligible |
| - <50-char statements are excluded from anchoring (too fragmentary) |
|
|
| ## Usage |
|
|
| ```python |
| import sqlite3 |
| conn = sqlite3.connect("file:index.sqlite?mode=ro&immutable=1", uri=True) |
| conn.row_factory = sqlite3.Row |
| # the cleaned anchor pool: |
| rows = conn.execute("SELECT cid, entity_name FROM statements WHERE anchor_eligible=1").fetchall() |
| ``` |
|
|
| Point the tool layer at it via `COLLEGE_MATH_KG_INDEX=/path/to/index.sqlite`. |
|
|
| ## Tables |
| `statements` (nodes + the two new columns), `fts` (FTS5 over name+statement), |
| `books` (book metadata). |
|
|