This crate provides traits for reading and writing
Statement
s and Graph
s 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.
```rust use rdftkio::nt::reader::NTriplesReader; use rdftkio::GraphReader; use rdftkmemgraph::simple::graphfactory; use std::fs::File; use std::path::PathBuf;
let filepath = PathBuf::from("tests/w3c/nt/literal.nt"); let mut file = File::open(filepath).unwrap(); let reader = NTriplesReader::default(); let graph = reader.read(&mut file, graph_factory()).unwrap(); ```
Version 0.2.1
Version 0.2.0
Version 0.1.9
Version 0.1.8
Version 0.1.7
Version 0.1.6
Version 0.1.5
StatementRef
.Version 0.1.4
PrefixMappings::compress
and PrefixMappings::expand
to take references.Version 0.1.2
IRI
into IRIRef
.Version 0.1.1
Version 0.1.0