Skip to main content

Crate purrdf_sparql_eval

Crate purrdf_sparql_eval 

Source
Expand description

Native, RDF-1.2-first multiset SPARQL evaluator (purrdf S6).

This crate is the evaluation runtime that consumes the purrdf_sparql_algebra front-end (S5) and evaluates it over the purrdf_core IR’s DatasetView read trait entirely in interned TermId space. It is the native replacement for the oxigraph-family spareval on the query path and the single required impl of the SparqlEngine seam.

§Design pillars

  • TermId hot path. Basic-graph-pattern matching and joins never leave interned-id space: constants resolve to a dataset purrdf_core::TermId once (via term_id_by_value, P4) and solutions carry SolutionTerms that are a single integer compare apart. Computed terms (FILTER/BIND results not already in the dataset) are interned in a per-query scratch table — but a computed value that does exist in the dataset is promoted to SolutionTerm::Existing at mint time, so cross-case join keys are unequal purely by construction (no structural fallback at join time). See scratch.
  • Multiset (bag) semantics. Solutions are a bag, preserved until DISTINCT/REDUCED. See solution.
  • Property paths in-engine (S8). The Path graph pattern is evaluated over the same indexed surface, wasm-safe, covering the full algebra (* + ? / | ^ !() and the PurRDF {n,m} / <any> extensions) — see the path module.
  • Hard-fail, no degraded fallback. A well-formed but out-of-scope algebra node (SERVICE, LATERAL, SPARQL UPDATE) or an unimplemented builtin is a typed EvalError::Unsupported — never a partial or wrong answer (the project no-optionality doctrine).

The crate carries zero oxigraph-family dependencies and builds for wasm32-unknown-unknown (the wasm query path); both invariants are gated by make rdf-core-hygiene.

Re-exports§

pub use engine::NativeSparqlEngine;
pub use engine::PlanCache;
pub use engine::PreparedQuery;
pub use error::EvalError;
pub use eval::EvalCtx;
pub use eval::EvalOptions;
pub use eval::LossVocabulary;
pub use eval::Outcome;
pub use eval::StandpointPredicates;
pub use eval::eval;
pub use eval::evaluate_query;
pub use remote::LocalRemoteQuerySource;
pub use remote::RemoteError;
pub use remote::RemoteQuerySource;
pub use remote::ResolvedBindings;
pub use remote_http::HttpRemoteQuerySource;
pub use remote_http::HttpRequest;
pub use remote_http::HttpTransport;
pub use scratch::ScratchId;
pub use scratch::ScratchInterner;
pub use scratch::SolutionTerm;
pub use solution::Solution;
pub use solution::SolutionSeq;
pub use solution::VarSchema;
pub use solution::compatible;
pub use update::GraphResolver;
pub use user_fn::Arity;
pub use user_fn::NativeFnBody;
pub use user_fn::NativeFunction;
pub use user_fn::NodeKind;
pub use user_fn::TypeConstraint;
pub use user_fn::UserFnBody;
pub use user_fn::UserFnParam;
pub use user_fn::UserFunction;
pub use user_fn::UserFunctionRegistry;
pub use user_fn::Volatility;

Modules§

engine
The native SparqlEngine implementation and its parse-memoizing plan cache.
error
The evaluator’s typed error channel.
eval
The graph-pattern evaluation recursion and its EvalCtx.
remote
SPARQL SERVICE federation: the eval_service handler and the RemoteQuerySource seam.
remote_http
HTTP-shaped transport adapter for SPARQL SERVICE federation.
scratch
Solution-term identity: the SolutionTerm bound-value representation and the per-query ScratchInterner for computed terms.
solution
Solution sequences: the column-oriented multiset of variable bindings.
update
SPARQL 1.1 UPDATE evaluation over a MutableDataset.
user_fn
Dynamic, host-injected user functions — of two kinds under one IRI namespace.

Structs§

CompleteSparqlResult
A fully materialized SPARQL result whose backing view reached a final ready checkpoint.
ParserOptions
Parse-time configuration for the SPARQL front-end.

Enums§

FallibleSparqlError
Failure of a query over a FallibleDatasetView.

Type Aliases§

FallibleSparqlResult
The public return type for a query over an operationally fallible view.