Jump to content

SPARQL/Variables

From Wikibooks, open books for an open world

A query variable is marked by the use of either "?" or "$"; the "?" or "$" is not part of the variable name. In a query, $abc and ?abc identify the same variable.

In this book only variables marked with "?" are used.

Allowable characters are [a-z], [A-Z], [0-9], _, · and also diacrictics like áéíóú etcetera.

Example

SELECT $child_of_Bach $child_of_BachLabel
WHERE
{
  $child_of_Bach wdt:P22 wd:Q1339.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Try it!