OxiRS ARQ
SPARQL query engine with algebra and optimization
Status: Production Release (v0.1.0) - Released January 7, 2026
✨ Production Release: Production-ready with API stability guarantees. Semantic versioning enforced.
Overview
oxirs-arq is a SPARQL 1.1/1.2 query engine inspired by Apache Jena's ARQ engine. It provides query optimization, extensible algebra operations, and built-in function support.
Features
- SPARQL 1.1/1.2 Compliance: Implementation of SPARQL standards
- Query Optimization: Cost-based optimization with statistics
- Extensible Algebra: Pluggable operators and custom function support
- Parallel Execution: Multi-threaded query execution
- Memory Management: Efficient memory usage with streaming evaluation
- Custom Functions: Integration of domain-specific functions
- Query Planning: Join reordering and optimization passes
- Result Streaming: Support for large result sets
- Federation Support: SERVICE keyword for distributed queries
- Caching: Query plan and result caching
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Basic Query Execution
use ;
use Dataset;
async
Custom Function Registration
use ;
// Define custom function
;
// Register function
let mut engine = new;
engine.register_function;
// Use in query
let query = parse?;
Query Optimization
use ;
let engine = builder
.optimization_level
.enable_statistics
.enable_caching
.parallel_execution
.build;
// Enable specific optimizations
let optimizer = new
.enable_join_reordering
.enable_filter_pushdown
.enable_projection_pushdown
.enable_constant_folding
.enable_dead_code_elimination;
engine.set_optimizer;
Query Algebra
Algebra Operations
The engine supports a rich set of algebraic operations:
use ;
// Build query algebra programmatically
let bgp1 = BGPnew;
let bgp2 = BGPnew;
let join = new;
let filter = new;
let algebra = from;
Custom Operators
use ;
Advanced Features
Parallel Execution
use ;
let engine = builder
.parallel_config
.build;
// Queries are automatically parallelized based on algebra structure
let query = parse?;
Result Streaming
use ;
use StreamExt;
let engine = builder
.streaming_config
.build;
let query = parse?;
let mut stream = engine.execute_streaming.await?;
while let Some = stream.next.await
Federation
use ;
let engine = builder
.federation_config
.remote_endpoint
.remote_endpoint
.build;
let query = parse?;
Built-in Functions
String Functions
SELECT ?person ?upperName WHERE {
?person foaf:name ?name .
BIND(UCASE(?name) AS ?upperName)
FILTER(CONTAINS(?name, "John"))
}
Math Functions
SELECT ?value ?rounded ?sqrt WHERE {
?item ex:value ?value .
BIND(ROUND(?value) AS ?rounded)
BIND(SQRT(?value) AS ?sqrt)
FILTER(?value > 0)
}
Date/Time Functions
SELECT ?event ?year ?monthName WHERE {
?event ex:date ?date .
BIND(YEAR(?date) AS ?year)
BIND(MONTH(?date) AS ?month)
BIND(IF(?month = 1, "January",
IF(?month = 2, "February", ...)) AS ?monthName)
}
Aggregate Functions
SELECT ?category (COUNT(?item) AS ?count) (AVG(?price) AS ?avgPrice) WHERE {
?item ex:category ?category ;
ex:price ?price .
}
GROUP BY ?category
HAVING (?count > 5)
ORDER BY DESC(?avgPrice)
Performance
Benchmarks
| Query Type | QPS | Latency (p95) | Memory |
|---|---|---|---|
| Simple BGP | 25,000 | 5ms | 15MB |
| Complex Join | 5,000 | 25ms | 45MB |
| Aggregation | 3,000 | 35ms | 35MB |
| Federation | 1,200 | 150ms | 25MB |
Optimization Statistics
use ;
let mut engine = new;
engine.enable_statistics;
// Execute queries to collect statistics
for query in queries
// View optimization statistics
let stats = engine.statistics;
println!;
println!;
println!;
Configuration
Engine Configuration
query_engine:
optimization:
level: "aggressive"
enable_statistics: true
enable_caching: true
cache_size: 1000
execution:
parallel: true
max_threads: 8
streaming: true
batch_size: 1000
federation:
timeout: "30s"
max_concurrent: 5
cache_results: true
functions:
custom_namespaces:
- "http://example.org/functions/"
enable_extensions: true
Runtime Configuration
use ;
let config = builder
.query_timeout
.memory_limit // 1GB
.result_limit
.parallel_threshold
.build;
let engine = with_config;
Error Handling
use ;
match engine.execute.await
Related Crates
oxirs-core: RDF data model and storageoxirs-fuseki: SPARQL HTTP serveroxirs-rule: Rule-based reasoningoxirs-shacl: Shape validation
Development
Running Tests
Benchmarks
Query Plan Visualization
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Status
🚀 Production Release (v0.1.0) - January 7, 2026
Current implementation status:
- ✅ Full SPARQL 1.1/1.2 parsing and execution across persisted datasets
- ✅ Federation (
SERVICE) with retries,SERVICE SILENT, and result merging - ✅ Parallel execution framework instrumented with SciRS2 metrics
- ✅ Custom function framework with dynamic registration
- 🚧 Adaptive cardinality estimation (in progress)
APIs follow semantic versioning. See CHANGELOG.md for details.