#turtle #n-triples #n-quads #n3 #tri-g

oxttl

Parser and serializer for languages related to RDF Turtle (N-Triples, N-Quads, Turtle, TriG and N3)

26 releases

Uses new Rust 2024

0.2.3 Feb 14, 2026
0.2.1 Oct 11, 2025
0.2.0-beta.1 Jul 20, 2025
0.1.7 Mar 9, 2025
0.1.0-alpha.5 Mar 25, 2024

#351 in Encoding

Download history 2528/week @ 2026-01-23 3140/week @ 2026-01-30 3132/week @ 2026-02-06 2109/week @ 2026-02-13 4512/week @ 2026-02-20 5708/week @ 2026-02-27 3909/week @ 2026-03-06 3626/week @ 2026-03-13 4231/week @ 2026-03-20 5191/week @ 2026-03-27 5025/week @ 2026-04-03 5729/week @ 2026-04-10 6000/week @ 2026-04-17 7531/week @ 2026-04-24 8425/week @ 2026-05-01 6409/week @ 2026-05-08

29,146 downloads per month
Used in 182 crates (24 directly)

MIT/Apache

620KB
12K SLoC

OxTTL

Latest Version Released API docs Crates.io downloads actions status Gitter

Oxttl is a set of parsers and serializers for Turtle, TriG, N-Triples, N-Quads and N3.

Support for RDF 1.2 is available behind the rdf-12 feature for all languages but N3.

It is designed as a low level parser compatible with both synchronous and asynchronous I/O.

Usage example counting the number of people in a Turtle file:

use oxrdf::{NamedNodeRef, vocab::rdf};
use oxttl::TurtleParser;

let file = b"@base <http://example.com/> .
@prefix schema: <http://schema.org/> .
<foo> a schema:Person ;
    schema:name \"Foo\" .
<bar> a schema:Person ;
    schema:name \"Bar\" .";

let schema_person = NamedNodeRef::new("http://schema.org/Person").unwrap();
let mut count = 0;
for triple in TurtleParser::new().for_reader(file.as_ref()) {
    let triple = triple.unwrap();
    if triple.predicate == rdf::TYPE && triple.object == schema_person.into() {
        count += 1;
    }
}
assert_eq!(2, count);

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
  • MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Oxigraph by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.6–1.7MB
~31K SLoC