13 releases

0.1.3 Nov 7, 2024
0.1.2 Oct 31, 2024
0.1.0 Sep 22, 2024
0.1.0-rc.1 Aug 25, 2024
0.1.0-alpha.2 Jan 25, 2024

#1970 in Parser implementations

Download history 170/week @ 2024-07-31 1215/week @ 2024-08-07 217/week @ 2024-08-14 580/week @ 2024-08-21 309/week @ 2024-08-28 235/week @ 2024-09-04 364/week @ 2024-09-11 413/week @ 2024-09-18 449/week @ 2024-09-25 482/week @ 2024-10-02 521/week @ 2024-10-09 532/week @ 2024-10-16 619/week @ 2024-10-23 567/week @ 2024-10-30 307/week @ 2024-11-06 433/week @ 2024-11-13

2,177 downloads per month
Used in 24 crates (6 directly)

MIT/Apache

730KB
13K SLoC

OxRDF I/O

Latest Version Released API docs Crates.io downloads actions status Gitter

OxRDF I/O is a set of parsers and serializers for RDF.

It supports:

Support for SPARQL-star is also available behind the rdf-starfeature for Turtle-star, TriG-star, N-Triples-star and N-Quads-star.

It is designed as a low level parser compatible with both synchronous and asynchronous I/O (behind the async-tokio feature).

The entry points of this library are the two RdfParser and RdfSerializer structs.

Usage example converting a Turtle file to a N-Triples file:

use oxrdfio::{RdfFormat, RdfParser, RdfSerializer};

let turtle_file = b"@base <http://example.com/> .
@prefix schema: <http://schema.org/> .
<foo> a schema:Person ;
    schema:name \"Foo\" .
<bar> a schema:Person ;
    schema:name \"Bar\" .";

let ntriples_file = b"<http://example.com/foo> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
<http://example.com/foo> <http://schema.org/name> \"Foo\" .
<http://example.com/bar> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
<http://example.com/bar> <http://schema.org/name> \"Bar\" .
";

let mut serializer = RdfSerializer::from_format(RdfFormat::NTriples).for_writer(Vec::new());
for quad in RdfParser::from_format(RdfFormat::Turtle).for_reader(turtle_file.as_ref()) {
    serializer.serialize_quad(&quad.unwrap()).unwrap();
}
assert_eq!(serializer.finish().unwrap(), ntriples_file);

Parsers for other RDF formats exists in Rust like graph-rdfa-processor for RDFa and json-ld for JSON-LD.

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
  • MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Oxigraph by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.8–8.5MB
~64K SLoC