| Crates.io | json2rdf |
| lib.rs | json2rdf |
| version | 0.1.1 |
| created_at | 2025-02-21 21:49:00.415333+00 |
| updated_at | 2025-05-30 12:43:41.836861+00 |
| description | Library for converting a JSON file to N-Triple RDF |
| homepage | |
| repository | https://github.com/DeciSym/json2rdf |
| max_upload_size | |
| id | 1564755 |
| size | 44,393 |
This Rust-based tool converts JSON data into RDF format, utilizing the oxrdf crate for RDF graph handling and serde_json for efficient JSON parsing. It supports lightweight, memory-efficient processing by reading JSON data values sequentially, which makes it suitable for large datasets.
This library includes a CLI utility for parsing JSON and generating N-Triple RDF using the convert subcommand. The binary can be built using cargo build.
$ json2rdf convert --help
Convert JSON to RDF format.
The `convert` command parses a JSON file, converts it to RDF triples using `serde_json` for parsing and `oxrdf` to construct the graph, and saves the output.
Usage: json2rdf convert [OPTIONS] --json-files <JSON_FILES>
Options:
-n, --namespace <NAMESPACE>
Namespace for RDF graph generation.
A custom namespace to prefix RDF resources created from JSON keys and values.
-j, --json-files <JSON_FILES>
Path to input JSON file(s).
Provide the path to one or more JSON files that will be parsed and converted.
-o, --output-file <OUTPUT_FILE>
Path to output file.
Optional: Specify the path to save the generated RDF data.
-h, --help
Print help (see a summary with '-h')
The conversion functionality can also be called directly in Rust. The library supports writing results to a file or building an in-memory oxrdf::Graph.
use json2rdf::json_to_rdf;
// capture conversion results to file
let results = json_to_rdf(&"tests/airplane.json".to_string(), &Some("http://example.com/ns#".to_string()), &Some("output.nt".to_string()));
// capture conversion results to an oxrdf::Graph
let results = json_to_rdf(&"tests/airplane.json".to_string(), &Some("http://example.com/ns#".to_string()), &None);
This project is licensed under either of
at your option.