pub fn pretty_sparql(compact: &str) -> StringExpand description
Indent compact SPARQL-syntax explain output (optimised-sparql /
planned-sparql) for human reading: one triple pattern or group element
per line, two-space indent per {, ; property lists continue on their
own indented lines, and [...] blank-node property lists nest.
A lexer plus bracket-depth counter, not a parser: IRIs and quoted literals
are consumed as opaque atoms, so braces, dots, and keywords inside them
never affect the layout. ; inside parentheses (aggregate
GROUP_CONCAT(x; SEPARATOR = ...)) stays glued; ; at property-list level
breaks the line and indents the continuation by one step (once per
statement, not per ;). Input is the compact single-line text produced by
[format_l1_sparql] / [fmt_plan_sparql_query] (or the equivalent
spargebra Display output), but hand-written SPARQL using ; / []
abbreviations lexes the same way. The result stays valid SPARQL —
statement dots are optional before } and before element keywords in the
group-graph-pattern grammar, and those are exactly the places where a line
break is inserted without a dot.