Skip to main content

MAX_SPARQL_NESTING

Constant MAX_SPARQL_NESTING 

Source
pub const MAX_SPARQL_NESTING: usize = 64;
Expand description

The deepest a SPARQL query or update may nest (, {, [ and << — with a run of ! counting one level for each — 64.

The deepest legitimate query in the ecosystem’s tests and stored queries nests about 5 (a scan of ~700 of them, 2026-10-09). On a 2 MiB thread oxigraph 0.5.11’s parser overflows at ~180 levels of (/{ in a debug build and ~850 in release, and at 34 (debug) or 426 (release) levels of function calls, the costliest bracket per level. 64 is an order of magnitude above real use, and the parse runs on on_sparql_stack, where a debug build at this bound needs ~4 MiB of the STACK_BASE it gets.