Skip to content

Commit af548d2

Browse files
committed
refactor
1 parent 2a250d0 commit af548d2

13 files changed

Lines changed: 1499 additions & 1063 deletions

Cargo.lock

Lines changed: 130 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ version = "0.1.0"
44
edition = "2024"
55

66
[dependencies]
7-
anyhow = "1.0.97"
87
chrono = "0.4.40"
8+
clap = { version = "4.5", features = ["derive","cargo"] }
9+
clap-verbosity-flag = "3.0"
910
crc = "3.2.1"
10-
hdt = { path = "../hdt" }
11-
log = "0.4.27"
12-
oxrdf = "0.2.4"
13-
oxrdfio = "0.1.7"
14-
sucds = "0.8.1"
15-
tempfile = "3.19.1"
16-
zstd = "0.13.3"
11+
hdt = { git = "https://github.com/GregHanson/hdt/", branch = "more-public-vals" }
12+
log = "0.4"
13+
oxrdf = "0.2"
14+
oxrdfio = "0.1"
15+
tempfile = "3.19"

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2024-2025, Decisym, LLC
2+
3+
lint:
4+
cargo install cargo-machete
5+
cargo fmt --check
6+
cargo machete
7+
cargo clippy --benches --tests --bins --no-deps --all-features
8+
9+
build:
10+
cargo build
11+
12+
test:
13+
cargo test
14+
15+
presubmit: lint test

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

Comments
 (0)