pub enum Plan {
Show 13 variants
Bgp(Vec<TriplePattern>),
Join(Box<Plan>, Box<Plan>),
Union(Box<Plan>, Box<Plan>),
LeftJoin(Box<Plan>, Box<Plan>, Option<FExpr>),
Filter(FExpr, Box<Plan>),
Extend(String, FExpr, Box<Plan>),
Path(PatternTerm, PathAst, PatternTerm),
Values(Vec<String>, Vec<Vec<Option<String>>>),
Minus(Box<Plan>, Box<Plan>),
Graph(GraphTarget, Box<Plan>),
DistinctUnion {
vars: Vec<String>,
sources: Vec<TriplePattern>,
},
Subquery(Box<Select>),
Service {
silent: bool,
endpoint: String,
vars: Vec<String>,
query: String,
},
}Expand description
A SPARQL graph-pattern evaluation plan (the supported algebra subset).
Variants§
Bgp(Vec<TriplePattern>)
Basic graph pattern: triple patterns joined on shared variables.
Join(Box<Plan>, Box<Plan>)
Conjunction of two patterns (inner join on shared variables).
Union(Box<Plan>, Box<Plan>)
UNION: all solutions of either side.
LeftJoin(Box<Plan>, Box<Plan>, Option<FExpr>)
OPTIONAL (left join): left solutions, extended by the right where it matches (and passes the optional condition), kept as-is where it doesn’t.
Filter(FExpr, Box<Plan>)
FILTER over an inner pattern.
Extend(String, FExpr, Box<Plan>)
In-pattern BIND(expr AS ?var): each inner solution extended with ?var
(left unbound where expr errors). Distinct from the projection-time
alias list (Select::extends) — this one is inside the graph pattern,
so a following FILTER or join sees the bound variable.
Path(PatternTerm, PathAst, PatternTerm)
A property path subject <path> object.
Values(Vec<String>, Vec<Vec<Option<String>>>)
Inline VALUES: variable names and rows of optional ground-term tokens
(None = UNDEF).
Minus(Box<Plan>, Box<Plan>)
MINUS: left solutions, minus those compatible with a right solution
that shares at least one bound variable.
Graph(GraphTarget, Box<Plan>)
GRAPH <iri>|?g { … } — evaluate the inner pattern against a named graph.
DistinctUnion
The distinct bindings of vars over the union of single triple
patterns (sources) — each solution once, however many sources (or
triples of one source) produce it. Every variable of a source that is
not in vars is anonymous: matched, never bound in the output. With
vars empty it is an existence test (one empty solution or none).
Built only by the OWL 2 QL rewriter (ql): an entailed atom such as
?x a C holds once per entailed triple, while its rewriting
(?x a C₁, ?x a C₂, ?x p ?_ for a p with domain C, …) matches
it once per asserted triple. The sources stream sorted on the key
and are merged, so deduplicating costs one cursor per source, not a
set of every solution.
Subquery(Box<Select>)
A nested SELECT subquery: evaluated independently to its projected
solutions, which then join with the surrounding pattern on shared
variables (only the subquery’s projected variables are visible outside).
Service
SERVICE [SILENT] <endpoint> { … } — SPARQL 1.1 federated query. The
inner pattern is shipped (as query, its re-serialized SPARQL text) to
the remote endpoint through the file’s attached
ServiceClient at evaluation time; the returned
solutions join the surrounding pattern on shared variables like any
other operand. Under silent, a failed call degrades to one empty
solution (per the spec); otherwise it fails the whole query.