2

I would like to load RDF HDT (Header, Dictionary, Triples) files in a Rust application but haven't found any library that supports this. Before doing it myself or asking others to add it to their RDF libraries, I wanted to ask if there have been any existing efforts to load HDT with Rust.

Where I have unsuccessfully searched:

Updates

2
  • github.com/timplication/hdt-rs has been removed
    – andrefs
    Commented Apr 24, 2023 at 21:31
  • 1
    @andrefs: Thanks for the notice! The author of hdt-rs and I ended up cooperating on a new version, the original prototype is not available anymore, I added an answer and a notice in the question, I hope this way makes the most sense for future HDT users. Commented Apr 25, 2023 at 10:23

1 Answer 1

2

The hdt crate is a Rust library that allows loading existing HDT files in default format and querying using triple patterns. It has an adapter for the Sophia Rust RDF library, so that existing Sophia-based applications can load HDT files as well.

Explanation: The owner of https://github.com/timplication/hdt-rs (not available anymore) allowed me to build upon his now discontinued prototype. We currently have a paper about it on review in the Journal of Open Source Software (JOSS), read the current draft here.

API documentation is published at https://docs.rs/hdt/latest/hdt/.

Example usage from the docs:

use hdt::Hdt;
// Load an hdt file
let file = std::fs::File::open("example.hdt").expect("error opening file");
let hdt = Hdt::new(std::io::BufReader::new(file)).expect("error loading HDT");
// query
let majors = hdt.triples_with_pattern(Some("http://dbpedia.org/resource/Leipzig"), Some("http://dbpedia.org/ontology/major"),None);
println!("{:?}", majors.collect::<Vec<_>>());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.