Getting Started
Welcome to Kolibrie. This guide walks you through installation and your first query.
Prerequisites
- Rust 1.60+ — required for native builds and Rust API usage
- Python 3.10+ — required only for Python bindings
- Docker + Docker Compose — required only for container-based deployment
Installation
Option 1: Native Rust Build
Clone the repository and build the release binary:
git clone https://github.com/StreamIntelligenceLab/Kolibrie.git
cd Kolibrie
cargo build --release
Add Kolibrie to your own Rust project by referencing the local path in your Cargo.toml:
[dependencies]
kolibrie = { path = "../Kolibrie/kolibrie" }
Option 2: Python Bindings
Kolibrie ships Python bindings built with maturin.
cd Kolibrie/python
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install maturin
maturin develop
The py_kolibrie package is then available in that virtual environment.
Option 3: HTTP Server and Web Playground
Start the built-in HTTP server to get an interactive query playground and REST API:
cargo run --bin kolibrie-http-server
Open your browser at http://localhost:8080 to use the web playground, or send queries via the REST API (see API Reference).
Option 4: Docker (Recommended for Production)
CPU build (most users):
docker compose up --build
# or equivalently:
docker compose --profile cpu up --build
GPU build (requires NVIDIA GPU and NVIDIA Container Toolkit):
docker compose --profile gpu up --build
Development shell (with a mounted working directory):
docker compose --profile dev up --build
Once running, the server is available at http://localhost:8080.
Without Docker Compose:
docker build --build-arg GPU_VENDOR=none --build-arg ENABLE_WEB_UI=true \
-t kolibrie:cpu .
docker run -d --name kolibrie -p 8080:8080 -v $(pwd)/data:/app/data kolibrie:cpu
Your First SPARQL Query
Rust
use kolibrie::SparqlDatabase;
use kolibrie::execute_query::execute_query;
fn main() {
let mut db = SparqlDatabase::new();
db.parse_turtle(r#"
@prefix ex: <http://example.org/> .
ex:Alice ex:knows ex:Bob .
ex:Bob ex:knows ex:Carol .
"#);
let query = r#"
PREFIX ex: <http://example.org/>
SELECT ?person ?friend
WHERE { ?person ex:knows ?friend }
"#;
for row in execute_query(query, &mut db) {
println!("{} knows {}", row[0], row[1]);
}
}
Expected output:
http://example.org/Alice knows http://example.org/Bob
http://example.org/Bob knows http://example.org/Carol
Python
from py_kolibrie import PySparqlDatabase
db = PySparqlDatabase()
db.parse_turtle("""
@prefix ex: <http://example.org/> .
ex:Alice ex:knows ex:Bob .
ex:Bob ex:knows ex:Carol .
""")
results = db.execute_sparql("""
PREFIX ex: <http://example.org/>
SELECT ?person ?friend
WHERE { ?person ex:knows ?friend }
""")
for row in results:
print(row)
Supported RDF Formats
| Format | Rust Method | Description |
|---|---|---|
| RDF/XML | db.parse_rdf(str) | Standard W3C XML serialization |
| RDF/XML (file) | db.parse_rdf_from_file(path) | Multi-threaded file-based parse |
| Turtle | db.parse_turtle(str) | Compact, human-friendly format |
| N3 | db.parse_n3(str) | Notation3 with rule support |
| N-Triples | db.parse_ntriples_and_add(str) | Line-based, streaming-friendly |
All formats also support RDF-star (quoted triples) for annotating statements.
Next Steps
- Core Concepts — understand RDF triples and SPARQL fundamentals
- SPARQL Tutorial — full guide to writing queries
- Stream Processing — process live data with sliding windows
- Knowledge Graph & Reasoning — rules, inference, and logic
- API Reference — complete method reference for Rust and Python