Tortank
Tortank is a Turtle / N-Triples parser and in-memory RDF store written in Rust.
I wrote it for Swarm, where I needed to parse and compare a lot of triples (e.g. to calculate the difference between two jobs).
Features
- Covers (roughly) the Turtle spec: prefixes, collections, blank nodes, etc.
- Blank nodes are skolemized
- Set operations (difference, intersection), pattern matching and turtle serialization
- Only the default graph is supported (no named graphs)
Usage
In Rust:
cargo add tortank
use tortank::turtle::turtle_doc::TurtleDoc;
let doc = TurtleDoc::try_from((input, None, None))?;
println!("{}", doc.as_turtle()?);
It can also be used from JavaScript / TypeScript through WebAssembly: @nbittich/tortank-wasm for Node, @nbittich/web-tortank for the browser.
More examples in the README.
Like the other components of Swarm, it’s experimental, so I wouldn’t use it in production.