Training modules/dashboard/slides/12909-query-structure-cont

Structure (continued) edit

 
A little more about the parts of SPARQL.


WHERE

The WHERE statement tells the query which kinds of values it wants to attach to the variables. The curly brackets { and } enclose the instructions - or clause - applied to the variables of the WHERE statement.

?item wdt:P31 wd:Q146 .

This is the core element of our query. We're telling the query service which pieces of information we're looking for. P31 is the "instance of" property, while Q146 is the value associated with it. In this case, the value is house cat. This is where we're telling the service "to give us the Wikidata items where "instance of" equals "house cat".

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

This next line tells the query to use a service that will assign the property "label" (recall that it's the human-readable value associated with an item).