HDT

Latest Version Documentation Benchmarks

A Rust library for the Header Dictionary Triples compressed RDF format, including:

However it cannot:

For this functionality and acknowledgement of all the original authors, please look at the reference implementations in C++ and Java by the https://github.com/rdfhdt organisation.

It also cannot:

If you need any of the those features, consider using a SPARQL endpoint instead.

Examples

toml [dependencies] hdt = "0.0.12"

```rust use hdt::Hdt;

let file = std::fs::File::open("example.hdt").expect("error opening file"); let hdt = Hdt::Rc::new(std::io::BufReader::new(file)).expect("error loading HDT"); // query let majors = hdt.tripleswithsp("http://dbpedia.org/resource/Leipzig", "http://dbpedia.org/ontology/major"); println!("{:?}", majors.collect::>()); ```

You can also use the Sophia adapter to load HDT files and reduce memory consumption of an existing application based on Sophia:

```rust use hdt::{Hdt,HdtGraph}; use sophia::term::BoxTerm; use sophia::graph::Graph;

let file = std::fs::File::open("dbpedia.hdt").expect("error opening file"); let hdt = Hdt::>::new(std::io::BufReader::new(file)).expect("error loading HDT"); let graph = HdtGraph::new(hdt); let s = BoxTerm::newiriunchecked("http://dbpedia.org/resource/Leipzig"); let p = BoxTerm::newiriunchecked("http://dbpedia.org/ontology/major"); let majors = graph.tripleswithsp(&s,&p); ```

If you don't want to pull in the Sophia dependency, you can exclude the adapter:

toml [dependencies] hdt = { version = "0.0.12", default-features = false }