| Crates.io | rdftk_io |
| lib.rs | rdftk_io |
| version | 0.3.3 |
| created_at | 2020-07-28 17:40:20.293449+00 |
| updated_at | 2024-10-16 03:33:06.312777+00 |
| description | This crate provides traits for reading and writing Statements and Graphs as well as implementations of these for common representations. |
| homepage | |
| repository | https://github.com/johnstonskj/rust-rdftk.git |
| max_upload_size | |
| id | 270560 |
| size | 867,273 |
This crate provides traits for reading and writing
Statements and Graphs as
well as implementations of these for common representations.
The following are some well-known formats (see Wikipedia for a description of
different serializations), support is indicated in the final column with an R
for read support and W for write support. One additional module, dot allows for
the creation of GraphViz dot files for a visualization of a graph's structure.
| Module | Name | MIME Type | R/W |
|---|---|---|---|
nt |
RDF 1.1 N-Triples; A line-based syntax for an RDF graph | application/n-triples |
R+W |
nq |
RDF 1.1 N-Quads; A line-based syntax for RDF datasets | application/n-quads |
W |
turtle |
RDF 1.1 Turtle; Terse RDF Triple Language | text/turtle |
W |
trig |
RDF 1.1 TriG; RDF Dataset Language | application/trig |
|
xml |
RDF 1.1 XML Syntax | application/rdf+xml |
W |
json |
RDF 1.1 JSON Alternate Serialization | application/rdf+json |
R+W |
n3 |
Notation3 (N3): A readable RDF syntax | text/rdf+n3 |
W |
| TBD | Binary RDF Representation for Publication and Exchange (HDT) | N/A | |
| TBD | RDF Binary using Apache Thrift | application/x-binary-rdf |
|
| TBD | JSON-LD 1.1; A JSON-based Serialization for Linked Data | application/ld+json |
|
| TBD | RDFa Core 1.1 - Third Edition | text/html |
Each module will also provide public constants NAME, FILE_EXTENSION, and
MIME_TYPE.
An example, reading an existing NTriple file.
use rdftk_io::nt::reader::NTriplesReader;
use rdftk_io::GraphReader;
use rdftk_memgraph::simple::graph_factory;
use std::fs::File;
use std::path::PathBuf;
let file_path = PathBuf::from("tests/w3c/nt/literal.nt");
let mut file = File::open(file_path).unwrap();
let reader = NTriplesReader::default();
let graph = reader.read(&mut file, graph_factory()).unwrap();
Literal handling in Turtle;
GraphWriter and DataSetWriter traits so that clients need not
import objio.rdftk_core package.objio crate.README.md.StatementRef.PrefixMappings::compress and PrefixMappings::expand to take
references.IRI into IRIRef.