Expand description

This crate provides a foundation, as a set of traits and core types, for building interoperable implementations of RDF and Linked Data in Rust.

For an all-inclusive crate (providing actual implementations of the traits defined here), see sophia.


RDF is a data model designed to exchange knowledge on the Web in an interoperable way. Each piece of knowledge in RDF (a statement) is represented by a triple, made of three terms. A set of triples forms an RDF graph. Finally, several graphs can be grouped in a collection called a dataset, where each graph is identified by a unique name.

Generalized vs. Strict RDF model

The data model supported by this crate is in fact a superset of the RDF data model as defined by the W3C. When the distinction matters, they will be called, respectively, the generalized RDF model, and the strict RDF model.


An RDF dataset is composed of a default graph, and zero or more named graphs, each associated with a graph name.

An RDF graph, the central notion of the RDF data model, is a collection of triples.

Standard and custom namespaces.

API for parsing RDF syntaxes.

RDF-related languages (e.g. Turtle, SPARQL) often use prefixes to shorten IRIs. This crate provides generic traits and types to handle prefix maps.

A quad expresses a single fact within a context. Quads are like RDF triples augmented with an optional graph name.

API for serializing RDF syntaxes.

Common traits for working with SPARQL.

This module defines the API for RDF terms.

An RDF triple expresses a single fact. Its formed of three terms called subject, predicate and object.


Define convenience module-level functions for a parser implementation supporting BufRead.

Create a streaming mode for lifetime-parameterized Quad types.

Create a [streaming mode] for lifetime-parameterized Triple types.

Create a “namespace module” defining a set of terms within a given IRI space.

Create a term in a “namespace module”. In general, you should use the namespace! macro instead.

Generate a test suite for an implementation of Dataset, CollectibleDataset and MutableDataset.

Generate a test suite for an implementation of Graph, CollectibleGraph and MutableGraph.

Generate a test suite for an implementation of Dataset and CollectibleDataset.

Generate a test suite for an implementation of Graph and CollectibleGraph.