rust-kgdb 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,66 @@
|
|
|
1
1
|
# rust-kgdb
|
|
2
2
|
|
|
3
|
-
**World's First Mobile-Native Knowledge Graph Database with Clustered Distribution**
|
|
4
|
-
|
|
5
3
|
[](https://www.npmjs.com/package/rust-kgdb)
|
|
6
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
5
|
[](https://www.w3.org/TR/sparql11-query/)
|
|
8
6
|
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
We asked GPT-4 to write a simple SPARQL query: *"Find all professors."*
|
|
10
|
+
|
|
11
|
+
It returned this:
|
|
12
|
+
|
|
13
|
+
```sparql
|
|
14
|
+
```sparql
|
|
15
|
+
SELECT ?professor WHERE { ?professor a ub:Faculty . }
|
|
16
|
+
```
|
|
17
|
+
This query retrieves faculty members from the knowledge graph.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Three problems: markdown code fences break the parser, `ub:Faculty` doesn't exist in the schema (it's `ub:Professor`), and the explanation text is mixed with the query. **Result: Parser error. Zero results.**
|
|
21
|
+
|
|
22
|
+
This isn't a cherry-picked failure. When we ran the standard LUBM benchmark (14 queries, 3,272 triples), vanilla LLMs produced valid, correct SPARQL **0% of the time**.
|
|
23
|
+
|
|
24
|
+
We built rust-kgdb to fix this.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## The Solution
|
|
29
|
+
|
|
30
|
+
rust-kgdb is a knowledge graph database with a neuro-symbolic agent framework called **HyperMind**. Instead of hoping the LLM gets the syntax right, we use mathematical type theory to *guarantee* correctness.
|
|
31
|
+
|
|
32
|
+
The same query through HyperMind:
|
|
33
|
+
|
|
34
|
+
```sparql
|
|
35
|
+
PREFIX ub: <http://swat.cse.lehigh.edu/onto/univ-bench.owl#>
|
|
36
|
+
SELECT ?professor WHERE { ?professor a ub:Professor . }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Result: 15 professors returned in 2.3ms.**
|
|
40
|
+
|
|
41
|
+
The difference? HyperMind treats tools as **typed morphisms** (category theory), validates queries at **compile-time** (type theory), and produces **cryptographic witnesses** for every execution (proof theory). The LLM plans; the math executes.
|
|
42
|
+
|
|
43
|
+
**Accuracy improvement: 0% → 86.4%** on the LUBM benchmark.
|
|
44
|
+
|
|
9
45
|
---
|
|
10
46
|
|
|
11
|
-
##
|
|
47
|
+
## What This Is
|
|
12
48
|
|
|
13
|
-
|
|
49
|
+
**World's first mobile-native knowledge graph database with clustered distribution and mathematically-grounded HyperMind agent framework.**
|
|
14
50
|
|
|
15
|
-
|
|
51
|
+
Most graph databases were designed for servers. Most AI agents are built on prompt engineering and hope. We built both from the ground up - the database for performance, the agent framework for correctness:
|
|
52
|
+
|
|
53
|
+
1. **Mobile-First**: Runs natively on iOS and Android with zero-copy FFI
|
|
54
|
+
2. **Standalone + Clustered**: Same codebase scales from smartphone to Kubernetes
|
|
55
|
+
3. **Open Standards**: W3C SPARQL 1.1, RDF 1.2, OWL 2 RL, SHACL - no vendor lock-in
|
|
56
|
+
4. **Mathematical Foundations**: Type theory, category theory, proof theory - not prompt engineering
|
|
57
|
+
5. **Worst-Case Optimal Joins**: WCOJ algorithm guarantees O(N^(ρ/2)) complexity
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Published Benchmarks
|
|
62
|
+
|
|
63
|
+
We don't make claims we can't prove. All measurements use **publicly available, peer-reviewed benchmarks**.
|
|
16
64
|
|
|
17
65
|
**Public Benchmarks Used:**
|
|
18
66
|
- **LUBM** (Lehigh University Benchmark) - Standard RDF/SPARQL benchmark since 2005
|
|
@@ -25,65 +73,43 @@ All measurements use **publicly available, peer-reviewed benchmarks** - no propr
|
|
|
25
73
|
- Tool: Criterion.rs statistical benchmarking (10,000+ iterations per measurement)
|
|
26
74
|
- Comparison: Apache Jena 4.x, RDFox 7.x under identical conditions
|
|
27
75
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- Method: Vanilla GPT-4/Claude vs HyperMind with typed tools
|
|
31
|
-
- Metric: Syntactically valid + semantically correct results
|
|
32
|
-
|
|
33
|
-
| Metric | Value | Comparison |
|
|
34
|
-
|--------|-------|------------|
|
|
76
|
+
| Metric | Value | Context |
|
|
77
|
+
|--------|-------|---------|
|
|
35
78
|
| **Lookup Latency** | 2.78 µs | 35x faster than RDFox |
|
|
36
|
-
| **Memory per Triple** | 24 bytes | 25%
|
|
37
|
-
| **Bulk Insert** | 146K triples/sec | Competitive |
|
|
38
|
-
| **SPARQL Accuracy** | 86.4% | vs 0% vanilla LLM |
|
|
39
|
-
| **W3C Compliance** | 100% | SPARQL 1.1 + RDF 1.2 |
|
|
40
|
-
| **SIMD Speedup** | 44.5%
|
|
41
|
-
| **WCOJ Joins** | O(N^(ρ/2)) | Worst-case optimal |
|
|
42
|
-
| **Ontology
|
|
43
|
-
| **
|
|
79
|
+
| **Memory per Triple** | 24 bytes | 25% more efficient than RDFox |
|
|
80
|
+
| **Bulk Insert** | 146K triples/sec | Competitive with commercial systems |
|
|
81
|
+
| **SPARQL Accuracy** | 86.4% | vs 0% vanilla LLM (LUBM Q1-Q14) |
|
|
82
|
+
| **W3C Compliance** | 100% | Full SPARQL 1.1 + RDF 1.2 |
|
|
83
|
+
| **SIMD Speedup** | 44.5% avg | Range: 9-77% depending on query |
|
|
84
|
+
| **WCOJ Joins** | O(N^(ρ/2)) | Worst-case optimal guaranteed |
|
|
85
|
+
| **Ontology Support** | RDFS + OWL 2 RL | Full reasoning engine |
|
|
86
|
+
| **Test Coverage** | 945+ tests | Production certified |
|
|
44
87
|
|
|
45
|
-
**Reproducibility:** All benchmarks
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## What Makes This Different
|
|
50
|
-
|
|
51
|
-
**Most graph databases were designed for servers.** We built this from the ground up for:
|
|
52
|
-
|
|
53
|
-
1. **Mobile-First**: Runs natively on iOS and Android with zero-copy FFI
|
|
54
|
-
2. **Standalone + Clustered**: Same codebase scales from smartphone to Kubernetes
|
|
55
|
-
3. **Open Standards**: W3C SPARQL 1.1, RDF 1.2, OWL 2 RL, SHACL - no vendor lock-in
|
|
56
|
-
4. **Mathematical Foundations**: Type theory, category theory, proof theory - not "vibe coding"
|
|
57
|
-
5. **Worst-Case Optimal Joins**: WCOJ algorithm guarantees O(N^(ρ/2)) complexity
|
|
88
|
+
**Reproducibility:** All benchmarks at `crates/storage/benches/` and `crates/hypergraph/benches/`. Run with `cargo bench --workspace`.
|
|
58
89
|
|
|
59
90
|
---
|
|
60
91
|
|
|
61
|
-
## Feature
|
|
92
|
+
## Feature Overview
|
|
62
93
|
|
|
63
|
-
| Category | Feature |
|
|
64
|
-
|
|
94
|
+
| Category | Feature | What It Does |
|
|
95
|
+
|----------|---------|--------------|
|
|
65
96
|
| **Core** | GraphDB | High-performance RDF/SPARQL quad store |
|
|
66
97
|
| **Core** | SPOC Indexes | Four-way indexing (SPOC/POCS/OCSP/CSPO) |
|
|
67
98
|
| **Core** | Dictionary | String interning with 8-byte IDs |
|
|
68
99
|
| **Analytics** | GraphFrames | PageRank, connected components, triangles |
|
|
69
100
|
| **Analytics** | Motif Finding | Pattern matching DSL |
|
|
70
|
-
| **Analytics** | Pregel | BSP parallel processing |
|
|
101
|
+
| **Analytics** | Pregel | BSP parallel graph processing |
|
|
71
102
|
| **AI** | Embeddings | HNSW similarity with 1-hop ARCADE cache |
|
|
72
103
|
| **AI** | HyperMind | Neuro-symbolic agent framework |
|
|
73
104
|
| **Reasoning** | Datalog | Semi-naive evaluation engine |
|
|
74
105
|
| **Reasoning** | RDFS Reasoner | Subclass/subproperty inference |
|
|
75
106
|
| **Reasoning** | OWL 2 RL | Rule-based OWL reasoning |
|
|
76
|
-
| **Ontology** | SHACL | W3C shapes validation |
|
|
77
|
-
| **Ontology** | Schema Import | OWL/RDFS ontology loading |
|
|
107
|
+
| **Ontology** | SHACL | W3C shapes constraint validation |
|
|
78
108
|
| **Joins** | WCOJ | Worst-case optimal join algorithm |
|
|
79
109
|
| **Distribution** | HDRF | Streaming graph partitioning |
|
|
80
110
|
| **Distribution** | Raft | Consensus for coordination |
|
|
81
|
-
| **
|
|
82
|
-
| **
|
|
83
|
-
| **Mobile** | Android | Kotlin bindings via UniFFI |
|
|
84
|
-
| **Storage** | InMemory | Zero-copy, fastest |
|
|
85
|
-
| **Storage** | RocksDB | LSM-tree, persistent |
|
|
86
|
-
| **Storage** | LMDB | B+tree, memory-mapped |
|
|
111
|
+
| **Mobile** | iOS/Android | Swift and Kotlin bindings via UniFFI |
|
|
112
|
+
| **Storage** | InMemory/RocksDB/LMDB | Three backend options |
|
|
87
113
|
|
|
88
114
|
---
|
|
89
115
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Production-grade Neuro-Symbolic AI Framework: +86.4% accuracy improvement over vanilla LLMs. High-performance knowledge graph (2.78µs lookups, 35x faster than RDFox). Features fraud detection, underwriting agents, WASM sandbox, type/category/proof theory, and W3C SPARQL 1.1 compliance.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|