Skip to main content

eval_query_with_warnings

Function eval_query_with_warnings 

Source
pub fn eval_query_with_warnings(
    rete: &Rete,
    query: &str,
    opts: QueryOpts,
) -> Result<(QueryOutput, Vec<QueryWarning>), SparqlError>
Expand description

eval_query_with, plus the diagnostics the evaluation produced.

SPARQL turns an expression type error into false inside FILTER (and into an unbound value in BIND / projection / ORDER BY): CONTAINS(?iri, "x") or STRSTARTS(?year, "15") on an xsd:integer silently drop every row. The result here is exactly what eval_query_with returns — nothing is coerced — but each class of such error comes back as a QueryWarning: the function, the argument position, what the argument was (IRI, number, language-incompatible literal, unbound, invalid regex, …), a count, one sample value and a hint (wrap it in STR()). When the result is empty and no error explains it, a case-sensitivity WarningSeverity::Hint may be added for a constant CONTAINS / STRSTARTS / STRENDS / REGEX (no i flag) needle.

Errors are recorded only where they happen, so a query that raises none pays nothing beyond a per-query reset; work per error is bounded (a count and one sample per (function, position, kind)).