|
| 1 | +# rdf2hdt |
| 2 | +Library for converting RDF data to HDT |
| 3 | + |
| 4 | +This is a Rust-based tool that converts RDF data into HDT format. It uses the `oxrdfio` crate for RDF parsing and conversion, |
| 5 | +and then generates and saves the data as HDT. Implementation is based on the [HDT specification](https://www.w3.org/submissions/2011/SUBM-HDT-20110330) |
| 6 | +and the output HDT is intended to be consumed by one of [hdt crate](https://github.com/KonradHoeffner/hdt), [hdt-cpp](https://github.com/rdfhdt/hdt-cpp), |
| 7 | +or [hdt-java](https://github.com/rdfhdt/hdt-java). |
| 8 | + |
| 9 | +## Using the rdf2hdt CLI |
| 10 | + |
| 11 | +This library includes a CLI utility for gnerating HDT files from RDF input data. The binary can be built using `cargo build`. |
| 12 | + |
| 13 | +```bash |
| 14 | +$ rdf2hdt convert --help |
| 15 | +Convert RDF to HDT. |
| 16 | + |
| 17 | +The `convert` command parses RDF files, converts it to RDF triples using `oxrdfio` for parsing and conversion, and then generates and saves the data as HDT. |
| 18 | + |
| 19 | +Usage: rdf2hdt convert [OPTIONS] --output <OUTPUT> |
| 20 | + |
| 21 | +Options: |
| 22 | + -i, --input <INPUT>... |
| 23 | + Path to input RDF file(s). |
| 24 | + |
| 25 | + Provide the path to one or more RDF files that will be parsed and converted. Support file formats: https://crates.io/crates/oxrdfio |
| 26 | + |
| 27 | + -o, --output <OUTPUT> |
| 28 | + Path to output file. |
| 29 | + |
| 30 | + Specify the path to save the generated HDT. |
| 31 | + |
| 32 | + -v, --verbose... |
| 33 | + Increase logging verbosity |
| 34 | + |
| 35 | + -b, --block-size <BLOCK_SIZE> |
| 36 | + Block size used during term compression |
| 37 | + |
| 38 | + Every Nth term will be stored fully while others will only contain everything besides the longest common prefix of the last Nth term |
| 39 | + |
| 40 | + [default: 16] |
| 41 | + |
| 42 | + -q, --quiet... |
| 43 | + Decrease logging verbosity |
| 44 | + |
| 45 | + -h, --help |
| 46 | + Print help (see a summary with '-h') |
| 47 | +``` |
| 48 | +
|
| 49 | +## Using the build_hdt library |
| 50 | +
|
| 51 | +HDT files can be generated directly in Rust. |
| 52 | +
|
| 53 | +```rust |
| 54 | +use rdf2hdt::hdt::{buld_hdt, Options}; |
| 55 | + |
| 56 | +let result = build_hdt( |
| 57 | + vec!["tests/resources/apple.ttl".to_string()], |
| 58 | + "output.hdt", |
| 59 | + Options::default(), |
| 60 | +)?; |
| 61 | +``` |
| 62 | +
|
| 63 | +## License |
| 64 | +
|
| 65 | +TBD |
0 commit comments