Your first SELECT

Triple patterns with variables.

0/2 done

Theory

A SPARQL SELECT query is a triple pattern with variables prefixed by ?:

SELECT ?ninja WHERE {
  ?ninja a :Ninja .
}

The engine matches the pattern against the graph and binds ?ninja to every subject that fits.

Think of ?var as a placeholder for any RDF term. The engine tries every node in the graph in that slot, keeps the bindings where the whole pattern matches, and returns one row per surviving binding. Two ?ninja occurrences in the same query must bind to the same term — that's how joins happen (next lesson). Result column names come from the ?var names you write after SELECT.

Visualization

Query Pattern match Bindings Result

A SPARQL query is a small pipeline: parse → match patterns → collect bindings → return rows.

Reading in progress · 0 of 2 activities done