Expand description
§spareval
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 theSEP-0002(ADJUSTfunction and a lot of arithmetic onxsd:date,xsd:time,xsd:yearMonthDurationandxsd:dayTimeDuration).sep-0006: enables theSEP-0006(LATERALkeyword).calendar-ext: arithmetic onxsd:gYear,xsd:gYearMonth,xsd:gMonth,xsd:gMonthDayandxsd: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.
Structs§
- Cancellation
Token - A token that can be used to mark something as canceled.
- Delete
Insert Iter - Output of
PreparedDeleteInsertUpdate::execute. - Expression
Triple sparql-12 - Internal
Quad - Prepared
Delete Insert Update - A prepared SPARQL query.
- Prepared
Query - A prepared SPARQL query.
- Query
Dataset Specification - An extended SPARQL query dataset specification.
- Query
Evaluator - Evaluates a query against a given RDF dataset
- Query
Explanation - The explanation of a query.
- Query
Solution - Tuple associating variables and terms that are the result of a SPARQL query.
- Query
Solution Iter - An iterator over
QuerySolutions. - Query
Triple Iter - An iterator over the triples that compose a graph solution.
Enums§
- Delete
Insert Quad - A
Quadto delete or insert. - Expression
Term - A term as understood by the expression evaluator
- Query
Evaluation Error - A SPARQL evaluation error
- Query
Results - Results of a SPARQL query.
Traits§
- Aggregate
Function Accumulator - A trait for custom aggregate function implementation.
- Default
Service Handler - Default handler for SPARQL 1.1 Federated Query SERVICEs.
- Queryable
Dataset - A RDF dataset that can be queried using SPARQL
- Service
Handler - Handler for SPARQL 1.1 Federated Query SERVICEs.