Theory
CONSTRUCT projects results into a new triple template:
CONSTRUCT { ?n :learnsFrom ?m }
WHERE { ?m :teaches ?n }
It's a cheap way to materialize inferred triples.
Useful graph-rewriting patterns you'll see in real systems: materialising OWL inferences without a full reasoner; reshaping one vocabulary into another (e.g. schema:author → dcterms:creator); building a small per-request view of a huge graph; and exporting a subset for downstream consumers. Same query language for read, validate and transform.
CONSTRUCT vs CONSTRUCT-WHERE vs UPDATE
CONSTRUCT { template } WHERE { pattern }— the general form; the template can differ from what you matched.CONSTRUCT WHERE { pattern }— shorthand when the output triples are exactly the matched ones (a graph extract).INSERT { ... } WHERE { ... }(SPARQL UPDATE) — when you want to persist the new triples into the store rather than return them.CONSTRUCTis read-only and side-effect-free; prefer it for views and pipelines, and reserveINSERTfor deliberate, audited materialisation.
