13 releases

Uses new Rust 2024

0.2.2 Oct 25, 2025
0.2.0 Sep 13, 2025
0.2.0-beta.1 Jul 20, 2025
0.1.3 Mar 9, 2025

#595 in Algorithms

Download history 829/week @ 2025-08-16 1628/week @ 2025-08-23 3488/week @ 2025-08-30 1423/week @ 2025-09-06 1696/week @ 2025-09-13 3709/week @ 2025-09-20 2616/week @ 2025-09-27 2273/week @ 2025-10-04 2752/week @ 2025-10-11 3618/week @ 2025-10-18 2402/week @ 2025-10-25 1575/week @ 2025-11-01 1428/week @ 2025-11-08 2915/week @ 2025-11-15 1013/week @ 2025-11-22 822/week @ 2025-11-29

6,445 downloads per month
Used in 53 crates (2 directly)

MIT/Apache

1.5MB
32K SLoC

spareval

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

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 evaluator = QueryEvaluator::new();
let results = evaluator.prepare(&query).execute(&dataset);
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());
}

Cargo features

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

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

~4.5–6.5MB
~120K SLoC