# SPARQL.rs
[](https://unlicense.org)
[](https://blog.rust-lang.org/2025/02/20/Rust-1.85.0/)
[](https://crates.io/crates/sparql)
[](https://docs.rs/sparql)
**SPARQL.rs is a [dataflow] implementation of the [SPARQL] graph query
language for [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
- 100% pure and safe Rust with minimal dependencies and no bloat.
- 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 sparql
```
### Installation in `Cargo.toml`
Enable all default features:
```toml
[dependencies]
sparql = { version = "0.0" }
```
Enable only specific features:
```toml
[dependencies]
sparql = { version = "0.0", default-features = false, features = ["serde"] }
```
## 👉 Examples
### Importing the Library
```rust
use sparql::{algebra, engine, parser, store};
```
### Parsing a SPARQL Query
```rust
let query = sparql::parse("SELECT * WHERE { ?s ?p ?o }").expect("should be valid query");
```
## 📚 Reference
[docs.rs/sparql](https://docs.rs/sparql)
### Core Packages
| [sparql](https://github.com/rust-rdf/sparql.rs/tree/master/lib/sparql#readme) | [](https://crates.io/crates/sparql) | [](https://docs.rs/sparql) |
| [sparql-algebra](https://github.com/rust-rdf/sparql.rs/tree/master/lib/sparql-algebra#readme) | [](https://crates.io/crates/sparql-algebra) | [](https://docs.rs/sparql-algebra) |
| [sparql-derive](https://github.com/rust-rdf/sparql.rs/tree/master/lib/sparql-derive#readme) | [](https://crates.io/crates/sparql-derive) | [](https://docs.rs/sparql-derive) |
| [sparql-engine](https://github.com/rust-rdf/sparql.rs/tree/master/lib/sparql-engine#readme) | [](https://crates.io/crates/sparql-engine) | [](https://docs.rs/sparql-engine) |
| [sparql-parser](https://github.com/rust-rdf/sparql.rs/tree/master/lib/sparql-parser#readme) | [](https://crates.io/crates/sparql-parser) | [](https://docs.rs/sparql-parser) |
| [sparql-store](https://github.com/rust-rdf/sparql.rs/tree/master/lib/sparql-store#readme) | [](https://crates.io/crates/sparql-store) | [](https://docs.rs/sparql-store) |
### Feature Flags
#### Interoperability
| `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/sparql.rs.git
```
---
[](https://x.com/intent/post?url=https://github.com/rust-rdf/sparql.rs&text=SPARQL.rs)
[](https://reddit.com/submit?url=https://github.com/rust-rdf/sparql.rs&title=SPARQL.rs)
[](https://news.ycombinator.com/submitlink?u=https://github.com/rust-rdf/sparql.rs&t=SPARQL.rs)
[](https://www.facebook.com/sharer/sharer.php?u=https://github.com/rust-rdf/sparql.rs)
[](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/rust-rdf/sparql.rs)
[feature flags]: https://github.com/rust-rdf/sparql.rs/blob/master/lib/sparql/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
[SPARQL]: https://www.w3.org/TR/sparql12-query/
[dataflow]: https://github.com/flux-doctrine/awesome-fbp