Fork of https://github.com/oxigraph/oxigraph.git for the purpose of NextGraph project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
oxigraph/lib/oxrdfio
Tpt efd5eec65d Introduces load_from_read instead of load_graph and load_dataset 10 months ago
..
src Introduces load_from_read instead of load_graph and load_dataset 10 months ago
Cargo.toml Move back MSRV to 1.67 but keep Cargo.lock to 1.70 1 year ago
README.md Exposes SPARQL results I/O in Oxigraph and improve EvaluationError 1 year ago

README.md

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).

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 writer = RdfSerializer::from_format(RdfFormat::NTriples).serialize_to_write(Vec::new());
for quad in RdfParser::from_format(RdfFormat::Turtle).parse_read(turtle_file.as_ref()) {
    writer.write_quad(&quad.unwrap()).unwrap();
}
assert_eq!(writer.finish().unwrap(), ntriples_file);

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.