User:Jobu0101/API

From Wikidata
Jump to navigation Jump to search

Here I want to present some useful API requests. Check also out the API sandbox. For more details visit api.php and wdq.wmflabs.org.

Wikidata API[edit]

Get general information about a Wikidata item[edit]

action=wbgetentities & ids=Q15648198 & redirects=yes & props=info

Get label from Wikidata item[edit]

action=wbgetentities & ids=Q15648198 & props=labels & languages=en
Leave out languages to show all languages or add more languages with slashes.

Get Wikipedia title from Wikidata item[edit]

action=wbgetentities & ids=Q15648198 & props=sitelinks & sitefilter=enwiki
Leave out sitefilter to show all languages or add more languages with slashes.

Get Wikidata item from Wikipedia title[edit]

action=wbgetentities & sites=enwiki & props=info & titles=Earth

Get claims of given property (here IMDb id) from Wikidata item[edit]

action=wbgetclaims & property=P345 & entity=Q15648198
Leave out property to get the claims of all properties.

WikidataQuery[edit]

Templates for linked queries: {{query|...}}. But better use Autolist 2.

Get Wikidata item from IMDb id[edit]

q=string[345:'tt2582802']

Get films of given director[edit]

q=claim[57:3772]

Examples[edit]

SPARQL[edit]

Links[edit]

My examples[edit]

German chancellors with spouses[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?chancellorLabel ?spouseLabel WHERE {
   ?chancellor wdt:P569 ?birthday .
   ?chancellor wdt:P39 wd:Q4970706 .
  
   ?chancellor p:P26 ?spouse_statement .
   ?spouse_statement v:P26 ?spouse .
   #?spouse wdt:P569 ?spouseday .
               
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "de" .
   }
} ORDER BY ?birthday ?spouse
Try it!

German chancellors with number of spouses[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?chancellor ?chancellorLabel ?spouse_number WHERE {
	?chancellor wdt:P569 ?birthday .
   	?chancellor wdt:P39 wd:Q4970706 .
  
  {SELECT ?chancellor (COUNT(?spouse) AS ?spouse_number) WHERE {
    ?chancellor p:P26 ?spouse_statement .
    ?spouse_statement v:P26 ?spouse
                      } GROUP BY ?chancellor }.

               
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "de" .
   } 
} ORDER BY DESC(?spouse_number) ?birthday
Try it!

Human beings with at least five spouses[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?human ?humanLabel ?spouse_number WHERE {
   	?human wdt:P31 wd:Q5 .
  
  {SELECT ?human (COUNT(?spouse) AS ?spouse_number) WHERE {
    ?human p:P26 ?spouse_statement .
    ?spouse_statement v:P26 ?spouse
   } GROUP BY ?human } .
  
	FILTER (?spouse_number>=5)
               
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   } 
} ORDER BY DESC(?spouse_number) ?humanLabel
Try it!

Academy Award winners[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
	?item wdt:P166 ?award .
  	?award wdt:P31 wd:Q19020 .
  	FILTER NOT EXISTS { ?item wdt:P31 wd:Q5 } 
    #?item wdt:P31/wdt:P279* wd:Q11424
    #FILTER NOT EXISTS { ?item wdt:P31/wdt:P279* wd:Q11424 } 
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }
} ORDER BY ?itemLabel
Try it!

Academy Award winners and nominees which don't mention the respective ceremony[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?instanceLabel ?item ?itemLabel ?property ?awardLabel WHERE {
  ?item wdt:P31 ?instance .
  ?instance wdt:P279* wd:Q11424 .
  {{
    ?item p:P166 ?award_statement .
  	?award_statement v:P166 ?award
  }  UNION {
    ?item p:P1411 ?award_statement .
  	?award_statement v:P1411 ?award
  }}.
  ?item ?property ?award .
  ?award wdt:P31 wd:Q19020 .
  FILTER NOT EXISTS { ?award_statement pq:P805 ?ceremony } .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?property ?instanceLabel ?itemLabel
Try it!

Movies in which the director is also producer and screenwriter[edit]

SELECT ?instanceLabel ?film ?filmLabel ?personLabel WHERE {
  ?film wdt:P31 ?instance .
  ?film wdt:P57 ?person .
  ?film wdt:P58 ?person .
  ?film wdt:P162 ?person .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?instanceLabel ?filmLabel
Try it!

Movies in which the director is also part of the cast[edit]

SELECT ?instanceLabel ?film ?filmLabel ?personLabel WHERE {
  ?film wdt:P31 ?instance .
  ?instance wdt:P279* wd:Q11424 .
  ?film wdt:P57 ?person .
  ?film wdt:P161 ?person .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?instanceLabel ?filmLabel
Try it!

Search for items with given IMDb id[edit]

SELECT ?item WHERE {
  ?item wdt:P345 "tt0110912"
}
Try it!

Singles of performer[edit]

SELECT ?item ?itemLabel ?release WHERE {
  ?item wdt:P31 wd:Q134556 .
  ?item wdt:P175 wd:Q483810 .
  OPTIONAL { ?item wdt:P577 ?release } .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?release ?itemLabel
Try it!

Performers with at least 25 single releases[edit]

SELECT ?performer ?performerLabel ?singles WHERE{
{ SELECT ?performer (count(?single) AS ?singles) WHERE {
  ?single wdt:P31 wd:Q134556 .
  ?single wdt:P175 ?performer 
} GROUP BY ?performer } FILTER (?singles>=25) .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY DESC(?singles) ?performerLabel
Try it!

Number of seasons[edit]

SELECT ?series ?seriesLabel ?seasons WHERE {
  ?series wdt:P2437 ?seasons .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY DESC(?seasons) ?seriesLabel
Try it!

Series with more than 100 episodes[edit]

SELECT ?series ?seriesLabel ?episodes WHERE {
  ?series wdt:P1113 ?episodes FILTER (?episodes>100).
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY DESC(?episodes) ?seriesLabel
Try it!

Sovereign states with currency euro[edit]

SELECT ?country ?countryLabel WHERE {
  ?country wdt:P31 wd:Q3624078 .
  ?country wdt:P38 wd:Q4916
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} ORDER BY ?countryLabel
Try it!

Current sovereign states with capital by continent (in German)[edit]

SELECT ?country ?continentLabel ?unicode ?iso2 ?iso3 ?countryLabel ?capitalLabel ?capital WHERE {
  ?country wdt:P31 wd:Q3624078 .
  FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240} .
  FILTER NOT EXISTS {?country wdt:P31 wd:Q1145276} .
  OPTIONAL{?country wdt:P36 ?capital}
  OPTIONAL{?country wdt:P30 ?continent}
  OPTIONAL{?country wdt:P487 ?unicode}
  OPTIONAL{?country wdt:P297 ?iso2}
  OPTIONAL{?country wdt:P298 ?iso3}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
} ORDER BY ?iso3 ?countryLabel ?countryLabel
Try it!

Current sovereign states with capitals by continent (in German)[edit]

SELECT ?country ?continentName ?countryName (GROUP_CONCAT(DISTINCT(?capitalName);separator=", ") AS ?capitals) WHERE {
  ?country wdt:P31 wd:Q3624078 . ?country rdfs:label ?countryName . FILTER(lang(?countryName) = "de")
  FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240} .
  FILTER NOT EXISTS {?country wdt:P31 wd:Q1145276} .
  OPTIONAL{?country wdt:P36 ?capital . ?capital rdfs:label ?capitalName . FILTER(lang(?capitalName) = "de")}
  ?country wdt:P30 ?continent . ?continent rdfs:label ?continentName . FILTER(lang(?continentName) = "de")
}
GROUP BY ?country ?countryName ?continent ?continentName
ORDER BY ?continentName ?countryName
Try it!

German municipalities in Hesse[edit]

SELECT ?muni ?muniLabel WHERE {
  ?muni wdt:P31 wd:Q262166 .
  ?muni wdt:P131 wd:Q1199 .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} ORDER BY ?muniLabel
Try it!

German municipalities by key[edit]

SELECT ?muni ?muniLabel ?key WHERE {
  ?muni wdt:P439 ?key
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} ORDER BY ?key
Try it!

More than one IMDb id[edit]

SELECT ?item ?itemLabel ?imdb1 ?imdb2 WHERE {
  ?item wdt:P345 ?imdb1 .
  ?item wdt:P345 ?imdb2 .
  FILTER (?imdb1 < ?imdb2)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?imdb1
Try it!

Use of the new qualifier only property nominee (P2453)[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?item ?itemLabel ?nominee ?nomineeLabel WHERE {
  ?item p:P1411 ?award_statement .
  ?award_statement pq:P2453 ?nominee .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?item
Try it!

Item without instance of (P31) but with IMDb id[edit]

SELECT ?item ?itemLabel ?imdb WHERE {
	?item wdt:P345 ?imdb .
  	FILTER NOT EXISTS { ?item wdt:P31 ?instance } 
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }
} ORDER BY ?imdb
Try it!

List of all Academy Awards[edit]

SELECT ?award ?awardLabel WHERE {
  	?award wdt:P31 wd:Q19020 .
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }
} ORDER BY ?awardLabel
Try it!

Persons who died before their birth[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>

SELECT ?person ?personLabel ?b ?d WHERE {
  ?person p:P569/psv:P569 ?bn .
  ?person p:P570/psv:P570 ?dn .
  ?bn wikibase:timeValue ?b .
  ?dn wikibase:timeValue ?d .
  FILTER (?d < ?b) .
  ?bn wikibase:timePrecision "11"^^xsd:integer .
  ?dn wikibase:timePrecision "11"^^xsd:integer .
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }
} ORDER BY ?personLabel
Try it!

Films released in Germany in 2016[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>

SELECT DISTINCT ?film ?release ?filmLabel WHERE {
  {?film wdt:P31 wd:Q11424} UNION {?film wdt:P31/wdt:P279+ wd:Q11424} .
  ?film p:P577 ?release_statement .
  ?release_statement psv:P577/wikibase:timePrecision "11"^^xsd:integer .
  ?release_statement v:P577 ?release . FILTER(year(?release)=2016) .
  ?release_statement pq:P291 wd:Q183 . FILTER NOT EXISTS{?release_statement wikibase:rank wikibase:DeprecatedRank}
  FILTER NOT EXISTS {?release_statement pq:P400 ?platform}
  FILTER NOT EXISTS {?release_statement pq:P437 ?distribution}
  FILTER NOT EXISTS {?film wdt:P31 wd:Q506240}
  FILTER NOT EXISTS {?film wdt:P31 wd:Q21191270}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
} ORDER BY ?release ?filmLabel
Try it!

Actors with a least 5 Top 250 movies[edit]

SELECT ?actor (COUNT(DISTINCT(?film)) AS ?films) (GROUP_CONCAT(?film) AS ?filmography) WHERE 
{
    VALUES ?film {wd:Q172241 wd:Q47703 wd:Q184768 wd:Q163872 wd:Q104123 wd:Q483941 wd:Q2345 wd:Q131074 wd:Q41483 wd:Q190050 wd:Q127367 wd:Q181795 wd:Q134773 wd:Q25188 wd:Q171669 wd:Q164963 wd:Q42047 wd:Q83495 wd:Q189540 wd:Q17738 wd:Q220741 wd:Q190908 wd:Q133654 wd:Q204191 wd:Q132351 wd:Q19355 wd:Q484675 wd:Q168154 wd:Q13417189 wd:Q155653 wd:Q165817 wd:Q132689 wd:Q208572 wd:Q238211 wd:Q163038 wd:Q174284 wd:Q34414 wd:Q595 wd:Q45602 wd:Q208263 wd:Q170564 wd:Q150804 wd:Q172975 wd:Q15648198 wd:Q91540 wd:Q190525 wd:Q128518 wd:Q182692 wd:Q105702 wd:Q193570 wd:Q46551 wd:Q36479 wd:Q103569 wd:Q109116 wd:Q153882 wd:Q464032 wd:Q571032 wd:Q186341 wd:Q747936 wd:Q189330 wd:Q104905 wd:Q274520 wd:Q25139 wd:Q104814 wd:Q6074 wd:Q24815 wd:Q186572 wd:Q475693 wd:Q223139 wd:Q202548 wd:Q62730 wd:Q206388 wd:Q127021 wd:Q181803 wd:Q196977 wd:Q484048 wd:Q72962 wd:Q162729 wd:Q181086 wd:Q487181 wd:Q187278 wd:Q47221 wd:Q478209 wd:Q177922 wd:Q228186 wd:Q208269 wd:Q243439 wd:Q190956 wd:Q62665 wd:Q309153 wd:Q172837 wd:Q103474 wd:Q335160 wd:Q25043 wd:Q374172 wd:Q171048 wd:Q153723 wd:Q6144664 wd:Q135465 wd:Q339876 wd:Q270510 wd:Q153677 wd:Q200299 wd:Q640561 wd:Q185658 wd:Q151599 wd:Q251559 wd:Q47075 wd:Q20475 wd:Q166262 wd:Q190086 wd:Q271830 wd:Q104137 wd:Q229633 wd:Q174811 wd:Q32303 wd:Q220780 wd:Q193835 wd:Q152857 wd:Q105598 wd:Q644987 wd:Q110354 wd:Q42198 wd:Q211372 wd:Q431093 wd:Q216006 wd:Q18002795 wd:Q866120 wd:Q39571 wd:Q188718 wd:Q214723 wd:Q152105 wd:Q565231 wd:Q217189 wd:Q184843 wd:Q748851 wd:Q851095 wd:Q239756 wd:Q850159 wd:Q272860 wd:Q220910 wd:Q29011 wd:Q1415964 wd:Q1392744 wd:Q5890 wd:Q126699 wd:Q309545 wd:Q164103 wd:Q337078 wd:Q949228 wd:Q204212 wd:Q201674 wd:Q2875 wd:Q684150 wd:Q373096 wd:Q222720 wd:Q109135 wd:Q1212650 wd:Q1757288 wd:Q496255 wd:Q183063 wd:Q269912 wd:Q208632 wd:Q132863 wd:Q183081 wd:Q14920425 wd:Q210756 wd:Q1128756 wd:Q1768437 wd:Q221462 wd:Q165325 wd:Q24953 wd:Q223884 wd:Q465773 wd:Q190643 wd:Q244315 wd:Q232000 wd:Q572165 wd:Q162331 wd:Q695255 wd:Q494722 wd:Q778161 wd:Q3023357 wd:Q506418 wd:Q304074 wd:Q3521099 wd:Q474098 wd:Q184255 wd:Q18547944 wd:Q210364 wd:Q233464 wd:Q180098 wd:Q676039 wd:Q16672466 wd:Q59249 wd:Q8885676 wd:Q739046 wd:Q200437 wd:Q202211 wd:Q167726 wd:Q12018 wd:Q107226 wd:Q426828 wd:Q193695 wd:Q645094 wd:Q192115 wd:Q659609 wd:Q499639 wd:Q162255 wd:Q175038 wd:Q488169 wd:Q488655 wd:Q214801 wd:Q188652 wd:Q187726 wd:Q232009 wd:Q784812 wd:Q714057 wd:Q189505 wd:Q182218 wd:Q471716 wd:Q165651 wd:Q466101 wd:Q458656 wd:Q257818 wd:Q14918344 wd:Q5887360 wd:Q573743 wd:Q160060 wd:Q3404003 wd:Q245208 wd:Q46717 wd:Q76479 wd:Q204374 wd:Q498577 wd:Q201293 wd:Q587419 wd:Q325643 wd:Q494871 wd:Q179673 wd:Q156516 wd:Q208108 wd:Q488376 wd:Q1132629 wd:Q652186 wd:Q592072 wd:Q952142 wd:Q1056853 wd:Q18402 wd:Q555687} .
    ?film wdt:P161 ?actor
} 
GROUP BY ?actor 
HAVING (?films >= 5)
ORDER BY DESC(?films)
Try it!

Nominated for the 88th Academy Awards[edit]

PREFIX schema: <http://schema.org/>

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?item ?itemLabel ?awardLabel WHERE {
  ?item p:P1411 ?award_statement .
  ?award_statement v:P1411 ?award .
  ?award_statement pq:P805 wd:Q20022969 .
  #OPTIONAL { ?article schema:about ?item . ?article schema:inLanguage "en" } FILTER(!bound(?article))
 SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?itemLabel
Try it!

Ceremonies by number of nominated items[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ceremony ?ceremonyLabel (COUNT(DISTINCT(?item)) AS ?nominated_items) WHERE {
  ?item p:P1411 ?award_statement .
  ?award_statement pq:P805 ?ceremony
SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} GROUP BY ?ceremony ?ceremonyLabel ORDER BY DESC(?nominated_items)
Try it!

Films with nominations for Academy Award for Best Actor (Q103916) and Academy Award for Best Actress (Q103618)[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?item ?itemLabel ?ceremonyLabel WHERE {
  ?item p:P1411 ?award_statement1 .
  ?item p:P1411 ?award_statement2 .
  ?award_statement1 v:P1411 wd:Q103916 .
  ?award_statement2 v:P1411 wd:Q103618 .
  ?award_statement1 pq:P805 ?ceremony .
  ?award_statement2 pq:P805 ?ceremony .
  ?ceremony wdt:P585 ?time
 SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?time ?itemLabel
Try it!

Number of IMDb ids grouped by prefix and length[edit]

SELECT ?prefix ?length ?number ?largest_id ?respective_item ?respective_itemLabel WHERE {
?respective_item wdt:P345 ?largest_id .
{SELECT ?prefix ?length (COUNT(DISTINCT(?imdb)) AS ?number) (MAX(?imdb) AS ?largest_id) WHERE {
  ?item wdt:P345 ?imdb
  BIND (SUBSTR(?imdb,1,2) AS ?prefix) .
  BIND (STRLEN(?imdb) AS ?length)
} GROUP BY ?prefix ?length} SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?number)
Try it!

IMDb ids with non-standard length[edit]

SELECT ?item ?imdb WHERE {
  ?item wdt:P345 ?imdb FILTER (STRLEN(?imdb)!=9 && STRLEN(?imdb)!=14)
} ORDER BY ?imdb
Try it!

Different items with same IMDb id[edit]

SELECT ?item1 ?item2 ?item1Label ?item2Label ?imdb WHERE {
  ?item1 wdt:P345 ?imdb FILTER (SUBSTR(?imdb,1,2)='nm') .
  ?item2 wdt:P345 ?imdb FILTER (STR(?item1)<STR(?item2)) .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY ?imdb
Try it!

Humans by occupation[edit]

SELECT ?occupation ?occupationLabel (COUNT(DISTINCT(?human)) AS ?number) WHERE {
  ?human wdt:P31 wd:Q5 .
  ?human wdt:P106 ?occupation
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
GROUP BY ?occupation ?occupationLabel
HAVING (?number >= 100)
ORDER BY DESC(?number)
Try it!

Actors of movies released in Germany in 2015 without IMDb id[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?cast ?castLabel ?filmLabel ?film ?typeLabel WHERE {
  ?film wdt:P31/wdt:P279* wd:Q11424 .
  ?film wdt:P31 ?type .
  ?film p:P577 ?release_statement .
  ?release_statement v:P577 ?release . FILTER(year(?release)=2015) .
  ?release_statement pq:P291 wd:Q183 .
  ?film wdt:P161 ?cast FILTER NOT EXISTS { ?cast wdt:P345 ?imdb } 
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} ORDER BY ?typeLabel ?filmLabel ?cast
Try it!

Actors of German 2015 movies who died before 2010[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?cast ?castLabel ?death  WHERE {
  ?film wdt:P31/wdt:P279* wd:Q11424 .
  ?film p:P577 ?release_statement .
  ?release_statement v:P577 ?release . FILTER(year(?release)=2015) .
  ?release_statement pq:P291 wd:Q183 .
  ?film wdt:P161 ?cast .
  ?cast wdt:P570 ?death FILTER(year(?death)<2010)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} ORDER BY ?death ?cast
Try it!

Winners of categories film was nominated for[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?award (GROUP_CONCAT(DISTINCT(?nominee)) AS ?nominees) ?winner_film (GROUP_CONCAT(DISTINCT(?winner)) AS ?winners) WHERE {
  wd:Q658041 p:P1411 ?award_statement .
  ?award_statement v:P1411 ?award .
  ?award wdt:P31 wd:Q19020 .
  ?award_statement pq:P805 ?ceremony .
  ?award_statement pq:P2453 ?nominee .
  ?winner_film p:P166 ?winner_statement .
  ?winner_statement v:P166 ?award .
  ?winner_statement pq:P805 ?ceremony .
  ?winner_statement pq:P1346 ?winner
}
GROUP BY ?award_statement ?award ?winner_film
Try it!

Items with IMDb ID (P345) but without instance of (P31)[edit]

SELECT ?item ?itemLabel WHERE {
  ?item wdt:P345 ?imdb FILTER NOT EXISTS { ?item wdt:P31 ?instance } .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
Try it!

IMDb ids of nominated people[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?item ?itemLabel ?imdb WHERE {
  ?item wdt:P345 ?imdb FILTER (SUBSTR(?imdb,1,2)='nm') .
  ?item p:P1411 ?award_statement .
  ?award_statement pq:P805 wd:Q20022969 .
 SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY DESC(?imdb)
Try it!

All given names starting with ...[edit]

SELECT DISTINCT ?kindLabel ?item ?name WHERE {
  ?item wdt:P31 ?kind .
  ?kind wdt:P279 wd:Q202444 .
  ?item rdfs:label ?name FILTER (lang(?name) = "en") . FILTER(StrStarts(?name,"Abi"))
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
} ORDER BY ?name LIMIT 1000
Try it!

Number of deaths[edit]

SELECT ?item ?itemLabel ?deaths ?injured ?survivors ?time WHERE {
  ?item wdt:P1120 ?deaths .
  OPTIONAL {?item wdt:P1339 ?injured } .
  OPTIONAL {?item wdt:P1561 ?survivors } .
  ?item wdt:P585 ?time
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de,en" .
  }
} ORDER BY DESC(?time)
Try it!

Glashütte[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>

SELECT ?item ?itemLabel ?instance ?instanceLabel (MIN(?imdbAll) AS ?imdb) (MIN(?mojoAll) AS ?mojo) (MIN(?release) AS ?firstRelease) WHERE {
  VALUES ?item {wd:Q9321426 wd:Q17150575 wd:Q18703062 wd:Q18192306 wd:Q20646602 wd:Q19881558 wd:Q19938437 wd:Q18639756 wd:Q18149041 wd:Q3604746 wd:Q19595098 wd:Q18786473 wd:Q19880878 wd:Q21979652 wd:Q20120108 wd:Q12127045 wd:Q17572811 wd:Q18486021 wd:Q19897965 wd:Q16556668 wd:Q19363732 wd:Q21500755 wd:Q21527443}.
  OPTIONAL{?item wdt:P31 ?instance}.
  OPTIONAL{?item wdt:P345 ?imdbAll}.
  OPTIONAL{?item wdt:P1237 ?mojoAll}.
  OPTIONAL{?item p:P577 ?release_statement . ?release_statement psv:P577/wikibase:timePrecision "11"^^xsd:integer . ?release_statement v:P577 ?release}.
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
} 
GROUP BY ?item ?itemLabel ?instanceLabel ?instance
ORDER BY ?instance ?itemLabel
Try it!

Publication at the Berlinale[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?item ?itemLabel ?release WHERE {
  ?item p:P577 ?release_statement .
  ?release_statement pq:P291 wd:Q130871 .
  ?release_statement v:P577 ?release
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de,en" .
  }
} ORDER BY ?release
Try it!

Release Qualifier abuse in film items[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?film ?filmLabel ?countryLabel  WHERE {
  ?film wdt:P31/wdt:P279* wd:Q11424 .
  ?film p:P577 ?release_statement .
  ?release_statement v:P577 ?release .
  ?release_statement pq:P17 ?country .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de,en" .
  }
} ORDER BY ?countryLabel
Try it!


No Freebase and no dewiki article[edit]

PREFIX schema: <http://schema.org/>

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?cast ?castLabel ?filmLabel ?film ?typeLabel WHERE {
  ?film wdt:P31/wdt:P279* wd:Q11424 .
  ?film wdt:P31 ?type .
  ?film p:P577 ?release_statement .
  ?release_statement v:P577 ?release . FILTER(year(?release)=2015) .
  ?release_statement pq:P291 wd:Q183 .
  ?film wdt:P161 ?cast FILTER NOT EXISTS { ?cast wdt:P646 ?imdb }  .
  OPTIONAL { ?article schema:about ?cast . ?article schema:inLanguage "de" } FILTER(!bound(?article))
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
  }
} ORDER BY ?typeLabel ?filmLabel ?cast
Try it!

List of all fruits[edit]

SELECT ?item ?itemLabel WHERE {
	?item wdt:P31 wd:Q3314483 .
   SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en"}
} ORDER BY ?itemLabel
Try it!

Filmportal[edit]

PREFIX schema: <http://schema.org/>

SELECT ?item ?itemLabel ?filmportal ?article WHERE {
	?item wdt:P2639 ?filmportal
	OPTIONAL { ?article schema:about ?item . ?article schema:inLanguage "de" }
	SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
ORDER BY ?filmportal
Try it!

Film editors without dewiki article[edit]

PREFIX schema: <http://schema.org/>

SELECT ?editor ?editorLabel (COUNT(DISTINCT(?film)) AS ?films) ?imdb ?filmportal WHERE {
  ?film wdt:P1040 ?editor
  OPTIONAL { ?article schema:about ?editor . ?article schema:inLanguage "de" } FILTER(!bound(?article))
  OPTIONAL { ?editor wdt:P345 ?imdb }
  OPTIONAL { ?editor wdt:PP2639 ?filmportal }
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en"}
}
GROUP BY ?editor ?editorLabel ?imdb ?filmportal
HAVING (?films >= 10)
ORDER BY DESC(?films)
Try it!

Filmportal by instance[edit]

SELECT ?instance ?instanceLabel (COUNT(DISTINCT(?item)) AS ?items) WHERE {
	?item wdt:P2639 ?filmportal .
  	?item wdt:P31 ?instance
	SERVICE wikibase:label {bd:serviceParam wikibase:language "de"} 
}
GROUP BY ?instance ?instanceLabel
ORDER BY DESC(?items)
Try it!

Filmportal-IDs with ref column[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT DISTINCT ?item ?itemLabel ?filmportal ?refLabel WHERE {
    ?item p:P2639 ?filmportal_statement .
  	?filmportal_statement v:P2639 ?filmportal
	OPTIONAL {?filmportal_statement prov:wasDerivedFrom/pr:P248 ?ref}
    SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en"}
}
ORDER BY ?filmportal
Try it!

German films without Filmportal-ID[edit]

SELECT DISTINCT ?item ?itemLabel WHERE {
	?item wdt:P31 wd:Q11424 .
  	?item wdt:P495 wd:Q183 .
  	FILTER NOT EXISTS { ?item wdt:P2639 ?filmportal } 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" }
} ORDER BY ?itemLabel
Try it!

Stephen-King-Verfilmungen[edit]

SELECT ?film ?filmLabel ?novelLabel ?imdb ?publication WHERE {
	?film wdt:P31 wd:Q11424 .
	?film wdt:P144 ?novel .
  	?novel wdt:P50 wd:Q39829 .
    ?film wdt:P345 ?imdb .
  	OPTIONAL {?film wdt:P577 ?publication}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" }
} ORDER BY ?publication
Try it!

Film series: Marvel Cinematic Universe[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?originalTitle ?germanTitle (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?director) (SAMPLE(?duration) AS ?duration) ?imdb ((MIN(?pub)) AS ?publication) WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q642878 .
    ?series pq:P1545 ?ordinal .
    ?film wdt:P1476 ?originalTitle .
    ?film rdfs:label ?germanTitle . FILTER(lang(?germanTitle) = "de") .
    ?film wdt:P345 ?imdb .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName . FILTER(lang(?directorName) = "en")}
    OPTIONAL {?film wdt:P2047 ?duration}
  	OPTIONAL {?film wdt:P577 ?pub}
}
GROUP BY ?film ?germanTitle ?originalTitle ?imdb ?ordinal
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

James Bond[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ordinal ((MIN(YEAR(?publication))) AS ?year) ?film ?title ?filmLabel ?actorLabel (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?director) (SAMPLE(?runtime) AS ?runtime) ?imdb (SAMPLE(?mojo) AS ?mojo) WHERE {
	?film p:P179 ?series . ?series v:P179 wd:Q2484680 . ?series pq:P1545 ?ordinal .
	?film p:P161 ?bond . ?bond pq:P453 wd:Q2009573 . ?bond v:P161 ?actor .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName .  FILTER(lang(?directorName) = "en")} .
    ?film wdt:P345 ?imdb .
	OPTIONAL{?film wdt:P1237 ?mojo} .
  	?film wdt:P577 ?publication .
	?film wdt:P1476 ?title .
    OPTIONAL{?film wdt:P2047 ?runtime}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?title ?filmLabel ?imdb ?ordinal ?actor ?actorLabel
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Deutsche Kabinette[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?cabinet ?cabinetLabel ?stateLabel ?chairmanLabel ?start ?end ?previousLabel ?nextLabel ?previous ?next WHERE {
  ?cabinet p:P31 ?cabinetStatement .
  ?cabinetStatement v:P31 wd:Q314729 .
  OPTIONAL{?cabinetStatement pq:P642 ?state}
  OPTIONAL{?cabinetStatement pq:P580 ?start}
  OPTIONAL{?cabinetStatement pq:P582 ?end}
  OPTIONAL{?cabinet wdt:P488 ?chairman}
  OPTIONAL{?cabinet wdt:P155 ?previous}
  OPTIONAL{?cabinet wdt:P156 ?next}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
ORDER BY ?stateLabel ?start
Try it!

Fictional humans with non-fictional IMDb id[edit]

SELECT ?item ?itemLabel ?imdb WHERE {
  ?item wdt:P345 ?imdb FILTER (SUBSTR(?imdb,1,2)!='ch') .
  ?item wdt:P31 wd:Q15632617
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
} ORDER BY ?imdb
Try it!

2014 FIFA World Cup matches[edit]

SELECT (SAMPLE(?matchNR) AS ?matchNR) ?match ?matchLabel (SAMPLE(?pit) AS ?day) (GROUP_CONCAT(DISTINCT(?teamName);separator=" vs. ") AS ?teams) (SUBSTR(SAMPLE(?stage),16,100) AS ?stage) (SAMPLE(?winnerName) AS ?winner) WHERE {
  ?match wdt:P31 wd:Q16466010 .
  ?match wdt:P361 ?partof . ?partof rdfs:label ?stage . FILTER(lang(?stage) = "en")
  {?partof wdt:P361 wd:Q189571} UNION {?partof wdt:P31 wd:Q24198315} .
  ?match wdt:P1545 ?matchNR .
  OPTIONAL{?match wdt:P585 ?pit}
  OPTIONAL{?match wdt:P1346 ?winner . ?winner wdt:P17 ?country . ?country rdfs:label ?winnerName . FILTER(lang(?winnerName) = "en")}
  OPTIONAL{?match wdt:P710 ?team . ?team wdt:P17 ?country . ?country rdfs:label ?teamName . FILTER(lang(?teamName) = "en")} .
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?match ?matchLabel
ORDER BY ASC(xsd:integer(?matchNR))
Try it!

UEFA Euro 2016 teams[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?team ?teamLabel (SAMPLE(?countryName) AS ?country) (COUNT(?player) AS ?playerCount) (GROUP_CONCAT(DISTINCT(?playerName);separator=", ") AS ?players) WHERE {
  ?team wdt:P31 wd:Q24199684 .
  OPTIONAL{?team wdt:P31 ?nationalTeam . ?nationalTeam wdt:P31 wd:Q6979593 . ?nationalTeam wdt:P1532 ?country . ?country rdfs:label ?countryName . FILTER(lang(?countryName) = "en")}
  OPTIONAL{?team wdt:P710 ?player . ?player rdfs:label ?playerName . FILTER(lang(?playerName) = "en")}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?team ?teamLabel
ORDER BY ?playerCount
Try it!

Domains[edit]

SELECT ?state ?stateLabel ?domainLabel WHERE {
	?state wdt:P78 ?domain
   SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
} ORDER BY ?state
Try it!

Songs on Spotify[edit]

SELECT ?item ?itemLabel ?spotify WHERE {
  ?item wdt:P2207 ?spotify .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en,de" .
  }
} ORDER BY ?spotify
Try it!

Animation films with cast[edit]

SELECT ?film ?filmLabel (COUNT(?film) AS ?castMembers) WHERE {
  ?film wdt:P136 wd:Q202866 .
  ?film wdt:P161 ?cast
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?film ?filmLabel
ORDER BY DESC(?castMembers)
Try it!

UEFA Euro 2016 matches[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (SAMPLE(?matchNR) AS ?matchNR) ?match ?matchLabel (SAMPLE(?pit) AS ?day) (GROUP_CONCAT(DISTINCT(?teamName);separator=" vs. ") AS ?teams) (SUBSTR(SAMPLE(?stage),16,100) AS ?stage) (SAMPLE(?winnerName) AS ?winner) WHERE {
  ?match wdt:P361 ?partof . ?partof rdfs:label ?stage . FILTER(lang(?stage) = "en")
  ?match p:P179 ?matchSeries . ?matchSeries v:P179 wd:Q189571 . ?matchSeries pq:P1545 ?matchNR .
  OPTIONAL{?match wdt:P585 ?pit}
  OPTIONAL{?match wdt:P1346 ?winner . ?winner wdt:P1532 ?wCountry . ?wCountry rdfs:label ?winnerName . FILTER(lang(?winnerName) = "en")}
  OPTIONAL{?match wdt:P710 ?team . ?team wdt:P1532 ?tCountry . ?tCountry rdfs:label ?teamName . FILTER(lang(?teamName) = "en")} .
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?match ?matchLabel
ORDER BY ASC(xsd:integer(?matchNR))
Try it!

UEFA Euro 2016 matches with scores[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (SAMPLE(?matchNR) AS ?matchNR) ?match ?matchLabel (SAMPLE(?pit) AS ?day) (CONCAT(?teamNameA," vs. ",?teamNameB) AS ?teams) (CONCAT(STR(SAMPLE(?scoreA)),":",STR(SAMPLE(?scoreB))) AS ?score) (SUBSTR(SAMPLE(?stage),16,100) AS ?stage) (SAMPLE(?winnerName) AS ?winner) ?refereeLabel WHERE {
  ?match wdt:P361 ?partof . ?partof rdfs:label ?stage . FILTER(lang(?stage) = "en")
  ?match p:P179 ?matchSeries . ?matchSeries v:P179 wd:Q189571 . ?matchSeries pq:P1545 ?matchNR .
  OPTIONAL{?match wdt:P585 ?pit}
  OPTIONAL{?match wdt:P1346 ?winner . ?winner wdt:P1532 ?wCountry . ?wCountry rdfs:label ?winnerName . FILTER(lang(?winnerName) = "en")}
  OPTIONAL{?match wdt:P1652 ?referee}
  OPTIONAL{
    ?match p:P1923 ?teamAStatement . ?teamAStatement v:P1923 ?teamA . ?teamAStatement pq:P794 wd:Q24633211 . OPTIONAL{?teamAStatement pq:P1351 ?scoreA} . ?teamA wdt:P1532 ?CountryA . ?CountryA rdfs:label ?teamNameA . FILTER(lang(?teamNameA) = "en") .
    ?match p:P1923 ?teamBStatement . ?teamBStatement v:P1923 ?teamB . ?teamBStatement pq:P794 wd:Q24633216 . OPTIONAL{?teamBStatement pq:P1351 ?scoreB} . ?teamB wdt:P1532 ?CountryB . ?CountryB rdfs:label ?teamNameB . FILTER(lang(?teamNameB) = "en") .
  }
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?match ?matchLabel ?teamNameA ?teamNameB ?referee ?refereeLabel
ORDER BY ASC(xsd:integer(?matchNR))
Try it!

UEFA Euro 2016 teams by goals[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?teamLabel (SUM(?score) AS ?goals) (COUNT(?score) AS ?games) WHERE {
  ?match wdt:P179 wd:Q189571 .
  ?match p:P1923 ?teamStatement . ?teamStatement v:P1923 ?team . ?teamStatement pq:P1351 ?score
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
GROUP BY ?team ?teamLabel
ORDER BY DESC(?goals) ASC(?games)
Try it!

List of FIFA World Cups and UEFA European Football Championships[edit]

SELECT ?championship ?championshipLabel ?start ?end ?participants ?matches ?goals ?winnerLabel WHERE {
  ?championship wdt:P3450 ?season . VALUES ?season {wd:Q19317 wd:Q260858} .
  OPTIONAL {?championship wdt:P580 ?start}
  OPTIONAL {?championship wdt:P582 ?end}
  OPTIONAL {?championship wdt:P1132 ?participants}
  OPTIONAL {?championship wdt:P1350 ?matches}
  OPTIONAL {?championship wdt:P1351 ?goals}
  OPTIONAL {?championship wdt:P1346 ?winner}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
ORDER BY DESC(?season) ?start
Try it!

List of Germany international football games[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ordinal ?match ?previousLabel ?matchLabel ?nextLabel ?previous ?next WHERE{
  ?match p:P179 ?series .
  ?series v:P179 wd:Q1463023
  OPTIONAL{?series pq:P1545 ?ordinal}
  OPTIONAL{?series pq:P155 ?previous}
  OPTIONAL{?series pq:P156 ?next}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

List of all Euro 2016 players[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?countryLabel ?player ?playerLabel ?number ?positionLabel ?birth ((?begin-?birth)/365.25 AS ?age) WHERE {
  BIND("2016-06-10"^^<http://www.w3.org/2001/XMLSchema#date> as ?begin) .
  ?team wdt:P31 wd:Q24199684 .
  ?team p:P710 ?playerSet . ?playerSet v:P710 ?player
  OPTIONAL{?playerSet pq:P413 ?position FILTER(?position != wd:Q715772)}
  OPTIONAL{?playerSet pq:P1618 ?number}
  OPTIONAL{?player wdt:P569 ?birth}
  ?team wdt:P31 ?nationalTeam . ?nationalTeam wdt:P31 wd:Q6979593 . ?nationalTeam wdt:P1532 ?country
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
}
ORDER BY ?countryLabel ASC(xsd:integer(?number))
Try it!

Birth years of all Euro 2016 players[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?year (COUNT(?year) AS ?count)
{
SELECT (YEAR(?birth) AS ?year) WHERE {
  ?team wdt:P31 wd:Q24199684 .
  ?team p:P710 ?playerSet . ?playerSet v:P710 ?player .
  ?player wdt:P569 ?birth
}
}
GROUP BY ?year
ORDER BY ?year
Try it!

Double mojo values[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?film ?filmLabel ?mojo WHERE {
  ?film p:P1237 ?mojo1 .
  ?film p:P1237 ?mojo2 .
  ?mojo1 v:P1237 ?mojo .
  ?mojo2 v:P1237 ?mojo FILTER(?mojo1 != ?mojo2)
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de,en"}
}
Try it!

Films with Kinopolis ID[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?filmLabel ?release ?kinopolis WHERE {
  ?film wdt:P2970 ?kinopolis .
  OPTIONAL{?film p:P577 ?release_statement . ?release_statement v:P577 ?release . ?release_statement pq:P291 wd:Q183}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
ORDER BY DESC(?release)
Try it!

Kinopolis IDs associated to films[edit]

SELECT DISTINCT ?kinopolis WHERE {
  ?film wdt:P2970 ?kinopolis .
  ?film wdt:P31 ?instance . ?instance wdt:P279* wd:Q11424
} ORDER BY ?kinopolis
Try it!

Quentin Tarantino films[edit]

SELECT ?film ?filmLabel (MIN(?publication) AS ?release) WHERE {
  ?film wdt:P31 ?instance . ?instance wdt:P279* wd:Q11424 .
  ?film wdt:P57 wd:Q3772 .
  ?film wdt:P577 ?publication
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
}
GROUP BY ?film ?filmLabel
ORDER BY ?release
Try it!

Disney Animation Studios feature films[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ordinal ((MIN(YEAR(?publication))) AS ?year) ?film (SAMPLE(?title) AS ?title) ?filmLabel (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?directors) (SAMPLE(?runtime) AS ?runtime) ?imdb (SAMPLE(?mojo) AS ?mojo) WHERE {
	?film p:P179 ?series . ?series v:P179 wd:Q56070713 . ?series pq:P1545 ?ordinal .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName .  FILTER(lang(?directorName) = "en")} .
    ?film wdt:P345 ?imdb .
	OPTIONAL{?film wdt:P1237 ?mojo} .
  	?film wdt:P577 ?publication .
	OPTIONAL{?film wdt:P1476 ?title} .
    OPTIONAL{?film wdt:P2047 ?runtime}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?filmLabel ?imdb ?ordinal
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

DreamWorks Animation feature films[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ordinal ((MIN(YEAR(?publication))) AS ?year) ?film (SAMPLE(?title) AS ?title) ?filmLabel (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?directors) (SAMPLE(?runtime) AS ?runtime) (SAMPLE(?imdb) AS ?imdb) (SAMPLE(?mojo) AS ?mojo) WHERE {
	?film p:P179 ?series . ?series v:P179 wd:Q26196748 . ?series pq:P1545 ?ordinal .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName .  FILTER(lang(?directorName) = "en")} .
    OPTIONAL{?film wdt:P345 ?imdb}
	OPTIONAL{?film wdt:P1237 ?mojo} .
  	?film wdt:P577 ?publication .
	OPTIONAL{?film wdt:P1476 ?title} .
    OPTIONAL{?film wdt:P2047 ?runtime}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?filmLabel ?ordinal
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Burton films without Carter and Depp[edit]

SELECT ((MIN(YEAR(?publication))) AS ?year) ?film ?filmLabel WHERE {
  ?film wdt:P57 wd:Q56008 .
  ?film wdt:P577 ?publication .
  FILTER NOT EXISTS { ?film wdt:P161 wd:Q37175 }
  FILTER NOT EXISTS { ?film wdt:P161 wd:Q170428 }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?film ?filmLabel
ORDER BY ?year
Try it!

Film series[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?sLabel ?ordinal ((MIN(YEAR(?publication))) AS ?year) ?film (SAMPLE(?title) AS ?title) ?filmLabel (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?directors) (SAMPLE(?runtime) AS ?runtime) (SAMPLE(?imdb) AS ?imdb) (SAMPLE(?mojo) AS ?mojo) WHERE {
	VALUES ?s {wd:Q26196748 wd:Q6603742} .
    ?film p:P179 ?series . ?series v:P179 ?s . ?series pq:P1545 ?ordinal .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName .  FILTER(lang(?directorName) = "en")} .
    OPTIONAL{?film wdt:P345 ?imdb}
	OPTIONAL{?film wdt:P1237 ?mojo} .
  	?film wdt:P577 ?publication .
	OPTIONAL{?film wdt:P1476 ?title} .
    OPTIONAL{?film wdt:P2047 ?runtime}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?s ?sLabel ?film ?filmLabel ?ordinal
ORDER BY ?sLabel ASC(xsd:integer(?ordinal))
Try it!

People with Mathematics Genealogy Project ID[edit]

SELECT ?person ?personLabel ?id WHERE {
  ?person wdt:P549 ?id
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
} ORDER BY ASC(xsd:integer(?id))
Try it!

People with Mathematics Genealogy Project ID but without doctoral advisor[edit]

SELECT ?person ?personLabel ?id ?birth WHERE {
  ?person wdt:P549 ?id .
  ?person wdt:P569 ?birth FILTER(YEAR(?birth)!=2000)
  FILTER NOT EXISTS { ?person wdt:P184 ?advisor } 
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
} ORDER BY DESC(?birth)
Try it!

Math people[edit]

SELECT ?person ?personLabel ?birth WHERE {
  ?person wdt:P106 wd:Q170790 .
  ?person wdt:P108 ?university .
  OPTIONAL{?person wdt:P569 ?birth}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
} ORDER BY DESC(?birth)
Try it!

People with doctoral advisor stated in Mathematics Genealogy Project[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?person ?personLabel ?advisorLabel ?retrieved WHERE {
  ?person p:P184 ?ad .
  ?ad v:P184 ?advisor .
  ?ad prov:wasDerivedFrom ?ref .
  ?ref pr:P248 wd:Q829984 .
  ?ref pr:P813 ?retrieved
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
} ORDER BY ?personLabel
Try it!

Items with Kinopolis or Cineplex ID[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?filmLabel ?release ?kinopolis ?cineplex WHERE {
  {SELECT DISTINCT ?film {{?film wdt:P2970 ?kinopolis} UNION {?film wdt:P3077 ?cineplex}}}
  OPTIONAL{?film wdt:P2970 ?kinopolis} OPTIONAL{?film wdt:P3077 ?cineplex} . 
  OPTIONAL{?film p:P577 ?release_statement . ?release_statement v:P577 ?release . ?release_statement pq:P291 wd:Q183}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
ORDER BY DESC(?release)
Try it!

Films with IMDb id published in 2016[edit]

SELECT ?film ?filmLabel (MIN(?release) AS ?release) ?imdb WHERE {
  ?film wdt:P345 ?imdb .
  ?film wdt:P577 ?release FILTER(YEAR(?release)=2016)
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
GROUP BY ?film ?filmLabel ?imdb
ORDER BY DESC(?release)
Try it!

Tatort episodes[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ordinal (MIN(?publication) AS ?aired) ?film ?title (GROUP_CONCAT(DISTINCT(?investigatorName);separator=", ") AS ?investigators) (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?directors)(GROUP_CONCAT(DISTINCT(?screenwriter);separator=", ") AS ?screenwriters) (SAMPLE(?runtime) AS ?runtime) (SAMPLE(?imdb) AS ?imdb) WHERE {
  ?film p:P179 ?series . ?series v:P179 wd:Q689438 . ?series pq:P1545 ?ordinal . FILTER(xsd:integer(?ordinal)<10000)
  OPTIONAL{?film wdt:P1476 ?title}
  OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName . FILTER(lang(?directorName) = "de")}
  OPTIONAL{?film wdt:P58 ?screen . ?screen rdfs:label ?screenwriter .  FILTER(lang(?screenwriter) = "de")}
  OPTIONAL{?film wdt:P345 ?imdb}
  OPTIONAL{?film wdt:P577 ?publication}
  OPTIONAL{?film wdt:P2047 ?runtime}
  OPTIONAL{?film p:P161 ?cast . ?cast pq:P453 ?investigator . ?investigator wdt:P31 wd:Q110857263 . ?investigator rdfs:label ?investigatorName . FILTER(lang(?investigatorName) = "de")}
}
GROUP BY ?film ?title ?ordinal
ORDER BY DESC(xsd:integer(?ordinal))
Try it!

Film portal without de label[edit]

SELECT ?film ?filmportal WHERE {
  	?film wdt:P31/wdt:P279* wd:Q11424 .
	?film wdt:P2639 ?filmportal
    FILTER NOT EXISTS {?film rdfs:label ?delabel . FILTER(lang(?delabel) = "de")}
} ORDER BY ?film
Try it!

Films with Cineplex ID[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?cineplex ?film ?filmLabel (GROUP_CONCAT(?country) AS ?countries) (MIN(?release) AS ?release) (MIN(?grelease) AS ?grelease) WHERE {
  ?film wdt:P3077 ?cineplex .
  OPTIONAL{?film wdt:P495 ?country} .
  OPTIONAL{?film p:P577 ?release_statement . ?release_statement psv:P577/wikibase:timePrecision "11"^^xsd:integer . ?release_statement v:P577 ?release} .
  OPTIONAL{?film p:P577 ?grelease_statement . ?grelease_statement psv:P577/wikibase:timePrecision "11"^^xsd:integer . ?grelease_statement v:P577 ?grelease . ?grelease_statement pq:P291 wd:Q183} .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?cineplex ?film ?filmLabel
ORDER BY ?filmLabel
Try it!

Films without identifier[edit]

SELECT ?film WHERE {
  	?film wdt:P31/wdt:P279* wd:Q11424
  MINUS {
    ?film ?p [] .
    ?prop wikibase:directClaim ?p .
    ?prop wdt:P31 wd:Q22964274
  }
}
LIMIT 1000
Try it!

Bundesliga[edit]

SELECT ?season ?seasonLabel (COUNT(?team) AS ?teams) (SAMPLE(?start) AS ?start) (SAMPLE(?end) AS ?end) WHERE {
  ?season wdt:P31 wd:Q82595 .
  ?season wdt:P1923 ?team .
  OPTIONAL {?season wdt:P580 ?start}
  OPTIONAL {?season wdt:P582 ?end}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?season ?seasonLabel
ORDER BY ?seasonLabel
Try it!

Bundesliga teams by number of seasons[edit]

SELECT ?team ?teamLabel (COUNT(?season) AS ?seasons) WHERE {
  ?season wdt:P31 wd:Q82595 .
  ?season wdt:P1923 ?team .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?team ?teamLabel
ORDER BY DESC(?seasons)
Try it!

Tarantino's favorite films[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ((MIN(YEAR(?publication))) AS ?year) ?film (SAMPLE(?title) AS ?title) ?filmLabel (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?directors) (SAMPLE(?runtime) AS ?runtime) ?imdb (SAMPLE(?mojo) AS ?mojo) WHERE {
  	VALUES ?film {wd:Q182692 wd:Q1211829 wd:Q162672 wd:Q39975 wd:Q41483 wd:Q110354 wd:Q1066714 wd:Q189505 wd:Q508163 wd:Q2663393 wd:Q541707 wd:Q47221} .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName .  FILTER(lang(?directorName) = "en")} .
    ?film wdt:P345 ?imdb .
	OPTIONAL{?film wdt:P1237 ?mojo} .
  	?film wdt:P577 ?publication .
	OPTIONAL{?film wdt:P1476 ?title} .
    OPTIONAL{?film wdt:P2047 ?runtime}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?filmLabel ?imdb ?ordinal
ORDER BY ?year
Try it!

German Kinostarts by year[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>

SELECT ?year (COUNT(?film) AS ?number) WHERE {
  SELECT DISTINCT ?film (YEAR(?release) AS ?year)  WHERE {
    ?film wdt:P31/wdt:P279* wd:Q11424 .
    ?film p:P577 ?release_statement .
    ?release_statement psv:P577/wikibase:timePrecision "11"^^xsd:integer .
    ?release_statement v:P577 ?release .
    ?release_statement pq:P291 wd:Q183 . FILTER NOT EXISTS{?release_statement wikibase:rank wikibase:DeprecatedRank}
    FILTER NOT EXISTS {?release_statement pq:P400 ?platform}
    FILTER NOT EXISTS {?release_statement pq:P437 ?distribution}
    FILTER NOT EXISTS {?film wdt:P31 wd:Q506240}
    SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
  }
}
GROUP BY ?year
ORDER BY ?year
Try it!

Heads of state by age[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?headOfState ?headOfStateLabel ((YEAR(NOW())-YEAR(?birthday)) AS ?age) ?birthday ?stateLabel ?sexLabel WHERE {
  ?state wdt:P31 wd:Q3624078
         FILTER NOT EXISTS {?state wdt:P31 wd:Q3024240}
         FILTER NOT EXISTS {?state wdt:P31 wd:Q1145276} .
  ?state wdt:P35 ?headOfState.
  ?headOfState wdt:P569 ?birthday .
  ?headOfState wdt:P21 ?sex
             
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
ORDER BY DESC(?birthday)
Try it!

Fields Medal winners[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (YEAR(?awarded) AS ?year) ?mathematicianLabel ((YEAR(?awarded) - YEAR(?birth)) AS ?age) ?birth ?death WHERE {
  ?mathematician p:P166 ?fields . ?fields v:P166 wd:Q28835 . ?fields pq:P585 ?awarded .
  ?mathematician wdt:P569 ?birth .
  OPTIONAL{?mathematician wdt:P570 ?death}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en,de"}
} ORDER BY ASC(?awarded)
Try it!

Fields Medals per year[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?year (COUNT(?mathematician) AS ?number) WHERE {
  SELECT (YEAR(?awarded) AS ?year) ?mathematician WHERE {
    ?mathematician p:P166 ?fields .
    ?fields v:P166 wd:Q28835 .
    ?fields pq:P585 ?awarded .
  }
}
GROUP BY ?year
ORDER BY ASC(?year)
Try it!

DC Extended Universe[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?filmLabel ?imdb ((MIN(?pub)) AS ?publication) WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q18281265.
    ?series pq:P1545 ?ordinal .
    ?film wdt:P345 ?imdb .
  	OPTIONAL {?film wdt:P577 ?pub}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?film ?filmLabel ?imdb ?ordinal
ORDER BY ?publication
Try it!

Films of film series without ordinal[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?filmLabel ?seriesLabel ?film ?series WHERE {
  ?film wdt:P31 wd:Q11424 .
  ?film p:P179 ?seriesContainer .
  ?seriesContainer v:P179 ?series .
  FILTER NOT EXISTS { ?seriesContainer pq:P1545 ?ordinal }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
ORDER BY ?series ?film
Try it!

Bundesminister Kabinett Merkel IV nach Alter[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?minister ?ministerLabel ((2018-YEAR(?birthday)) AS ?age) ?birthday ?sexLabel WHERE {
  VALUES ?minister {wd:Q567 wd:Q61053 wd:Q44612 wd:Q108447 wd:Q65539 wd:Q15117357 wd:Q71534 wd:Q60772 wd:Q88158 wd:Q19279839 wd:Q86294 wd:Q500381 wd:Q1407342 wd:Q15783504 wd:Q85516 wd:Q1602354 }
  ?minister wdt:P569 ?birthday .
  ?minister wdt:P21 ?sex
             
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
}
ORDER BY DESC(?birthday)
Try it!

Film series: X-Men[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?filmLabel (SAMPLE(?duration) AS ?duration) ?imdb ((MIN(?pub)) AS ?publication) WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q2006869.
    ?series pq:P1545 ?ordinal .
    ?film wdt:P345 ?imdb .
    OPTIONAL {?film wdt:P2047 ?duration}
  	OPTIONAL {?film wdt:P577 ?pub}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?film ?filmLabel ?imdb ?ordinal
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Television series: Stromberg[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?episode ?ordinal (CONCAT("S",?season,"E",?episodeInSeason) AS ?SE) ?title ?duration ?publication ?wrongPub1 ?wrongPub2 ?imdb
WHERE {
    ?seasonQ p:P179 ?seriesBlock .
    ?seriesBlock v:P179 wd:Q1545694 .
    ?seriesBlock pq:P1545 ?season .
    ?episode p:P4908 ?seasonBlock .
    ?seasonBlock v:P4908 ?seasonQ .
    ?seasonBlock pq:P1545 ?episodeInSeason .
    ?episode p:P179 ?seriesBlock2 . ?seriesBlock2 v:P179 wd:Q1545694 . ?seriesBlock2 pq:P1545 ?ordinal .
    OPTIONAL {?episode wdt:P1476 ?title}
    OPTIONAL {?episode wdt:P2047 ?duration}
    OPTIONAL {?episode wdt:P345 ?imdb}
    OPTIONAL {?episode p:P449 ?network . ?network pq:P585 ?wrongPub1}
    OPTIONAL {?episode wdt:P577 ?publication}
    OPTIONAL {?episode wdt:P1191 ?wrongPub2}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Marvel film series: German and US release dates compared[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?filmLabel ?germanRelease ?usRelease ((?usRelease-?germanRelease)AS ?diff) WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q642878 .
    ?series pq:P1545 ?ordinal .
  	?film p:P577 ?pub1 . ?pub1 pq:P291 wd:Q183 . ?pub1 v:P577 ?germanRelease . ?pub1 wikibase:rank ?rank1 FILTER (?rank1!=wikibase:DeprecatedRank) .
    ?film p:P577 ?pub2 . ?pub2 pq:P291 wd:Q30 . ?pub2 v:P577 ?usRelease . ?pub2 wikibase:rank ?rank2 FILTER (?rank2!=wikibase:DeprecatedRank)
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Film information[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?filmLabel (SAMPLE(?fskName) AS ?fsk) (SAMPLE(?duration) AS ?duration) (GROUP_CONCAT(DISTINCT(?genreName);separator=", ") AS ?genres) (SAMPLE(?release) AS ?release) ?imdb WHERE {
    VALUES ?film {wd:Q29470162 wd:Q23780914 wd:Q21877685 wd:Q27038847 wd:Q25431158 wd:Q54152472 wd:Q52790422 wd:Q24904727 wd:Q39070612 wd:Q23899399 wd:Q30302806 wd:Q39070972 wd:Q46013372 wd:Q27957941 wd:Q54859737 wd:Q52554791} .
    ?film wdt:P345 ?imdb .
    OPTIONAL {?film wdt:P2047 ?duration}
    OPTIONAL {?film wdt:P136 ?genre . ?genre rdfs:label ?genreName .  FILTER(lang(?genreName) = "de")}
    OPTIONAL {?film p:P577 ?release_statement . ?release_statement v:P577 ?release . ?release_statement pq:P291 wd:Q183}
    OPTIONAL {?film wdt:P1981 ?fsk . ?fsk rdfs:label ?fskName .  FILTER(lang(?fskName) = "de")}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?filmLabel ?imdb ?duration
ORDER BY ?duration
Try it!

Member states of the United Nations[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?nation ?nationLabel ?joining WHERE {
  ?nation p:P463 ?uno . ?uno v:P463 wd:Q1065 . ?uno pq:P580 ?joining 
  FILTER NOT EXISTS {?uno pq:P582 ?end}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?joining ?nationLabel
Try it!

Fields Medal winners grouped by age in year they received the Medal[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?age (COUNT(DISTINCT(?mathematician)) AS ?count)
{
SELECT ?mathematician ((YEAR(?awarded) - YEAR(?birth)) AS ?age) WHERE {
  ?mathematician p:P166 ?fields . ?fields v:P166 wd:Q28835 . ?fields pq:P585 ?awarded .
  ?mathematician wdt:P569 ?birth .
}
}
GROUP BY ?age
ORDER BY ?age
Try it!

Presidents of the United States with their wifes[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?ordinal ?presidentLabel (GROUP_CONCAT(?spouseName;separator=", ") AS ?spouses) (COUNT(?spouse) AS ?spouseCount) ?president WHERE {
  ?president wdt:P31 wd:Q5 .
  ?president p:P26 ?spouse_statement .
  ?spouse_statement v:P26 ?spouse .
  ?spouse rdfs:label ?spouseName .  FILTER(lang(?spouseName) = "en")
  ?president p:P39 ?presidentBlock . ?presidentBlock v:P39 wd:Q11696 . ?presidentBlock pq:P1545 ?ordinal .           
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
GROUP BY ?ordinal ?president ?presidentLabel
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Episodes of Mr. Bean[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?episode ?ordinal ?title ?publication ?firstPerformance ?duration ?imdb  WHERE {
    ?episode p:P179 ?series .
    ?series v:P179 wd:Q484020.
    ?series pq:P1545 ?ordinal .
    ?episode wdt:P345 ?imdb .
    ?episode wdt:P1476 ?title .
    OPTIONAL {?episode wdt:P2047 ?duration}
    OPTIONAL {?episode wdt:P577 ?publication}
  	OPTIONAL {?episode wdt:P1191 ?firstPerformance}
}
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Albums of Stefanie Heinzmann[edit]

SELECT ?album ?albumLabel ?release ?length WHERE {
  ?album wdt:P31/wdt:P279* wd:Q482994 .
  ?album wdt:P175 wd:Q4489 .
  OPTIONAL{?album wdt:P577 ?release} .
  OPTIONAL {?album wdt:P2047 ?length}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
} ORDER BY ?release
Try it!

Franz-Eberhofer-Filmreihe[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?filmLabel (SAMPLE(?duration) AS ?duration) ?imdb ((MIN(?pub)) AS ?publication) WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q28836231.
    ?series pq:P1545 ?ordinal .
    OPTIONAL {?film wdt:P345 ?imdb}
    OPTIONAL {?film wdt:P2047 ?duration}
  	OPTIONAL {?film wdt:P577 ?pub}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?filmLabel ?imdb ?ordinal
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Parteivorsitzende deutscher Parteien[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?partyLabel ?ordinal ?chairLabel ?start ?end ((?end-?start) AS ?days) WHERE {
  VALUES ?party {wd:Q49762 wd:Q49768 wd:Q49763 wd:Q49766 wd:Q6721203}
  ?party p:P488 ?chairStatement .
  ?chairStatement v:P488 ?chair .
  OPTIONAL{?chairStatement pq:P1545 ?ordinal}
  OPTIONAL{?chairStatement pq:P580 ?start}
  OPTIONAL{?chairStatement pq:P582 ?end}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?partyLabel ASC(xsd:integer(?ordinal)) ?start
Try it!

Academy Awards ceremonies[edit]

SELECT ?awardceremony ?edition ?awardceremonyLabel ?date (GROUP_CONCAT(DISTINCT(?location);separator=", ") AS ?locations) (GROUP_CONCAT(DISTINCT(?presenter);separator=", ") AS ?presenters) WHERE {
  ?awardceremony wdt:P31 wd:Q16913666 .
  ?awardceremony wdt:P585 ?date .
  ?awardceremony wdt:P393 ?edition .
  OPTIONAL{?awardceremony wdt:P371 ?pres . ?pres rdfs:label ?presenter . FILTER(lang(?presenter) = "en")}
  OPTIONAL{?awardceremony wdt:P276 ?loc . ?loc rdfs:label ?location . FILTER(lang(?location) = "en")}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
GROUP BY ?edition ?date ?awardceremony ?awardceremonyLabel
ORDER BY ?date
Try it!

Female names with prefix and fixed length[edit]

SELECT DISTINCT ?item ?name WHERE {
  ?item wdt:P31 ?sex .
  VALUES ?sex {wd:Q11879590 wd:Q3409032} .
  ?item rdfs:label ?name FILTER (lang(?name) = "en") . FILTER(STRLEN(?name)=5 && StrStarts(?name,"G"))
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
} ORDER BY ?name LIMIT 500
Try it!

Bates Motel[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?episode ?ordinal (CONCAT("S",?season,"E",?episodeInSeason) AS ?SE) ?usPublication ?dePublication ?title ?directorLabel ?duration ?imdb
WHERE {
    ?seasonQ p:P179 ?seriesBlock .
    ?seriesBlock v:P179 wd:Q323722 .
    ?seriesBlock pq:P1545 ?season .
    ?episode p:P4908 ?seasonBlock .
    ?seasonBlock v:P4908 ?seasonQ .
    ?seasonBlock pq:P1545 ?episodeInSeason .
    ?episode p:P179 ?seriesBlock2 . ?seriesBlock2 v:P179 wd:Q323722 . ?seriesBlock2 pq:P1545 ?ordinal .
    OPTIONAL {?episode wdt:P1476 ?title}
    OPTIONAL {?episode wdt:P2047 ?duration}
    OPTIONAL {?episode wdt:P345 ?imdb}
    OPTIONAL {?episode wdt:P57 ?director}
    OPTIONAL {?episode p:P577 ?publicationBlock1 . ?publicationBlock1 v:P577 ?usPublication . ?publicationBlock1 pq:P291 wd:Q30}
    OPTIONAL {?episode p:P577 ?publicationBlock2 . ?publicationBlock2 v:P577 ?dePublication . ?publicationBlock2 pq:P291 wd:Q183}
    SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
}
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Bates Motel directors[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (COUNT(?episode) AS ?episodes) ?directorLabel (MIN(xsd:integer(?ordinal)) AS ?firstEpisode) (MAX(xsd:integer(?ordinal)) AS ?lastEpisode) ?director
WHERE {
    ?episode p:P179 ?seriesBlock . ?seriesBlock v:P179 wd:Q323722 . ?seriesBlock pq:P1545 ?ordinal .
    ?episode wdt:P57 ?director
    SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
}
GROUP BY ?director ?directorLabel
ORDER BY DESC(?episodes) ?firstEpisode
Try it!

People on the moon[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?astronaut ?astronautLabel ?birth ?firstTimeOnMoon ?lastTimeOnMoon ?death ((?firstTimeOnMoon-?birth)/365.25 AS ?ageOnMoon) WHERE {
  ?astronaut wdt:P31 wd:Q5 .
  ?astronaut p:P793 ?moonwalk .
  ?moonwalk v:P793 wd:Q42882411 .
  ?moonwalk pq:P580 ?firstTimeOnMoon .
  ?moonwalk pq:P582 ?lastTimeOnMoon .
  ?astronaut wdt:P569 ?birth
  OPTIONAL{?astronaut wdt:P570 ?death}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
} ORDER BY ?firstTimeOnMoon ?lastTimeOnMoon ?birth
Try it!

Human Apollo space missions[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?mission ?missionLabel ?start (ROUND(?seconds/(24*6*6))/100 AS ?days) ?end ?mainPilotLabel ?commanderLabel ?lunarPilotLabel WHERE {
  ?mission wdt:P31 wd:Q752783 .
  ?mission wdt:P361 wd:Q46611 .
  ?mission wdt:P619 ?start .
  ?mission wdt:P620 ?end .
  ?mission wdt:P2047 ?seconds .
  ?mission p:P1029 ?mainPilotLabelBlock . ?mainPilotLabelBlock v:P1029 ?mainPilot . ?mainPilotLabelBlock pq:P39 wd:Q20114066 .
  ?mission p:P1029 ?commanderBlock . ?commanderBlock v:P1029 ?commander . ?commanderBlock pq:P39 wd:Q89585938 .
  ?mission p:P1029 ?lunarPilotBlock . ?lunarPilotBlock v:P1029 ?lunarPilot . ?lunarPilotBlock pq:P39 wd:Q20114009 .
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
} ORDER BY ?start
Try it!

Apollo astronauts[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?astronaut ?astronautLabel ?birth ?death (MIN(?start) AS ?firstMission) (GROUP_CONCAT(?missionName;separator=", ") AS ?missions) (COUNT(?mission) AS ?numberOfMissions) WHERE {
  ?mission wdt:P31 wd:Q752783 .
  ?mission wdt:P361 wd:Q46611 .
  ?mission wdt:P619 ?start .
  ?mission wdt:P620 ?end .
  ?mission rdfs:label ?missionName . FILTER(lang(?missionName) = "en") .
  ?mission wdt:P1029 ?astronaut .
  ?astronaut wdt:P569 ?birth
  OPTIONAL{?astronaut wdt:P570 ?death}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
GROUP BY ?astronaut ?astronautLabel ?birth ?death
ORDER BY ?firstMission
Try it!

Minister Presidents of German states[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?president ?stateLabel ?presidentLabel ?start ?end WHERE {
  ?president p:P39 ?position .
  OPTIONAL{?position pq:P580 ?start}
  OPTIONAL{?position pq:P582 ?end}
  ?position v:P39 ?positionItem .
  ?positionItem wdt:P279 wd:Q23833126 .
  ?positionItem wdt:P1001 ?state
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
} ORDER BY ?stateLabel ?start
Try it!

Current Minister Presidents of German states[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?president ?stateLabel ?presidentLabel ?birthday ?since (FLOOR(NOW()-?since) AS ?daysInOffice) WHERE {
  ?president p:P39 ?position .
  ?president wdt:P569 ?birthday .
  ?position pq:P580 ?since
  FILTER NOT EXISTS {?position pq:P582 ?end}
  ?position v:P39 ?positionItem .
  ?positionItem wdt:P279 wd:Q23833126 .
  ?positionItem wdt:P1001 ?state
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
} ORDER BY ?daysInOffice
Try it!

German states with their capitals, area and population[edit]

SELECT ?state ?key ?stateLabel (ROUND(?areaUnrounded) AS ?area) ?population (ROUND(?population/?area) AS ?populationDensity) ?capitalLabel ?capitalPopulation (ROUND(1000*?capitalPopulation/?population)/10 AS ?ratio) WHERE {
#(ROUND(?population/10000)/100 AS ?pop)
  ?state wdt:P31 wd:Q1221156 .
  ?state wdt:P1388 ?key .
  ?state wdt:P1082 ?population .
  ?state wdt:P2046 ?areaUnrounded .
  OPTIONAL{?state wdt:P36 ?capital . ?capital wdt:P1082 ?capitalPopulation}
  FILTER NOT EXISTS {?state wdt:P576 ?end} .
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?stateLabel
Try it!

Municipalities in Hesse[edit]

PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?muni ?key ?muniLabel ?ruralLabel ?instanceLabel ?population WHERE {
  {
    VALUES ?instance {wd:Q42744322 wd:Q116457956} .
    ?muni wdt:P131 ?rural . ?rural wdt:P31 wd:Q61980413 .
    ?muni p:P31 ?instanceBlock . ?instanceBlock v:P31 ?instance .
  }
  UNION
  {
    VALUES ?instance {wd:Q61980648} .
    ?muni p:P31 ?instanceBlock . ?instanceBlock v:P31 ?instance
  }
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end}
  ?muni wdt:P1082 ?population .
  OPTIONAL{?muni wdt:P439 ?key}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

The 294 rurals of Germany with number of municipalities[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?rural ?key ?ruralLabel ?classLabel (COUNT(?muni) AS ?munis) WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end}
  ?muni wdt:P131 ?rural .
  ?rural wdt:P31 ?class .
  ?rural wdt:P440 ?key .
  ?class wdt:P279 wd:Q106658
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?rural ?key ?ruralLabel ?classLabel
ORDER BY ?key
Try it!

Rural municipalities in Baden-Württemberg[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?key ?muniLabel ?ruralLabel ?instanceLabel ?population WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni wdt:P131 ?rural . ?rural wdt:P31 wd:Q20738676 .
  ?muni p:P31 ?instanceBlock . ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P1082 ?population .
  OPTIONAL{?muni wdt:P439 ?key}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

The 10795 municipalities in Germany[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?muni ?key ?muniLabel WHERE {
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  {?instance wdt:P279+ wd:Q262166} UNION {BIND (wd:Q262166 AS ?instance)}
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P439 ?key
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

Number of German municipalities by state[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (?prefix AS ?key) ?stateLabel (COUNT(?key) AS ?count) WHERE{
SELECT DISTINCT ?stateLabel ?muni ?prefix ?key WHERE {
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  {?instance wdt:P279+ wd:Q262166} UNION {BIND (wd:Q262166 AS ?instance)}
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P439 ?key .
  BIND (SUBSTR(?key,1,2) AS ?prefix) .
  ?state wdt:P1388 ?prefix
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
}
GROUP BY ?prefix ?stateLabel
ORDER BY ?stateLabel
Try it!

District classes for states[edit]

SELECT  ?class ?classLabel ?stateLabel (COUNT(?rural) AS ?count) WHERE {
  ?class wdt:P279 wd:Q106658 .
  ?class wdt:P1001 ?state .
  ?rural wdt:P31 ?class .
  FILTER NOT EXISTS {?rural wdt:P576 ?dissolved}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?class ?classLabel ?stateLabel
ORDER BY ?stateLabel
Try it!

Municipalities of one rural[edit]

PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT DISTINCT ?muni ?key ?muniLabel ?instanceLabel ?population ?area WHERE {
  VALUES ?rural {wd:Q7917}
  ?muni wdt:P131 ?rural .
  VALUES ?instance {wd:Q116457956 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  OPTIONAL{?muni wdt:P1082 ?population}
  OPTIONAL{?muni wdt:P2046 ?area}
  ?muni wdt:P439 ?key
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

German rurals yet directely marked as rural district of Germany[edit]

SELECT  ?rural ?key ?ruralLabel WHERE {
  ?rural wdt:P31 wd:Q106658 .
  ?rural wdt:P440 ?key .
  FILTER NOT EXISTS {?rural wdt:P576 ?dissolved}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

German rurals without capital yet[edit]

SELECT ?rural ?key ?ruralLabel ?classLabel WHERE {
  ?class wdt:P279 wd:Q106658 .
  ?rural wdt:P31 ?class .
  ?rural wdt:P440 ?key .
  FILTER NOT EXISTS {?rural wdt:P36 ?capital}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

Number of German municipalities[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (COUNT(?muni) AS ?numberOfGermanMunicipalities) WHERE{
SELECT DISTINCT ?muni WHERE {
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  {?instance wdt:P279+ wd:Q262166} UNION {BIND (wd:Q262166 AS ?instance)}
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end}
  ?muni wdt:P439 ?key
}
}
Try it!

German rural municipalities without a rural yet[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT DISTINCT ?muni ?key ?muniLabel ?ruralKey ?ruralLabel WHERE {
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  {?instance wdt:P279+ wd:Q262166} UNION {BIND (wd:Q262166 AS ?instance)}
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P439 ?key .
  BIND(SUBSTR(?key,1,5) AS ?ruralKey) .
  ?rural wdt:P440 ?ruralKey .
  FILTER NOT EXISTS {?muni wdt:P131 ?rural}
  FILTER NOT EXISTS {?muni wdt:P31 wd:Q22865}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

Instance types of German municipalities[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?instance ?instanceLabel (COUNT(?muni) AS ?count) WHERE{
SELECT DISTINCT ?muni ?instance ?instanceLabel WHERE {
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  {?instance wdt:P279+ wd:Q262166} UNION {BIND (wd:Q262166 AS ?instance)}
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end}
  ?muni wdt:P439 ?key
        SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
}
GROUP BY ?instance ?instanceLabel
ORDER BY DESC(?count)
Try it!

The 107 independent cities of Germany with state and population[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?city ?key ?cityLabel ?population ?popdate ?classLabel ?stateLabel  WHERE{
  ?class wdt:P279 wd:Q22865 .
  ?city wdt:P31 ?class .
  ?class wdt:P131 ?state .
  ?city wdt:P439 ?key .
  ?city p:P1082 ?pop .
  ?pop v:P1082 ?population .
  ?pop wikibase:rank wikibase:PreferredRank .
  ?pop pq:P585 ?popdate
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?stateLabel DESC(?population)
Try it!

German states with number of urban districts[edit]

SELECT ?class ?classLabel ?stateLabel (COUNT(?city) AS ?count) WHERE{
  ?class wdt:P279 wd:Q22865 .
  ?city wdt:P31 ?class .
  ?class wdt:P131 ?state
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?class ?classLabel ?stateLabel
ORDER BY ?stateLabel ?classLabel ?cityLabel
Try it!

The 294 German rurals with capital[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?rural ?key ?ruralLabel ?classLabel ?capitalLabel ?capital WHERE {
  ?rural p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?class .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?class wdt:P279 wd:Q106658 .
  ?rural wdt:P440 ?key .
  ?rural wdt:P36 ?capital
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

Number of German urban municipalities by state[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (?prefix AS ?key) ?stateLabel (COUNT(?key) AS ?count) WHERE{
SELECT DISTINCT ?stateLabel ?muni ?prefix ?key WHERE {
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 wd:Q42744322 .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P439 ?key .
  BIND (SUBSTR(?key,1,2) AS ?prefix) .
  ?state wdt:P1388 ?prefix
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
}
GROUP BY ?prefix ?stateLabel
ORDER BY DESC(?count) ?stateLabel
Try it!

The 10795 municipalities in Germany – version 2[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?key ?muniLabel ?instanceLabel WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  ?muni wdt:P439 ?key
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

Municipalities in Germany with number of population statements[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?muniLabel ?instanceLabel (COUNT(?population) AS ?popCount) WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P1082 ?population
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?muni ?muniLabel ?instanceLabel
ORDER BY DESC(?popCount) ?muniLabel
Try it!

Municipalities in Germany without population[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?muniLabel ?instanceLabel WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  FILTER NOT EXISTS {?muni wdt:P1082 ?population}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?muniLabel
Try it!

Municipalities in Germany without preferred population[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?muniLabel ?instanceLabel WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  FILTER NOT EXISTS{
  ?muni p:P1082 ?populationBlock .
  ?populationBlock wikibase:rank wikibase:PreferredRank}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?muniLabel
Try it!

Population of Germany grouped by municipality type[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?instanceLabel (SUM(?population) AS ?pop) (COUNT(?muni) AS ?count) WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni wdt:P1082 ?population
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?instance ?instanceLabel
ORDER BY ?instanceLabel
Try it!

German municipalities with population at December 31, 2017[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?key ?muniLabel ?instanceLabel ?population WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni wdt:P439 ?key .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni p:P1082 ?populationBlock .
  ?populationBlock v:P1082 ?population .
  ?populationBlock wikibase:rank wikibase:PreferredRank .
  ?populationBlock pq:P585 "2017-12-31"^^xsd:dateTime
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

German municipalities grouped by population date[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?populationDate (COUNT(?muni) as ?count) WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni p:P1082 ?populationBlock .
  ?populationBlock v:P1082 ?population .
  ?populationBlock wikibase:rank wikibase:PreferredRank .
  ?populationBlock pq:P585 ?populationDate
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?populationDate
ORDER BY DESC(?count) ?populationDate
Try it!

German municipalities with old last population update[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?key ?popDate WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni p:P31 ?instanceBlock . 
  ?muni wdt:P439 ?key .
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni p:P1082 ?populationBlock .
  ?populationBlock v:P1082 ?population .
  ?populationBlock wikibase:rank wikibase:PreferredRank .
  ?populationBlock pq:P585 ?popDate FILTER(?popDate < "2017-12-31"^^xsd:dateTime)
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

German municipalities with population and population date[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?key ?muniLabel ?population ?popDate ?instanceLabel WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni wdt:P439 ?key .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  ?muni p:P1082 ?populationBlock .
  ?populationBlock v:P1082 ?population .
  ?populationBlock wikibase:rank wikibase:PreferredRank .
  ?populationBlock pq:P585 ?popDate
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

German municipalities without current population[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?muni ?key ?muniLabel ?instanceLabel WHERE {
  VALUES ?instance {wd:Q262166 wd:Q42744322} .
  ?muni wdt:P439 ?key .
  ?muni p:P31 ?instanceBlock . 
  ?instanceBlock v:P31 ?instance .
  FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
  FILTER NOT EXISTS {
    ?muni p:P1082 ?populationBlock .
    ?populationBlock v:P1082 ?population .
    ?populationBlock wikibase:rank wikibase:PreferredRank .
    ?populationBlock pq:P585 "2019-09-30"^^xsd:dateTime
  }
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?key
Try it!

The 193 United Nations member states[edit]

PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?state ?code ?stateLabel (GROUP_CONCAT(DISTINCT(?capitalName);separator="; ") AS ?capitals) (GROUP_CONCAT(DISTINCT(?continentName);separator="; ") AS ?continents) ?start WHERE {
  ?state p:P463 ?memberBlock . 
  ?memberBlock v:P463 wd:Q1065 .
  ?memberBlock pq:P580 ?start .
  #?memberBlock pq:P582 ?end .
  FILTER NOT EXISTS {?memberBlock pq:P582 ?end} .
  ?state wdt:P36 ?capital . ?capital rdfs:label ?capitalName . FILTER(lang(?capitalName) = "de") .
  ?state wdt:P30 ?continent . ?continent rdfs:label ?continentName . FILTER(lang(?continentName) = "de") .
  OPTIONAL{?state wdt:P298 ?code}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?state ?stateLabel ?start ?code
ORDER BY ?start ?stateLabel
Try it!

The 50 United States[edit]

PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?ordinal ?state ?iso ?stateLabel ?capitalLabel ?joining ?inception WHERE {
  ?state p:P31 ?stateBlock . 
  ?stateBlock v:P31 wd:Q35657 .
  OPTIONAL {?stateBlock pq:P1545 ?ordinal} .
  OPTIONAL {?stateBlock pq:P580 ?joining} .
  #?memberBlock pq:P580 ?start .
  ?state wdt:P571 ?inception .
  ?state wdt:P36 ?capital .
  ?state wdt:P300 ?iso
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
ORDER BY ?iso
Try it!

The 25 EON James Bond movies[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ((MIN(YEAR(?pub))) AS ?year) ?actorLabel ((?year-YEAR(?birthday)) AS ?age) ?title ?filmLabel (GROUP_CONCAT(DISTINCT(?directorName);separator=", ") AS ?director) (SAMPLE(?duration) AS ?duration) ((MIN(?pub)) AS ?publication) ?imdb WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q26451486.
    ?series pq:P1545 ?ordinal .
    ?film p:P161 ?bond . ?bond pq:P453 wd:Q2009573 . ?bond v:P161 ?actor . FILTER(?actor != wd:Q888254)
    ?actor wdt:P569 ?birthday .
    ?film wdt:P345 ?imdb .
    ?film wdt:P1476 ?title .
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?directorName .  FILTER(lang(?directorName) = "en")} .  
    OPTIONAL {?film wdt:P2047 ?duration}
  	OPTIONAL {?film wdt:P577 ?pub}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?filmLabel ?imdb ?ordinal ?title ?actor ?actorLabel ?birthday
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Jurassic Park film series[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?title ?filmLabel (SAMPLE(?duration) AS ?duration) ((MIN(?pub)) AS ?publication) ?directorLabel ?imdb WHERE {
    ?film p:P179 ?series .
    ?series v:P179 wd:Q17862144.
    ?series pq:P1545 ?ordinal .
    ?film wdt:P1476 ?title .
    ?film wdt:P345 ?imdb .
    ?film wdt:P57 ?director
    OPTIONAL {?film wdt:P2047 ?duration}
  	OPTIONAL {?film wdt:P577 ?pub}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?film ?title ?filmLabel ?imdb ?ordinal ?director ?directorLabel
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Tatort episodes by year[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?year (COUNT(?ordinal) AS ?count) WHERE {

SELECT ?ordinal (MIN(?publication) AS ?pub) (YEAR(?pub) AS ?year) WHERE {
	?film p:P179 ?series . ?series v:P179 wd:Q689438 . ?series pq:P1545 ?ordinal . FILTER(xsd:integer(?ordinal)<10000)
  	?film wdt:P577 ?publication
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?ordinal
}
GROUP BY ?year
ORDER BY ?year
Try it!

Tatort episode labels[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?film ?ordinal ?title ?deLabel ?enLabel WHERE {
	?film p:P179 ?series . ?series v:P179 wd:Q689438 . ?series pq:P1545 ?ordinal . FILTER(xsd:integer(?ordinal)<10000)
    OPTIONAL{?film wdt:P1476 ?title}
    OPTIONAL{?film rdfs:label ?deLabel . FILTER(lang(?deLabel) = "de")}
    OPTIONAL{?film rdfs:label ?enLabel . FILTER(lang(?enLabel) = "en")}
}
ORDER BY DESC(xsd:integer(?ordinal))
Try it!

Tatort episodes with Batic and Leitmayr[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT (MIN(?publication) AS ?aired) ?case ?ordinal ?film ?title (GROUP_CONCAT(DISTINCT(?screenwriter);separator=", ") AS ?screenwriters) (GROUP_CONCAT(DISTINCT(?director);separator=", ") AS ?directors) (SAMPLE(?runtime) AS ?runtime) (SAMPLE(?imdb) AS ?imdb) WHERE {
	?film p:P179 ?series . ?series v:P179 wd:Q689438 . ?series pq:P1545 ?ordinal .
    ?film p:P179 ?batic . ?batic v:P179 wd:Q110737643 . ?batic pq:P1545 ?case .
    ?film wdt:P1476 ?title
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?director .  FILTER(lang(?director) = "de")}
    OPTIONAL{?film wdt:P58 ?screen . ?screen rdfs:label ?screenwriter .  FILTER(lang(?screenwriter) = "de")}
    OPTIONAL{?film wdt:P345 ?imdb}
  	OPTIONAL{?film wdt:P577 ?publication}
    OPTIONAL{?film wdt:P2047 ?runtime}
}
GROUP BY ?film ?title ?ordinal ?case
ORDER BY ASC(xsd:integer(?ordinal))
Try it!

Tatort with team[edit]

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?tatortWithLabel (MIN(?publication) AS ?aired) ?case ?ordinal ?film ?title (GROUP_CONCAT(DISTINCT(?screenwriter);separator=", ") AS ?screenwriters) (GROUP_CONCAT(DISTINCT(?director);separator=", ") AS ?directors) (SAMPLE(?runtime) AS ?runtime) (SAMPLE(?imdb) AS ?imdb) WHERE {
	?tatortWith wdt:P31 wd:Q5398426 . ?tatortWith wdt:P361 wd:Q689438 .
	?film p:P179 ?series . ?series v:P179 wd:Q689438 . ?series pq:P1545 ?ordinal .
    ?film p:P179 ?team . ?team v:P179 ?tatortWith . ?team pq:P1545 ?case .
    ?film wdt:P1476 ?title
    OPTIONAL{?film wdt:P57 ?dir . ?dir rdfs:label ?director . FILTER(lang(?director) = "de")}
    OPTIONAL{?film wdt:P58 ?screen . ?screen rdfs:label ?screenwriter . FILTER(lang(?screenwriter) = "de")}
    OPTIONAL{?film wdt:P345 ?imdb}
  	OPTIONAL{?film wdt:P577 ?publication}
    OPTIONAL{?film wdt:P2047 ?runtime}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
GROUP BY ?tatortWith ?tatortWithLabel ?film ?title ?ordinal ?case
ORDER BY ?tatortWithLabel ASC(xsd:integer(?case))
Try it!

Amazon Prime without German article[edit]

SELECT ?film ?filmLabel ?instanceLabel ?amazon WHERE {
  ?film wdt:P8055 ?amazon .
  ?film wdt:P31 ?instance .
  ?instance wdt:P279* wd:Q11424 .
  OPTIONAL { ?article schema:about ?film . ?article schema:inLanguage "de" } FILTER(!bound(?article))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" }
}
ORDER BY ?filmLabel
Try it!

Mountains in the Odenwald[edit]

SELECT ?mountain ?mountainLabel ?height ?isolation ?prominence ?territorialEntityLabel WHERE {
  ?mountain wdt:P31 wd:Q8502 .
  OPTIONAL{?mountain wdt:P131 ?territorialEntity}
  OPTIONAL{?mountain wdt:P2044 ?height}
  ?mountain wdt:P4552 wd:Q8359 .
  OPTIONAL{?mountain wdt:P2659 ?isolation}
  OPTIONAL{?mountain wdt:P2660 ?prominence}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" }
}
ORDER BY DESC(?height) ?mountainLabel
Try it!

Ukrainians who died in 2022[edit]

SELECT ?ukrainian ?ukrainianLabel ?birth ?death ?mannerLabel ?causeLabel WHERE {
  ?ukrainian wdt:P31 wd:Q5 .
  ?ukrainian wdt:P27 wd:Q212 .
  OPTIONAL{?ukrainian wdt:P569 ?birth}
  ?ukrainian wdt:P570 ?death FILTER(year(?death)=2022) .
  OPTIONAL{?ukrainian wdt:P1196 ?manner}
  OPTIONAL{?ukrainian wdt:P509 ?cause}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
} ORDER BY DESC(?death) DESC(?birth)
Try it!

Video games for the Super Nintendo Entertainment System[edit]

SELECT ?game ?gameLabel ?publication WHERE {
  ?game wdt:P31 wd:Q7889 .
  ?game wdt:P400 wd:Q183259 .
  ?game wdt:P577 ?publication .
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
} ORDER BY ?publication ?gameLabel
Try it!

Species with their genus, family and order[edit]

SELECT ?species ?taxonName ?speciesLabel ?genusLabel ?familyLabel ?orderLabel ?order WHERE {
  VALUES ?species {wd:Q146149 wd:Q165145 wd:Q145992 wd:Q133128 wd:Q158776 wd:Q26899 wd:Q22699 wd:Q156895 wd:Q26745 wd:Q158746 wd:Q156831}
  ?species wdt:P105 wd:Q7432 .
  ?species wdt:P225 ?taxonName .
  ?species wdt:P171* ?genus .
  ?genus wdt:P105 wd:Q34740 .
  ?genus wdt:P171* ?family .
  ?family wdt:P105 wd:Q35409 .
  ?family wdt:P171* ?order .
  ?order wdt:P105 wd:Q36602 .
  SERVICE wikibase:label {bd:serviceParam wikibase:language "de"}
  FILTER(?order NOT IN (wd:Q14107023))
  FILTER(?family NOT IN (wd:Q1450881))
}
ORDER BY ?orderLabel ?familyLabel ?genusLabel ?speciesLabel
Try it!

Persons by birthday and number of letters in name[edit]

SELECT ?person ?personLabel ?actualName ?length ?birthday ?article WHERE {
  ?person wdt:P31 wd:Q5 .
  ?person wdt:P569 ?birthday . FILTER(?birthday = "1976-10-19"^^xsd:dateTime)
  ?person wdt:P735 ?name .        
  ?name rdfs:label ?actualName . FILTER(lang(?actualName) = "en") .
  BIND(STRLEN(?actualName) AS ?length) FILTER(?length = 4)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
  ?article schema:about ?person . ?article schema:isPartOf <https://de.wikipedia.org/>
}
ORDER BY ?actualName
Try it!

50 US states with border states[edit]

SELECT ?state ?iso ?stateLabel (GROUP_CONCAT(DISTINCT(?borderIso);separator=", ") AS ?borderStates) (COUNT(?borderState) AS ?count) WHERE {
  ?state wdt:P31 wd:Q35657 . ?state wdt:P300 ?iso .
  OPTIONAL{?state wdt:P47 ?borderState . ?borderState wdt:P31 wd:Q35657 . ?borderState wdt:P300 ?borderIso}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
GROUP BY ?state ?stateLabel ?iso
ORDER BY ?iso
Try it!

The 16 federated states of Germany[edit]

SELECT ?state ?stateLabel ?capitalLabel WHERE {
  ?state wdt:P31 wd:Q1221156 .
  OPTIONAL{?state wdt:P36 ?capital}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
}
ORDER BY ?stateLabel
Try it!

The 13 provinces and territories of Canada[edit]

SELECT ?pot ?potLabel ?capitalLabel WHERE {
  ?pot wdt:P31 ?provinceOrTerritory .
  VALUES ?provinceOrTerritory {wd:Q11828004 wd:Q9357527}
  ?pot wdt:P36 ?capital
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?potLabel
Try it!

Body mass index of human beings[edit]

SELECT ?human ?mass ?height (?mass/(?height*?height) AS ?bmi) WHERE {
  ?human wdt:P31 wd:Q5 .
  ?human wdt:P2067 ?mass .
  ?human wdt:P2048 ?height
}
ORDER BY ?bmi ?height
Try it!

20 regions of Italy[edit]

SELECT ?region ?nuts ?regionLabel ?capitalLabel ?regionTypeLabel WHERE {
  ?region wdt:P31 ?regionType .
  ?regionType wdt:P279* wd:Q16110 .
  ?region wdt:P605 ?nuts . FILTER(STRLEN(?nuts)=4) .
  ?region wdt:P36 ?capital
  SERVICE wikibase:label{bd:serviceParam wikibase:language "it"}
}
ORDER BY ?nuts
Try it!

27 member states of the European Union[edit]

PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?state ?stateLabel ?capitalLabel ?start WHERE {
  ?state p:P463 ?memberBlock . 
  ?memberBlock v:P463 wd:Q458 .
  ?memberBlock pq:P580 ?start .
  #?memberBlock pq:P582 ?end .
  FILTER NOT EXISTS {?memberBlock pq:P582 ?end} .
  ?state wdt:P36 ?capital
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
ORDER BY ?start ?stateLabel
Try it!

56 member states of the Commonwealth of Nations[edit]

PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?state ?code ?stateLabel (GROUP_CONCAT(DISTINCT(?capitalName);separator="; ") AS ?capitals) (GROUP_CONCAT(DISTINCT(?continentName);separator="; ") AS ?continents) ?start WHERE {
  ?state p:P463 ?memberBlock . 
  ?memberBlock v:P463 wd:Q7785 .
  ?memberBlock pq:P580 ?start .
  #?memberBlock pq:P582 ?end .
  FILTER NOT EXISTS {?memberBlock pq:P582 ?end} .
  ?state wdt:P36 ?capital . ?capital rdfs:label ?capitalName . FILTER(lang(?capitalName) = "en") .
  ?state wdt:P30 ?continent . ?continent rdfs:label ?continentName . FILTER(lang(?continentName) = "en") .
  OPTIONAL{?state wdt:P298 ?code}
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
GROUP BY ?state ?stateLabel ?start ?code
ORDER BY ?continents ?code
Try it!

States and territories of Australia with capital[edit]

SELECT DISTINCT ?sOt ?sOtTypeLabel ?sOtLabel ?capitalLabel WHERE {
  ?sOt wdt:P31 ?sOtType .
  ?sOtType wdt:P279* wd:Q178712 .
  ?sOt wdt:P36 ?capital
  FILTER NOT EXISTS {?sOt wdt:P576 ?dissolved}
  FILTER(?sOtType NOT IN (wd:Q14192199))
  SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}
}
ORDER BY ?sOtTypeLabel ?sOt ?sOtLabel
Try it!