OxiRS GraphQL
High-performance GraphQL server for RDF data with automatic schema generation
Status: Production Release (v0.1.0) - Released January 7, 2026
✨ Production Release: Production-ready with API stability guarantees. Semantic versioning enforced.
Overview
oxirs-gql provides a GraphQL interface to RDF datasets, automatically generating GraphQL schemas from RDF vocabularies and enabling intuitive querying of semantic data. Built on top of Juniper, it offers seamless integration between GraphQL and SPARQL worlds.
Features
- Automatic Schema Generation: Generate GraphQL schemas from RDF vocabularies
- SPARQL Translation: Automatic translation of GraphQL queries to SPARQL
- Type Safety: Leverage Rust's type system for compile-time schema validation
- High Performance: Async execution with query optimization and caching
- Subscriptions: Real-time GraphQL subscriptions with WebSocket support
- Federation: GraphQL schema stitching across multiple RDF datasets
- Introspection: Full GraphQL introspection support for tooling
- Custom Scalars: RDF-specific scalar types (IRI, DateTime, Literal)
- Flexible Mapping: Custom mapping rules for complex RDF to GraphQL conversions
- Hot Reload: Dynamic schema updates when vocabularies change
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Basic GraphQL Server
use ;
use Dataset;
async
Custom Schema Generation
use ;
use ;
let dataset = from_file?;
let schema = new
.dataset
// Map RDF classes to GraphQL types
.map_class
// Custom resolvers
.resolver
.build?;
Schema Generation
Automatic Generation
use Schema;
use Dataset;
// Load FOAF vocabulary
let dataset = from_file?;
// Generate schema automatically
let schema = from_dataset?;
// Generated GraphQL schema:
// type Person {
// name: String
// mbox: String
// knows: [Person!]!
// age: Int
// }
//
// type Query {
// person(id: ID!): Person
// persons: [Person!]!
// }
Custom Type Mappings
use ;
let schema = new
.map_class
.build?;
Querying
Basic Queries
query GetPerson {
person(id: "http://example.org/alice") {
name
email
friends {
name
email
}
}
}
Advanced Queries
query SearchPeople($name: String!, $limit: Int = 10) {
people(filter: {name: {contains: $name}}, limit: $limit) {
nodes {
id
name
email
friendCount
}
pageInfo {
hasNextPage
endCursor
}
}
}
Subscriptions
subscription NewPerson {
personAdded {
id
name
email
}
}
SPARQL Integration
Query Translation
GraphQL queries are automatically translated to optimized SPARQL:
# GraphQL
query {
person(id: "http://example.org/alice") {
name
friends {
name
}
}
}
# Generated SPARQL
SELECT ?name ?friend_name WHERE {
<http://example.org/alice> foaf:name ?name .
OPTIONAL {
<http://example.org/alice> foaf:knows ?friend .
?friend foaf:name ?friend_name .
}
}
Custom SPARQL
use ;
Advanced Features
Federation
use ;
let federated = new
.schema
.schema
.extend_type
.build?;
Custom Scalars
use ;
use NamedNode;
;
DataLoader Integration
use ;
use ;
// Usage in resolver
async
Configuration
Server Configuration
server:
host: "0.0.0.0"
port: 4000
cors: true
playground: true
introspection: true
schema:
auto_generate: true
vocabularies:
- "http://xmlns.com/foaf/0.1/"
- "http://schema.org/"
mapping:
naming_convention: "camelCase"
max_depth: 10
enable_filters: true
enable_pagination: true
performance:
query_cache: true
cache_size: 1000
max_query_depth: 15
max_query_complexity: 1000
subscriptions:
enabled: true
transport: "websocket"
keep_alive: 30
Schema Configuration
use ;
let config = builder
.auto_generate_schema
.naming_convention
.max_query_depth
.enable_introspection
.cache
.build;
Performance
Benchmarks
| Operation | QPS | Latency (p95) | Memory |
|---|---|---|---|
| Simple query | 12,000 | 15ms | 32MB |
| Complex nested | 3,500 | 45ms | 45MB |
| Subscription | 8,000 | 8ms | 28MB |
| Schema introspection | 15,000 | 5ms | 25MB |
Optimization
use ;
let optimizer = new
.enable_query_planning
.enable_result_caching
.caching_strategy
.sparql_optimization;
let schema = new
.optimizer
.build?;
Deployment
Docker
FROM rust:1.84 as builder
WORKDIR /app
COPY . .
RUN cargo build --release --bin oxirs-gql
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/oxirs-gql /usr/local/bin/
EXPOSE 4000
CMD ["oxirs-gql", "--config", "/config.yaml"]
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: oxirs-gql
spec:
replicas: 3
selector:
matchLabels:
app: oxirs-gql
template:
spec:
containers:
- name: oxirs-gql
image: ghcr.io/cool-japan/oxirs-gql:latest
ports:
- containerPort: 4000
env:
- name: GRAPHQL_PLAYGROUND
value: "false"
- name: GRAPHQL_INTROSPECTION
value: "false"
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
Related Crates
oxirs-core: RDF data modeloxirs-fuseki: SPARQL HTTP serveroxirs-arq: SPARQL query engineoxirs-stream: Real-time subscriptions
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 features:
- ✅ GraphQL server with persisted dataset introspection and hot-reload
- ✅ GraphQL ⇄ SPARQL translation covering vector/federation-aware resolvers
- ✅ Schema generation with CLI configuration parity and dataset auto-sync
- ✅ Subscriptions bridged to SPARQL/stream events (experimental)
- 🚧 Apollo Federation interoperability (in progress)
APIs follow semantic versioning. See CHANGELOG.md for details.