Sparesults is a set of parsers and serializers for SPARQL query results formats.
It supports SPARQL Query Results XML Format (Second Edition), SPARQL 1.1 Query Results JSON Format and SPARQL 1.1 Query Results CSV and TSV Formats.
Support for SPARQL-star is also available behind the rdf-star
feature.
This crate is intended to be a building piece for SPARQL client and server implementations in Rust like Oxigraph.
Usage example converting a JSON result file into a TSV result file:
```rust use sparesults::{QueryResultsFormat, QueryResultsParser, QueryResultsReader, QueryResultsSerializer}; use std::io::Result;
fn convertjsontotsv(jsonfile: &[u8]) -> Result
// Let's test with a boolean asserteq!( convertjsontotsv(b"{\"boolean\":true}".as_slice()).unwrap(), b"true" );
// And with a set of solutions asserteq!( convertjsontotsv(b"{\"head\":{\"vars\":[\"foo\",\"bar\"]},\"results\":{\"bindings\":[{\"foo\":{\"type\":\"literal\",\"value\":\"test\"}}]}}".as_slice()).unwrap(), b"?foo\t?bar\n\"test\"\t\n" ); ```
This project is licensed under either of
<http://www.apache.org/licenses/LICENSE-2.0>
)<http://opensource.org/licenses/MIT>
)at your option.
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.