| Crates.io | spareval |
| lib.rs | spareval |
| version | 0.2.0 |
| created_at | 2025-01-11 20:16:32.048057+00 |
| updated_at | 2025-09-13 16:00:48.548872+00 |
| description | SPARQL evaluator |
| homepage | |
| repository | https://github.com/oxigraph/oxigraph/tree/main/lib/spareval |
| max_upload_size | |
| id | 1512645 |
| size | 395,273 |
spareval is a SPARQL Query evaluator.
It relies on the spargebra and sparopt crates.
This crate is intended to be a building piece for SPARQL implementations like oxigraph.
use oxrdf::{Dataset, GraphName, NamedNode, Quad};
use spareval::{QueryEvaluator, QueryResults};
use spargebra::SparqlParser;
let ex = NamedNode::new("http://example.com").unwrap();
let dataset = Dataset::from_iter([Quad::new(
ex.clone(),
ex.clone(),
ex.clone(),
GraphName::DefaultGraph,
)]);
let query = SparqlParser::new().parse_query("SELECT * WHERE { ?s ?p ?o }").unwrap();
let results = QueryEvaluator::new().execute(&dataset, &query);
if let QueryResults::Solutions(solutions) = results.unwrap() {
let solutions = solutions.collect::<Result<Vec<_>, _>>().unwrap();
assert_eq!(solutions.len(), 1);
assert_eq!(solutions[0]["s"], ex.into());
}
sparql-12: enables SPARQL 1.2 changes.sep-0002: enables the SEP-0002 (ADJUST function and a lot of arithmetic on xsd:date, xsd:time, xsd:yearMonthDuration and xsd:dayTimeDuration).sep-0006: enables the SEP-0006 (LATERAL keyword).calendar-ext: arithmetic on xsd:gYear, xsd:gYearMonth, xsd:gMonth, xsd:gMonthDay and xsd:gDay.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.