-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve README.md, resolve #12. Release 0.0.6.
- Loading branch information
1 parent
e86a538
commit 898105f
Showing
2 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "hdt" | ||
version = "0.0.5" | ||
version = "0.0.6" | ||
repository = "https://github.com/konradhoeffner/hdt" | ||
authors = ["Tim Baccaert <[email protected]>", "Konrad Höffner"] | ||
license = "MIT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,60 @@ | ||
# Rust implementation of the HDT compression format | ||
Header Dictionary Triples (HDT) is a compression format for RDF data that can also be queried for Triple Patterns. | ||
# HDT | ||
|
||
## History | ||
This is a fork of the archived <https://github.com/timplication/hdt-rs> by Tim Baccaert [[email protected]](mailto:[email protected]), who kindly licensed it as MIT on request. | ||
Pull requests are welcome. | ||
[![Latest Version](https://img.shields.io/crates/v/hdt.svg)](https://crates.io/crates/hdt) | ||
[![Documentation](https://docs.rs/hdt/badge.svg)](https://docs.rs/hdt/) | ||
|
||
For reference implementations in C++ and Java and acknowledgement of all the original authors, please look at the [https://github.com/rdfhdt](https://github.com/rdfhdt) organisation. | ||
A Rust library for the [Header Dictionary Triples](https://www.rdfhdt.org/) compressed RDF format, including: | ||
|
||
* loading the HDT default format as created by [hdt-cpp](https://github.com/rdfhdt/hdt-cpp) | ||
* efficient querying by triple patterns | ||
* serializing into other formats like RDF Turtle and N-Triples using the [Sophia](https://crates.io/crates/sophia) adapter | ||
|
||
However it cannot: | ||
|
||
* load other RDF formats | ||
* load other HDT variants | ||
|
||
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](https://github.com/rdfhdt) organisation. | ||
|
||
It also cannot: | ||
|
||
* swap data to disk | ||
* modify the RDF graph in memory | ||
* run SPARQL queries | ||
|
||
If you need any of the those features, consider using a SPARQL endpoint instead. | ||
|
||
## Examples | ||
|
||
```toml | ||
[dependencies] | ||
hdt = "0.0.6" | ||
``` | ||
|
||
```rust | ||
use hdt::Hdt; | ||
|
||
pub fn main() { | ||
// Load an hdt file | ||
let file = File::open("dbpedia.hdt").expect("error opening file"); | ||
let hdt = Hdt::new(std::io::BufReader::new(file)).expect("error loading HDT"); | ||
// query | ||
let majors = hdt.triples_with_sp("http://dbpedia.org/resource/Leipzig", "http://dbpedia.org/ontology/major"); | ||
println!("{:?}", majors.collect::<Vec<(String, String, String)>(majors)); | ||
} | ||
``` | ||
|
||
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}; | ||
|
||
pub fn main() { | ||
let file = 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::new_iri_unchecked("http://dbpedia.org/resource/Leipzig"); | ||
let p = BoxTerm::new_iri_unchecked("http://dbpedia.org/ontology/major"); | ||
let majors = graph.triples_with_sp(s,p); | ||
} | ||
``` |