Skip to main content

Module query

Module query 

Source
Expand description

Stable SPARQL, graph-pattern, federation, and result API.

Structs§

CommunityPartial
One community’s contribution to a community-split evaluation: how many member subjects it holds and how many solution rows it produced.
RoutedTriplePattern
A single triple pattern that can be answered by the range-routed permutation reader. None means the position is a variable/wildcard; Some(term) means the query pins that term.
TriplePattern
A triple pattern (subject, predicate, object) of PatternTerms.
TripleProvenance
Why a triple-pattern result is present in the file.

Enums§

PatternTerm
A term in a pattern: a named variable or a constant term token.
QueryOutput
The result of evaluating any SPARQL query form.
SparqlError
SummaryQueryShape
Query shapes that can be answered exactly from crate::range::SummaryView predicate totals, without opening the triple index.

Traits§

ServiceClient
Executes one SPARQL query against a remote endpoint (the SPARQL Protocol) and returns its solutions. Implementations own transport, auth, and timeouts; they typically POST the query with Accept: application/sparql-results+json and feed the body through parse_sparql_json_results. Errors are strings, surfaced verbatim as the query error (or, under SERVICE SILENT, swallowed per the spec) — name the endpoint in the message, the engine adds no prefix.

Functions§

eval_query
Evaluate any supported SPARQL query form (SELECT / ASK / CONSTRUCT).
eval_query_reasoned
Like eval_query, but with OWL 2 QL entailment on: the lowered plan is rewritten by the internal QL lowering pass so the answer includes ontology-entailed solutions (Stage 1a: rdfs:subClassOf), computed over the raw data with no materialization. Opt-in — a plain eval_query is byte-identical to before.
eval_select_communities
Evaluate a SELECT per pyramid community, then merge: each community’s subjects are pushed into the plan as a VALUES binding, the partial rows are concatenated, and the solution modifiers (GROUP BY / ORDER BY / LIMIT / DISTINCT) run once on the union — so the rows are identical to eval_query’s answer. Sound only for subject-star queries over the default graph (every triple pattern sharing one subject variable; FILTERs allowed); anything else returns SparqlError::Unsupported rather than a possibly-wrong split answer. round picks the dendrogram granularity (None = the build’s tile-budget round). Also returns each community’s subject and row counts for display.
eval_sparql
Parse and evaluate a SELECT against a file, applying the plan then projection, DISTINCT, OFFSET, and LIMIT. Returns (projected_vars, solutions).
eval_sparql_reasoned
Like eval_sparql, but with OWL 2 QL entailment on (see eval_query_reasoned).
parse_sparql_json_results
Parse a SPARQL 1.1 Query Results JSON document (application/sparql-results+json) into bindings of variable → N-Triples term token. An ASK document (no results) yields no bindings. Unknown per-binding fields are ignored; xsd:string datatypes are dropped (a simple literal — matching how plain literals are tokenized everywhere else in the engine).
push_json_string
Append v to out as a JSON string literal (RFC 8259 escaping): the mandatory escapes (", \, and C0 controls, the common ones in short form), every other char — including all UTF-8 — passed through. Matches what serde_json emits for a string by default.
query_predicates
Collect the concrete predicate IRIs a query constrains on — i.e. every IRI that appears in the predicate position of a triple pattern, or as a plain predicate inside a property path. Variable predicates (?p) and the special a (rdf:type) keyword are normalized to their IRI tokens (<…>).
results_envelope_json
Serialize out as { "kind": …, … }. extra is a raw JSON fragment of additional object members appended before the closing brace (e.g. ,"remote":{…}); pass "" for none. CONSTRUCT is rendered as a triples array — the text formats (Turtle / JSON-LD) are handled by the caller, which owns those serializers.
routed_triple_pattern
Classify queries whose graph access is exactly one default-graph triple pattern. Solution modifiers (projection, LIMIT, aggregate wrappers) do not change the underlying range access, but named graphs, FROM, joins, filters, paths, and other algebra need the full SPARQL evaluator.
sparql_json_ask
Serialize an ASK result as a SPARQL 1.1 Query Results JSON document.
sparql_json_results
Serialize a SELECT result as a SPARQL 1.1 Query Results JSON document. vars fixes the head order (pass the projection); solutions’ bindings are term tokens exactly as the engine returns them.
summary_query_shape
Classify SPARQL queries that can be answered exactly from the pyramid summary’s per-predicate totals. This is intentionally conservative: anything with constants, repeated variables, filters, joins, paths, named graphs, ORDER BY, OFFSET/LIMIT, or non-summary-safe aggregates still requires the index. The only accepted DISTINCT shape is a predicate list over one fully unbound triple pattern.

Type Aliases§

Binding
A solution: variable name → bound term (the public, resolved form).
CommunitySelect
The outcome of a community-split SELECT: the projected variables, the merged solution rows, and each community’s contribution.