Wikibase/Indexing/SPARQL Query Examples

Syntax according to RDF Dump format. See also https://phabricator.wikimedia.org/T86786

Further examples can be found at d:Wikidata:SPARQL query service/queries

This page is parsed by the web interface of the query service to fill its drop down of example queries.

Standard Prefixes
These should be used every time before the query:

PREFIX wd:  PREFIX wdt:  PREFIX wikibase:  PREFIX p:  PREFIX v:  PREFIX q:  PREFIX rdfs: 

US presidents and spouses

 * Items used:
 * Properties used: ,

US presidents & causes of death

 * Items used:
 * Properties used: ,

Politicians who died of cancer (of any type)

 * Items used: ,
 * Properties used:, ,

People born before year 1880 with no death date

 * Items used:
 * Properties used:, ,

Largest cities with female mayor

 * Items used: ,
 * Properties used:, , , , ,

List of countries ordered by the number of their cities with female mayor

 * Items used: ,
 * Properties used:, , , , ,

How many states this US state borders

 * Items used:
 * Properties used: ,

Whose birthday is today?

 * Properties used:

Who discovered the most asteroids?

 * Items used:
 * Properties used: ,

Who discovered the most planets?

 * Items used:
 * Properties used:, ,

American universities founded before the states they reside in were created

 * Items used:.
 * Properties used:, , , ,

What is the relation between Terrell Buckley and Miami Dolphins?

 * Items used: ,

Properties that are defined as "qualifier only" but are used in references

 * Items used:
 * Properties used:

Aliases of properties which are used more than once

 * Items used: none
 * Properties used: all

WDQ queries: https://www.wikidata.org/wiki/Wikidata:List_of_queries

French people with an article on the English Wikipedia but not on the French one

 * Items used: ,
 * Properties used: ,

Number of scientists per gender

 * Items used: ,
 * Properties used:, ,

Mushers with neither a ranking in a race nor a reason for not finishing it

 * Items used:
 * Properties used:, , , , ,

Cats
Item used:

Items with labels from SERVICE wikibase:label

 * Items used: ,
 * Properties used:, ,

Items with label from rdfs:label (same items as previous sample)

 * Items used: ,
 * Properties used:, ,

Items with labels after grouping (labels by using service)

 * Items used:
 * Properties used: ,

Items with labels for specific languages in comparison (labels from rdfs:label)

 * Items used:
 * Properties used: