Kick off your book project in 3 hours! Live workshop on Zoom. You’ll leave with a real book project, progress on your first chapter, and a clear plan to keep going. Saturday, May 2, 2026. Learn more…

Leanpub Header

Skip to main content

Rusty Graphs - AI Ready Graphs for Rust Developers

Language models guess. Knowledge graphs know. **Rusty Graph** shows you how to build a local AI agent whose memory is a real knowledge graph — typed, validated, reasoned over, and queryable with SPARQL — all inside a single static Rust binary. No JVM. No Docker sidecar. No Python runtime bolted to the side. You will build **Ares**, a research-assistant agent that observes papers, forms beliefs, makes promises to other agents, and tracks the provenance of every fact it holds. Chapter by chapter, Ares grows from an empty Cargo workspace into a full pipeline: > load → reason → validate → query → answer All of it in under a thousand lines of idiomatic Rust, using three crates that actually work today: `oxigraph`, `reasonable`, and `rudof_lib`. `grapfeo` You will learn how to

- Model a domain as RDF triples and load them into an embedded store. - Write RDFS and OWL 2 RL axioms that infer trust, identity, and inverse relationships — automatically. - Guard your graph with SHACL shapes that reject bad data at the boundary, not in production. - Query everything with SPARQL, from simple lookups to federated queries across named graphs. - Wire the graph into a hybrid RAG pipeline so your LLM answers are grounded in facts, not vibes. Who it is for

Rust developers building agents, assistants, or any system where the answer "the model said so" is not good enough. You should be comfortable with Cargo and traits. You do **not** need any prior semantic-web background — every concept is introduced through Ares before any formal definition appears. Why Rust, why now

Local agents are the next deployment target: a user's laptop, a Raspberry Pi, a WASM sandbox. Python cannot go there comfortably. Rust can. This book is the missing manual for the Rust side of the semantic web — the one that tells you exactly which crates work, where the ecosystem is thin, and how to ship anyway. Stop hoping your model tells the truth. Give it a graph that does.

Interested in this book? Show your support by saying what you'd like to pay for it!

$
PDF
EPUB
WEB
About

About

About the Book

Most agentic AI stacks live in Python. That is fine for a notebook and
painful for anything you want to ship next to a user. Local agents need
three things Python makes hard and Rust makes easy: a single static
binary, predictable memory, and an embedded database that rides inside
the process — no JVM, no Docker sidecar, no server to babysit.


Graphs are the other half of the story. A language model hallucinates
plausibly; a knowledge graph tells you what is *true* about your world —
the tickets, the documents, the promises between agents, the provenance
of every belief. Vector search tells you what is similar. A graph tells
you what is real.


This book teaches you to build that graph in Rust, end to end. You will
work through four pillars of the semantic web toolbox in the order a
working agent actually needs them:


- RDF — the data model: a graph of facts made of triples.
- RDFS and OWL — the schema and the reasoner.
- SHACL — the constraints that guard the boundary of your system.
- SPARQL — the query language that ties it all together.

- LPG. - property graphs


Everything happens inside a single Cargo workspace, driven by one
running example: **Ares**, a research-assistant agent whose memory
graph observes papers, forms beliefs, makes promises to other agents,
and tracks the provenance of every claim. By the final chapter you
will have a working binary that loads its own schema, runs an OWL 2 RL
reasoner over its own data, validates the result against SHACL shapes,
and emits a JSON report — all in under a thousand lines of Rust.


## What makes this book different


- **Rust-native, not a Java port.** Every example uses `oxigraph`,
`reasonable`, and `rudof_lib` — three maintained crates that cover
enough of the W3C stack to build a real agent memory. Where the
Rust ecosystem is thin, the book says so plainly and shows the
workaround. No hand-waving.
- **One example, cumulative.** Ares grows chapter by chapter. You
learn each new concept by adding one axiom to a schema you already
understand, not by re-reading a fresh `foo`/`bar` example every time.
- **Agent-first framing.** Every concept is introduced through the
problem it solves for a local agent: identity, trust, provenance,
validation, hybrid retrieval.
- **Hybrid RAG, done right.** The final chapter wires the graph into
a hybrid retrieval pipeline that combines vector search with
SPARQL-grounded answers — the architecture you actually want in
production.


## Who this book is for


You write Rust. You have shipped at least one non-trivial Cargo
project. You have heard of RDF and SPARQL but never used them in
anger — or you have used them in Java or Python and want the same
power without the JVM. You are building something with the word
"agent" in its design document.


You do **not** need a background in description logic, linked data,
or the semantic web. Every term is defined in plain English the first
time it appears, and every concept is motivated by Ares before any
formal definition shows up.


## What you will build


- A Cargo workspace with three library crates (`graph`, `reasoner`,
`validator`) and a binary (`ares`) that drives them.
- A Turtle schema for agents, observations, beliefs, promises, and
provenance.
- An OWL 2 RL ontology that infers trust transitivity, inverse
observations, and identity across DOI and arXiv URLs.
- A SHACL shape file that rejects malformed observations before they
reach the store.
- A full pipeline — load, reason, validate, report — with a `--strict`
flag for CI.
- A hybrid RAG layer that grounds LLM output against the graph.


## About the author


Volodymyr Pavlyshyn works at the intersection of knowledge graphs,
identity, and AI agents. He has spent years building systems where
trust, provenance, and structured memory matter more than raw model
size — and this book distills that experience into a Rust stack you
can ship.

Author

About the Author

Volodymyr Pavlyshyn

Hey I am Volodymyr 

Seasoned Developer's Journey from COBOL to Web 3.0, SSI, Privacy First Edge AI, and Beyond

 As a seasoned developer with over 20 years of experience, I have worked with various programming languages, including some that are considered "dead," such as COBOL and Smalltalk. However, my passion for innovation and embracing cutting-edge technology has led me to focus on the emerging fields of Web 5.0, Self-Sovereign Identity (SSI),AI Agents, Knowledge Graphs, Agentiic memory systems, and the architecture of a decentralized world that empowers data democratization.

A firm believer in the potential of agent systems and the concept of a "soft" internet, I am dedicated to exploring and promoting these transformative ideas. In addition to writing, I also enjoy sharing my knowledge and insights through videoblogging. Most of my Medium posts serve as supplementary content to the videos on my YouTube channel, which you can explore here: https://www.youtube.com/c/VolodymyrPavlyshyn. 

Join me on this exciting journey as we delve into the future of technology and the possibilities it holds.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub