rust-kgdb 0.2.0 → 0.2.2
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 +101 -23
- package/index.js +35 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -20,15 +20,32 @@ rust-kgdb supports three deployment modes:
|
|
|
20
20
|
| **Single Node (RocksDB/LMDB)** | Production, persistence needed | Single node, persistent | Via Rust crate |
|
|
21
21
|
| **Distributed Cluster** | Enterprise, 1B+ triples | Horizontal scaling, 9+ partitions | Contact us |
|
|
22
22
|
|
|
23
|
-
###
|
|
23
|
+
### Distributed Cluster Mode (Enterprise)
|
|
24
24
|
|
|
25
|
-
For enterprise deployments requiring:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
- **OLAP
|
|
30
|
-
-
|
|
31
|
-
- Kubernetes-
|
|
25
|
+
For enterprise deployments requiring 1B+ triples and horizontal scaling:
|
|
26
|
+
|
|
27
|
+
**Key Features:**
|
|
28
|
+
- **Subject-Anchored Partitioning**: All triples for a subject are guaranteed on the same partition for optimal locality
|
|
29
|
+
- **Arrow-Powered OLAP**: High-performance analytical queries executed as optimized SQL at scale
|
|
30
|
+
- **Automatic Query Routing**: The coordinator intelligently routes queries to the right executors
|
|
31
|
+
- **Kubernetes-Native**: StatefulSet-based executors with automatic failover
|
|
32
|
+
- **Linear Horizontal Scaling**: Add more executor pods to scale throughput
|
|
33
|
+
|
|
34
|
+
**How It Works:**
|
|
35
|
+
|
|
36
|
+
Your SPARQL queries work unchanged. For large-scale aggregations, the cluster automatically optimizes execution:
|
|
37
|
+
|
|
38
|
+
```sparql
|
|
39
|
+
-- Your SPARQL query
|
|
40
|
+
SELECT (COUNT(*) AS ?count) (AVG(?salary) AS ?avgSalary)
|
|
41
|
+
WHERE {
|
|
42
|
+
?employee <http://ex/type> <http://ex/Employee> .
|
|
43
|
+
?employee <http://ex/salary> ?salary .
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
-- Cluster executes as optimized SQL internally
|
|
47
|
+
-- Results aggregated across all partitions automatically
|
|
48
|
+
```
|
|
32
49
|
|
|
33
50
|
**Request a demo: gonnect.uk@gmail.com**
|
|
34
51
|
|
|
@@ -282,18 +299,17 @@ fs.writeFileSync('backup.nt', ntriples)
|
|
|
282
299
|
npm install rust-kgdb
|
|
283
300
|
```
|
|
284
301
|
|
|
285
|
-
### Platform Support
|
|
302
|
+
### Platform Support (v0.2.1)
|
|
286
303
|
|
|
287
|
-
| Platform | Architecture | Status |
|
|
288
|
-
|
|
289
|
-
| **macOS** | Intel (x64) | ✅ |
|
|
290
|
-
| **macOS** | Apple Silicon (arm64) |
|
|
291
|
-
| **Linux** | x64 |
|
|
292
|
-
| **Linux** | arm64 |
|
|
293
|
-
| **Windows** | x64 |
|
|
294
|
-
| **Windows** | arm64 | ⏳ v0.2.0 | — |
|
|
304
|
+
| Platform | Architecture | Status | Notes |
|
|
305
|
+
|----------|-------------|--------|-------|
|
|
306
|
+
| **macOS** | Intel (x64) | ✅ **Works out of the box** | Pre-built binary included |
|
|
307
|
+
| **macOS** | Apple Silicon (arm64) | ⏳ v0.2.2 | Coming soon |
|
|
308
|
+
| **Linux** | x64 | ⏳ v0.2.2 | Coming soon |
|
|
309
|
+
| **Linux** | arm64 | ⏳ v0.2.2 | Coming soon |
|
|
310
|
+
| **Windows** | x64 | ⏳ v0.2.2 | Coming soon |
|
|
295
311
|
|
|
296
|
-
**
|
|
312
|
+
**This release (v0.2.1)** includes pre-built binary for **macOS x64 only**. Other platforms will be added in the next release.
|
|
297
313
|
|
|
298
314
|
---
|
|
299
315
|
|
|
@@ -446,15 +462,64 @@ db.querySelect(`
|
|
|
446
462
|
### UPDATE Operations
|
|
447
463
|
|
|
448
464
|
```typescript
|
|
449
|
-
// INSERT DATA
|
|
465
|
+
// INSERT DATA - Add new triples
|
|
450
466
|
db.updateInsert(`
|
|
451
|
-
|
|
467
|
+
PREFIX ex: <http://example.org/>
|
|
468
|
+
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
|
|
469
|
+
|
|
470
|
+
INSERT DATA {
|
|
471
|
+
ex:david a foaf:Person ;
|
|
472
|
+
foaf:name "David" ;
|
|
473
|
+
foaf:age 28 ;
|
|
474
|
+
foaf:email "david@example.org" .
|
|
475
|
+
|
|
476
|
+
ex:project1 ex:hasLead ex:david ;
|
|
477
|
+
ex:budget 50000 ;
|
|
478
|
+
ex:status "active" .
|
|
479
|
+
}
|
|
452
480
|
`)
|
|
453
481
|
|
|
454
|
-
//
|
|
482
|
+
// Verify insert
|
|
483
|
+
const count = db.count()
|
|
484
|
+
console.log(`Total triples after insert: ${count}`)
|
|
485
|
+
|
|
486
|
+
// DELETE WHERE - Remove matching triples
|
|
455
487
|
db.updateDelete(`
|
|
456
|
-
|
|
488
|
+
PREFIX ex: <http://example.org/>
|
|
489
|
+
DELETE WHERE { ?s ex:status "completed" }
|
|
490
|
+
`)
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Bulk Data Loading Example
|
|
494
|
+
|
|
495
|
+
```typescript
|
|
496
|
+
import { GraphDB } from 'rust-kgdb'
|
|
497
|
+
import { readFileSync } from 'fs'
|
|
498
|
+
|
|
499
|
+
const db = new GraphDB('http://example.org/bulk-load')
|
|
500
|
+
|
|
501
|
+
// Load Turtle file
|
|
502
|
+
const ttlData = readFileSync('data/knowledge-graph.ttl', 'utf-8')
|
|
503
|
+
db.loadTtl(ttlData, null) // null = default graph
|
|
504
|
+
|
|
505
|
+
// Load into named graph
|
|
506
|
+
const orgData = readFileSync('data/organization.ttl', 'utf-8')
|
|
507
|
+
db.loadTtl(orgData, 'http://example.org/graphs/org')
|
|
508
|
+
|
|
509
|
+
// Load N-Triples format
|
|
510
|
+
const ntData = readFileSync('data/triples.nt', 'utf-8')
|
|
511
|
+
db.loadNTriples(ntData, null)
|
|
512
|
+
|
|
513
|
+
console.log(`Loaded ${db.count()} triples`)
|
|
514
|
+
|
|
515
|
+
// Query across all graphs
|
|
516
|
+
const results = db.querySelect(`
|
|
517
|
+
SELECT ?g (COUNT(*) AS ?count) WHERE {
|
|
518
|
+
GRAPH ?g { ?s ?p ?o }
|
|
519
|
+
}
|
|
520
|
+
GROUP BY ?g
|
|
457
521
|
`)
|
|
522
|
+
console.log('Triples per graph:', results)
|
|
458
523
|
```
|
|
459
524
|
|
|
460
525
|
---
|
|
@@ -614,11 +679,24 @@ Total: ~120 bytes/triple including indexes
|
|
|
614
679
|
|
|
615
680
|
## Version History
|
|
616
681
|
|
|
682
|
+
### v0.2.2 (2025-12-08) - Enhanced Documentation
|
|
683
|
+
|
|
684
|
+
- Added comprehensive INSERT DATA examples with PREFIX syntax
|
|
685
|
+
- Added bulk data loading example with named graphs
|
|
686
|
+
- Enhanced SPARQL UPDATE section with real-world patterns
|
|
687
|
+
- Improved documentation for data import workflows
|
|
688
|
+
|
|
689
|
+
### v0.2.1 (2025-12-08) - npm Platform Fix
|
|
690
|
+
|
|
691
|
+
- Fixed native module loading for platform-specific binaries
|
|
692
|
+
- This release includes pre-built binary for **macOS x64** only
|
|
693
|
+
- Other platforms coming in next release
|
|
694
|
+
|
|
617
695
|
### v0.2.0 (2025-12-08) - Distributed Cluster Support
|
|
618
696
|
|
|
619
697
|
- **NEW: Distributed cluster architecture** with HDRF partitioning
|
|
620
698
|
- **Subject-Hash Filter** for accurate COUNT deduplication across replicas
|
|
621
|
-
- **
|
|
699
|
+
- **Arrow-powered OLAP** query path for high-performance analytical queries
|
|
622
700
|
- Coordinator-Executor pattern with gRPC communication
|
|
623
701
|
- 9-partition default for optimal data distribution
|
|
624
702
|
- **Contact for cluster deployment**: gonnect.uk@gmail.com
|
package/index.js
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
// Platform-specific native module loading for NAPI-RS
|
|
2
|
+
const os = require('os')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
|
|
5
|
+
function loadNativeBinding() {
|
|
6
|
+
const platform = os.platform()
|
|
7
|
+
const arch = os.arch()
|
|
8
|
+
|
|
9
|
+
// Map Node.js arch/platform to NAPI-RS naming convention
|
|
10
|
+
let nativeBinding
|
|
11
|
+
|
|
12
|
+
if (platform === 'darwin') {
|
|
13
|
+
if (arch === 'x64') {
|
|
14
|
+
nativeBinding = require('./rust-kgdb-napi.darwin-x64.node')
|
|
15
|
+
} else if (arch === 'arm64') {
|
|
16
|
+
nativeBinding = require('./rust-kgdb-napi.darwin-arm64.node')
|
|
17
|
+
}
|
|
18
|
+
} else if (platform === 'linux') {
|
|
19
|
+
if (arch === 'x64') {
|
|
20
|
+
nativeBinding = require('./rust-kgdb-napi.linux-x64-gnu.node')
|
|
21
|
+
} else if (arch === 'arm64') {
|
|
22
|
+
nativeBinding = require('./rust-kgdb-napi.linux-arm64-gnu.node')
|
|
23
|
+
}
|
|
24
|
+
} else if (platform === 'win32' && arch === 'x64') {
|
|
25
|
+
nativeBinding = require('./rust-kgdb-napi.win32-x64-msvc.node')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!nativeBinding) {
|
|
29
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}. Please contact support.`)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return nativeBinding
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { GraphDb, getVersion } = loadNativeBinding()
|
|
2
36
|
|
|
3
37
|
module.exports = {
|
|
4
38
|
GraphDB: GraphDb, // Export as GraphDB for consistency
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "High-performance RDF/SPARQL database with 100% W3C compliance, WCOJ execution, and distributed cluster support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"*.node"
|
|
57
57
|
],
|
|
58
58
|
"optionalDependencies": {
|
|
59
|
-
"rust-kgdb-win32-x64-msvc": "0.2.
|
|
60
|
-
"rust-kgdb-darwin-x64": "0.2.
|
|
61
|
-
"rust-kgdb-linux-x64-gnu": "0.2.
|
|
62
|
-
"rust-kgdb-darwin-arm64": "0.2.
|
|
63
|
-
"rust-kgdb-linux-arm64-gnu": "0.2.
|
|
59
|
+
"rust-kgdb-win32-x64-msvc": "0.2.2",
|
|
60
|
+
"rust-kgdb-darwin-x64": "0.2.2",
|
|
61
|
+
"rust-kgdb-linux-x64-gnu": "0.2.2",
|
|
62
|
+
"rust-kgdb-darwin-arm64": "0.2.2",
|
|
63
|
+
"rust-kgdb-linux-arm64-gnu": "0.2.2"
|
|
64
64
|
}
|
|
65
65
|
}
|