Jump to content

Training modules/dashboard/slides/12908-query-structure

From Meta, a Wikimedia project coordination wiki

The structure of the query

[edit]
How SPARQL works.


Let's take a look at the query line by line to understand what it's about.

#Cats

Anything starting with # is a comment in SPARQL that the query service will ignore.

SELECT ?item ?itemLabel

A query "selects" something based on certain rules specified in the query. In this case, it's a variable we've chosen to name ?item. The ? indicates that this is a variable. The name is just something you pick for convenience. In this case, since we're looking for items, calling the variable ?item makes sense, and makes it easier for other people to interpret your query (or for you to interpret it when you come back later and have forgotten why you did what you did).

?itemLabel is a special kind of variable. It applies a modifier, or a Label, to the variable.