| Crates.io | oxirs-tdb |
| lib.rs | oxirs-tdb |
| version | 0.1.0 |
| created_at | 2025-09-30 08:38:47.988321+00 |
| updated_at | 2026-01-20 21:27:53.757145+00 |
| description | Apache Jena TDB/TDB2 compatible RDF storage engine with B+Tree indexes |
| homepage | https://github.com/cool-japan/oxirs |
| repository | https://github.com/cool-japan/oxirs |
| max_upload_size | |
| id | 1860798 |
| size | 2,010,427 |
Status: Production Release (v0.1.0) - Released January 7, 2026
✨ Production Release: Production-ready with API stability guarantees. Semantic versioning enforced.
A high-performance, ACID-compliant RDF storage engine with multi-version concurrency control (MVCC) and advanced transaction support. OxiRS TDB provides TDB2-equivalent functionality with modern Rust performance optimizations.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Query Layer │ │ Transaction Mgr │ │ WAL Recovery │
│ (oxirs-arq) │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────────────────────────────────────────────────────┐
│ TDB Storage Engine │
├─────────────────┬─────────────────┬─────────────────┬──────────┤
│ Triple Store │ Node Table │ B+ Tree │ MVCC │
│ │ │ Indices │ Storage │
└─────────────────┴─────────────────┴─────────────────┴──────────┘
│ │ │
┌─────────────────┬─────────────────┬─────────────────┬──────────┐
│ Page Manager │ Assembler │ Buffer Pool │ WAL │
│ │ │ │ │
└─────────────────┴─────────────────┴─────────────────┴──────────┘
Add to your Cargo.toml:
[dependencies]
oxirs-tdb = "0.1.0"
use oxirs_tdb::{TdbStore, TdbConfig};
use oxirs_core::{Triple, Quad, Term};
// Create a new TDB store
let config = TdbConfig::new()
.with_directory("./data/tdb")
.with_cache_size(1024 * 1024 * 1024) // 1GB cache
.with_sync_mode(true);
let mut store = TdbStore::new(config)?;
// Start a transaction
let mut txn = store.begin_transaction()?;
// Insert triples
let subject = Term::iri("http://example.org/subject")?;
let predicate = Term::iri("http://example.org/predicate")?;
let object = Term::literal("Hello, World!")?;
let triple = Triple::new(subject, predicate, object);
txn.insert_triple(&triple)?;
// Commit transaction
txn.commit()?;
// Query data
let results = store.query_pattern(
Some(&subject),
Some(&predicate),
None
)?;
for triple in results {
println!("{}", triple);
}
use oxirs_tdb::{TdbStore, TdbConfig, TransactionOptions};
// Configure with advanced options
let config = TdbConfig::new()
.with_directory("./data/tdb")
.with_cache_size(2 * 1024 * 1024 * 1024) // 2GB cache
.with_page_size(8192) // 8KB pages
.with_wal_enabled(true)
.with_checkpoint_interval(Duration::from_secs(300))
.with_mvcc_enabled(true);
let store = TdbStore::new(config)?;
// Use transactions with options
let txn_options = TransactionOptions::new()
.with_isolation_level(IsolationLevel::Snapshot)
.with_timeout(Duration::from_secs(30));
let mut txn = store.begin_transaction_with_options(txn_options)?;
// Bulk insert
let triples = vec![
Triple::new(/* ... */),
Triple::new(/* ... */),
// ... more triples
];
txn.insert_triples_batch(&triples)?;
txn.commit()?;
let config = TdbConfig::new()
// Storage location
.with_directory("./data/tdb")
// Memory management
.with_cache_size(1_073_741_824) // 1GB
.with_page_size(8192) // 8KB pages
// Transaction settings
.with_mvcc_enabled(true)
.with_wal_enabled(true)
.with_checkpoint_interval(Duration::from_secs(300))
// Performance tuning
.with_sync_mode(true)
.with_compression_enabled(true)
.with_statistics_enabled(true)
// Concurrency
.with_max_concurrent_transactions(1000)
.with_deadlock_detection_enabled(true);
Run the comprehensive test suite:
# Run all tests with nextest (recommended)
cargo nextest run --no-fail-fast
# Run specific test categories
cargo nextest run --no-fail-fast -p oxirs-tdb
# Run with all features
cargo nextest run --no-fail-fast --all-features
# Run performance tests
cargo nextest run --no-fail-fast --release -- --ignored
# Run benchmarks
cargo bench
# Profile with specific datasets
cargo run --release --bin tdb-benchmark -- --dataset large --queries complex
# Build with all features
cargo build --all-features
# Build optimized release
cargo build --release --all-features
# Run clippy
cargo clippy --workspace --all-targets -- -D warnings
# Format code
cargo fmt --all
oxirs-tdb/
├── src/
│ ├── lib.rs # Public API
│ ├── assembler.rs # Low-level operations
│ ├── nodes.rs # Node table implementation
│ ├── page.rs # Page management
│ ├── triple_store.rs # Triple storage engine
│ └── wal/ # Write-ahead logging
│ ├── mod.rs
│ ├── recovery.rs
│ └── log.rs
├── tests/ # Integration tests
├── benches/ # Performance benchmarks
├── examples/ # Usage examples
└── data/ # Test datasets
cargo nextest run --no-fail-fastcargo clippy --workspace --all-targets -- -D warningsOxiRS TDB provides feature parity with Apache Jena TDB2:
// Convert TDB2 database to OxiRS TDB
use oxirs_tdb::migration::tdb2_converter;
let converter = tdb2_converter::Tdb2Converter::new()
.with_source_directory("./jena-tdb2-data")
.with_target_directory("./oxirs-tdb-data");
converter.convert()?;
Q: Database corruption after crash A: Run the recovery tool:
cargo run --bin tdb-recovery -- --database ./data/tdb --verify
Q: Poor query performance A: Check statistics and indices:
cargo run --bin tdb-analyze -- --database ./data/tdb --verbose
Q: High memory usage A: Adjust cache size in configuration:
let config = TdbConfig::new()
.with_cache_size(512 * 1024 * 1024) // Reduce to 512MB
.with_page_size(4096); // Smaller pages
Enable debug logging:
env_logger::init();
let config = TdbConfig::new()
.with_debug_mode(true)
.with_statistics_enabled(true);
Licensed under the MIT License. See LICENSE for details.
For more information, see the OxiRS project documentation.