# RDF.rs: RDF for Rust
[](https://unlicense.org)
[](https://blog.rust-lang.org/2025/02/20/Rust-1.85.0/)
[](https://crates.io/crates/rdf_rs)
[](https://docs.rs/rdf_rs)
**RDF.rs** is a [Rust] framework for working with [RDF] knowledge graphs.
> [!TIP]
> 🚧 _We are building in public. This is presently under heavy construction._
<sub>
[[Features](#-features)] |
[[Prerequisites](#%EF%B8%8F-prerequisites)] |
[[Installation](#%EF%B8%8F-installation)] |
[[Examples](#-examples)] |
[[Reference](#-reference)] |
[[Development](#%E2%80%8D-development)]
</sub>
## ✨ Features
- Supports JSON-LD, Turtle/TriG, N-Triples/N-Quads, COTTAS, and more.
- Implements stores on top of SQLite, Valkey, MongoDB, IndexedDB, etc.
- Built on async Rust using lazily-evaluated streams throughout.
- Plays nice with others: interoperates with Oxigraph, Rudof, and Sophia.
- 100% pure and safe Rust with minimal dependencies and no bloat.
- Supports `no_std` environments from the get-go.
- Supports opting out of any feature using comprehensive [feature flags].
- Adheres to the Rust API Guidelines in its [naming conventions].
- Cuts red tape: 100% free and unencumbered public domain software.
## 🛠️ Prerequisites
- [Rust] 1.85+ (2024 edition)
## ⬇️ Installation
### Installation via Cargo
```bash
cargo add rdf_rs --rename rdf
```
### Installation in `Cargo.toml`
Enable all default features:
```toml
[dependencies]
rdf = { package = "rdf_rs", version = "0.4" }
```
Enable only specific features:
```toml
[dependencies]
rdf = { package = "rdf_rs", version = "0.4", default-features = false, features = ["serde"] }
```
## 👉 Examples
### Importing the Library
```rust,compile_fail
use rdf::{format, hash, id, model, query, reader, store, stream, vocab, writer};
```
## 📚 Reference
[docs.rs/rdf_rs](https://docs.rs/rdf_rs)
### Core Packages
| [rdf](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf_rs#readme) | [](https://crates.io/crates/rdf_rs) | [](https://docs.rs/rdf_rs) |
| [rdf-derive](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-derive#readme) | [](https://crates.io/crates/rdf-derive) | [](https://docs.rs/rdf-derive) |
| [rdf-format](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-format#readme) | [](https://crates.io/crates/rdf-format) | [](https://docs.rs/rdf-format) |
| [rdf-hash](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-hash#readme) | [](https://crates.io/crates/rdf-hash) | [](https://docs.rs/rdf-hash) |
| [rdf-id](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-id#readme) | [](https://crates.io/crates/rdf-id) | [](https://docs.rs/rdf-id) |
| [rdf-model](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-model#readme) | [](https://crates.io/crates/rdf-model) | [](https://docs.rs/rdf-model) |
| [rdf-query](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-query#readme) | [](https://crates.io/crates/rdf-query) | [](https://docs.rs/rdf-query) |
| [rdf-reader](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader#readme) | [](https://crates.io/crates/rdf-reader) | [](https://docs.rs/rdf-reader) |
| [rdf-store](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store#readme) | [](https://crates.io/crates/rdf-store) | [](https://docs.rs/rdf-store) |
| [rdf-stream](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-stream#readme) | [](https://crates.io/crates/rdf-stream) | [](https://docs.rs/rdf-stream) |
| [rdf-vocab](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-vocab#readme) | [](https://crates.io/crates/rdf-vocab) | [](https://docs.rs/rdf-vocab) |
| [rdf-writer](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer#readme) | [](https://crates.io/crates/rdf-writer) | [](https://docs.rs/rdf-writer) |
| [xsd](https://github.com/rust-rdf/rdf.rs/tree/master/lib/xsd#readme) | [](https://crates.io/crates/xsd) | [](https://docs.rs/xsd) |
### File Readers
| [rdf-reader-cottas](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-cottas#readme) | [](https://crates.io/crates/rdf-reader-cottas) | [](https://docs.rs/rdf-reader-cottas) |
| [rdf-reader-hdt](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-hdt#readme) | [](https://crates.io/crates/rdf-reader-hdt) | [](https://docs.rs/rdf-reader-hdt) |
| [rdf-reader-jsonld](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-jsonld#readme) | [](https://crates.io/crates/rdf-reader-jsonld) | [](https://docs.rs/rdf-reader-jsonld) |
| [rdf-reader-nquads](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-nquads#readme) | [](https://crates.io/crates/rdf-reader-nquads) | [](https://docs.rs/rdf-reader-nquads) |
| [rdf-reader-ntriples](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-ntriples#readme) | [](https://crates.io/crates/rdf-reader-ntriples) | [](https://docs.rs/rdf-reader-ntriples) |
| [rdf-reader-rdfxml](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-rdfxml#readme) | [](https://crates.io/crates/rdf-reader-rdfxml) | [](https://docs.rs/rdf-reader-rdfxml) |
| [rdf-reader-trig](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-trig#readme) | [](https://crates.io/crates/rdf-reader-trig) | [](https://docs.rs/rdf-reader-trig) |
| [rdf-reader-turtle](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-reader-turtle#readme) | [](https://crates.io/crates/rdf-reader-turtle) | [](https://docs.rs/rdf-reader-turtle) |
### File Writers
| [rdf-writer-cottas](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-cottas#readme) | [](https://crates.io/crates/rdf-writer-cottas) | [](https://docs.rs/rdf-writer-cottas) |
| [rdf-writer-hdt](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-hdt#readme) | [](https://crates.io/crates/rdf-writer-hdt) | [](https://docs.rs/rdf-writer-hdt) |
| [rdf-writer-jsonld](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-jsonld#readme) | [](https://crates.io/crates/rdf-writer-jsonld) | [](https://docs.rs/rdf-writer-jsonld) |
| [rdf-writer-nquads](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-nquads#readme) | [](https://crates.io/crates/rdf-writer-nquads) | [](https://docs.rs/rdf-writer-nquads) |
| [rdf-writer-ntriples](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-ntriples#readme) | [](https://crates.io/crates/rdf-writer-ntriples) | [](https://docs.rs/rdf-writer-ntriples) |
| [rdf-writer-rdfxml](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-rdfxml#readme) | [](https://crates.io/crates/rdf-writer-rdfxml) | [](https://docs.rs/rdf-writer-rdfxml) |
| [rdf-writer-trig](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-trig#readme) | [](https://crates.io/crates/rdf-writer-trig) | [](https://docs.rs/rdf-writer-trig) |
| [rdf-writer-turtle](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-writer-turtle#readme) | [](https://crates.io/crates/rdf-writer-turtle) | [](https://docs.rs/rdf-writer-turtle) |
### Storage Adapters
| [rdf-store](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store#readme) | [](https://crates.io/crates/rdf-store) | [](https://docs.rs/rdf-store) |
| [rdf-store-idb](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-idb#readme) | [](https://crates.io/crates/rdf-store-idb) | [](https://docs.rs/rdf-store-idb) |
| [rdf-store-mongo](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-mongo#readme) | [](https://crates.io/crates/rdf-store-mongo) | [](https://docs.rs/rdf-store-mongo) |
| [rdf-store-neo4j](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-neo4j#readme) | [](https://crates.io/crates/rdf-store-neo4j) | [](https://docs.rs/rdf-store-neo4j) |
| [rdf-store-oxigraph](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-oxigraph#readme) | [](https://crates.io/crates/rdf-store-oxigraph) | [](https://docs.rs/rdf-store-oxigraph) |
| [rdf-store-postgres](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-postgres#readme) | [](https://crates.io/crates/rdf-store-postgres) | [](https://docs.rs/rdf-store-postgres) |
| [rdf-store-qlever](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-qlever#readme) | [](https://crates.io/crates/rdf-store-qlever) | [](https://docs.rs/rdf-store-qlever) |
| [rdf-store-sqlite](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-sqlite#readme) | [](https://crates.io/crates/rdf-store-sqlite) | [](https://docs.rs/rdf-store-sqlite) |
| [rdf-store-turso](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-turso#readme) | [](https://crates.io/crates/rdf-store-turso) | [](https://docs.rs/rdf-store-turso) |
| [rdf-store-valkey](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-valkey#readme) | [](https://crates.io/crates/rdf-store-valkey) | [](https://docs.rs/rdf-store-valkey) |
| [rdf-store-virtuoso](https://github.com/rust-rdf/rdf.rs/tree/master/lib/rdf-store-virtuoso#readme) | [](https://crates.io/crates/rdf-store-virtuoso) | [](https://docs.rs/rdf-store-virtuoso) |
### Feature Flags
#### Interoperability
| `borsh` | 1.6 | Derives `borsh::{BorshSerialize, BorshDeserialize}`
| `bson` | 3.1 | Implements `From<T> for bson::Bson`
| `datafusion` | 50.0 | Planned interop with Apache DataFusion and `rdf-fusion`
| `oxrdf` | 0.3 | Implements `From<T> for oxrdf::T`, `From<oxrdf::T> for T`
| `rudof` | 0.1 | Planned interop with `rudof`
| `serde` | 1.0 | Derives `serde::{Serialize, Deserialize}`
| `sophia` | 0.10 | Implements `From<T> for sophia::T`, `From<sophia::T> for T`
## 👨💻 Development
```bash
git clone https://github.com/rust-rdf/rdf.rs.git
```
---
[](https://x.com/intent/post?url=https://github.com/rust-rdf/rdf.rs&text=RDF.rs)
[](https://reddit.com/submit?url=https://github.com/rust-rdf/rdf.rs&title=RDF.rs)
[](https://news.ycombinator.com/submitlink?u=https://github.com/rust-rdf/rdf.rs&t=RDF.rs)
[](https://www.facebook.com/sharer/sharer.php?u=https://github.com/rust-rdf/rdf.rs)
[](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/rust-rdf/rdf.rs)
[feature flags]: https://github.com/rust-rdf/rdf.rs/blob/master/lib/rdf_rs/Cargo.toml
[naming conventions]: https://rust-lang.github.io/api-guidelines/naming.html
[RDF]: https://www.w3.org/TR/rdf12-concepts/
[Rust]: https://rust-lang.org