Total: 446 Cats SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Goats SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q2934. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Horses (showing a few info about them) #Illustrates optional fields, instances of subclasses, language fallback on label service, date to year conversion #Horses on Wikidata SELECT DISTINCT ?horse ?horseLabel ?mother ?father (year(?birthdate) as ?birthyear) (year(?deathdate) as ?deathyear) ?genderLabel WHERE { ?cheval wdt:P31/wdt:P279* wd:Q726 . # Instance et sous-classes de Q726-Cheval OPTIONAL{?cheval wdt:P25 ?mother .} # P25 : Mère OPTIONAL{?cheval wdt:P22 ?father .} # P22 : Père OPTIONAL{?cheval wdt:P569 ?birthdate .} # P569 : Date de naissance OPTIONAL{?cheval wdt:P570 ?deathdate .} # P570 : Date de décès OPTIONAL{?cheval wdt:P21 ?gender .} # P21 : Sexe SERVICE wikibase:label { #BabelRainbow bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,ar,be,bg,bn,ca,cs,da,de,el,en,es,et,fa,fi,he,hi,hu,hy,id,it,ja,jv,ko,nb,nl,eo,pa,pl,pt,ro,ru,sh,sk,sr,sv,sw,te,th,tr,uk,yue,vec,vi,zh" } } ORDER BY ?horse Cats, with pictures #added before 2016-10 #defaultView:ImageGrid SELECT ?item ?itemLabel ?pic WHERE { ?item wdt:P31 wd:Q146 . ?item wdt:P18 ?pic SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Map of hospitals #added before 2016-10 #defaultView:ImageGrid SELECT ?item ?itemLabel ?pic WHERE { ?item wdt:P31 wd:Q146 . ?item wdt:P18 ?pic SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Humans without children #added before 2016-10 #Demonstrates "no value" handling SELECT ?human ?humanLabel WHERE { ?human wdt:P31 wd:Q5 . #find humans ?human rdf:type wdno:P40 . #with at least one P40 (child) statement defined to be "no value" SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Humans without children SELECT ?human ?humanLabel WHERE { ?human wdt:P31 wd:Q5 . #find humans ?human p:P40 ?childStatement . #with at least one P40 (child) statement ?childStatement rdf:type wdno:P40 . #where the P40 (child) statement is defined to be "no value" SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } Items with a Wikispecies sitelink #added before 2016-10 #illustrates sitelink selection, ";" notation SELECT ?item ?itemLabel ?article WHERE { ?article schema:about ?item ; schema:isPartOf . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } LIMIT 200 Items about authors with a Wikispecies page SELECT ?author ?authorLabel (COUNT(?paper) AS ?count) WHERE { ?article schema:about ?author ; schema:isPartOf . ?author wdt:P31 wd:Q5. ?paper wdt:P50 ?author. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?author ?authorLabel ORDER BY DESC(?count) LIMIT 200 Recent Events SELECT ?author ?authorLabel (COUNT(?paper) AS ?count) WHERE { ?article schema:about ?author ; schema:isPartOf . ?author wdt:P31 wd:Q5. ?paper wdt:P50 ?author. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?author ?authorLabel ORDER BY DESC(?count) LIMIT 200 Popular eye colors #added before 2016-10 #illustrates bubblechart view, count #defaultView:BubbleChart SELECT ?eyeColorLabel (COUNT(?person) AS ?count) WHERE { ?person wdt:P1340 ?eyeColor. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?eyeColorLabel People whose gender we know we don't know #added before 2016-10 # Demonstrates filtering for "unknown value" SELECT ?human ?humanLabel WHERE { ?human wdt:P21 ?gender FILTER isBLANK(?gender) . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } URLs of Wikipedia in all languages PREFIX schema: SELECT ?sitelink WHERE { BIND(wd:Q52 AS ?wikipedia) ?sitelink schema:about ?wikipedia . FILTER REGEX(STR(?sitelink), ".wikipedia.org/wiki/") . } Largest cities with female mayor #added before 2016-10 #TEMPLATE={"template":"Largest ?c with ?sex head of government","variables":{"?sex":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q48264 . } "},"?c":{"query":"SELECT DISTINCT ?id WHERE { ?c wdt:P31 ?id. ?c p:P6 ?mayor. }"} } } SELECT DISTINCT ?city ?cityLabel ?mayor ?mayorLabel WHERE { BIND(wd:Q6581072 AS ?sex) BIND(wd:Q515 AS ?c) ?city wdt:P31/wdt:P279* ?c . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 ?sex . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier # Now select the population value of the ?city # (wdt: properties use only statements of "preferred" rank if any, usually meaning "current population") ?city wdt:P1082 ?population . # Optionally, find English labels for city and mayor: SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY DESC(?population) LIMIT 10 List of countries ordered by the number of their cities with female mayor #added before 2016-10 SELECT ?country ?countryLabel (count(*) AS ?count) WHERE { ?city wdt:P31/wdt:P279* wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city # If available, get the "ru" label of the country, use "en" as fallback: SERVICE wikibase:label { bd:serviceParam wikibase:language "ru,en" . } } GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 Popular surnames among humans #added before 2016-10 #defaultView:BubbleChart SELECT ?surname ?surnameLabel ?count WHERE { { SELECT ?surname (COUNT(?person) AS ?count) WHERE { ?person wdt:P31 wd:Q5. ?person wdt:P734 ?surname. } GROUP BY ?surname } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count) LIMIT 100 Given names with most variations #added before 2016-10 SELECT ?name (COUNT(?otherName) AS ?count) WHERE { ?name wdt:P31 wd:Q202444; wdt:P460 ?otherName. } GROUP BY ?name ORDER BY DESC(?count) LIMIT 10 Popular surnames among fictional characters #added before 2016-10 #defaultView:BubbleChart SELECT ?surname ?surnameLabel ?count WHERE { { SELECT ?surname (COUNT(?person) AS ?count) WHERE { ?person (wdt:P31/wdt:P279*) wd:Q95074. ?person wdt:P734 ?surname. } GROUP BY ?surname } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count) LIMIT 100 Women with most sitelinks and no image born in 1921 or later SELECT ?s ?desc ?linkcount WHERE { ?s wdt:P31 wd:Q5 ; # human wdt:P21 wd:Q6581072 ; # gender: female wdt:P569 ?born . FILTER (?born >= "1921-01-01T00:00:00Z"^^xsd:dateTime) . ?s wikibase:sitelinks ?linkcount . MINUS { ?s wdt:P18 [] # exclude if there is an image } ?s rdfs:label ?desc FILTER(lang(?desc)="en"). } GROUP BY ?s ?desc ?linkcount ORDER BY DESC(?linkcount) LIMIT 50 Whose birthday is today? #Whose birthday is today? SELECT ?entityLabel (YEAR(?date) as ?year) WHERE { BIND(MONTH(NOW()) AS ?nowMonth) BIND(DAY(NOW()) AS ?nowDay) ?entity wdt:P569 ?date . FILTER (MONTH(?date) = ?nowMonth && DAY(?date) = ?nowDay) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } LIMIT 10 Finding John and Sarah Connor #Whose birthday is today? SELECT ?entityLabel (YEAR(?date) as ?year) WHERE { BIND(MONTH(NOW()) AS ?nowMonth) BIND(DAY(NOW()) AS ?nowDay) ?entity wdt:P569 ?date . FILTER (MONTH(?date) = ?nowMonth && DAY(?date) = ?nowDay) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } LIMIT 10 Data of Douglas Adams #added before 2016-10 PREFIX entity: #partial results SELECT ?propUrl ?propLabel ?valUrl ?valLabel ?picture WHERE { hint:Query hint:optimizer 'None' . { BIND(entity:Q42 AS ?valUrl) . BIND("N/A" AS ?propUrl ) . BIND("identity"@en AS ?propLabel ) . } UNION { entity:Q42 ?propUrl ?valUrl . ?property ?ref ?propUrl . ?property rdf:type wikibase:Property . ?property rdfs:label ?propLabel } ?valUrl rdfs:label ?valLabel FILTER (LANG(?valLabel) = 'en') . OPTIONAL{ ?valUrl wdt:P18 ?picture .} FILTER (lang(?propLabel) = 'en' ) } ORDER BY ?propUrl ?valUrl LIMIT 200 Data of Douglas Adams (modified version) PREFIX entity: # In addition to the original query this one comes with some advantages: # - You will get only literals as results, (even if the values are stored as IRI in wikibase) # - That means you will also get properties as birth date, alphanumeric identifier and so on. # - The list is ordered numerically by property number. (So P19 comes before P100) # - All label, altLabel and description in a given Language are included. # You may open a separate column ?valUrl if you need also the IRI # # Please advise, if there is an option to put the Q-Number and/or the Language # code into a runtime variable. SELECT ?propNumber ?propLabel ?val WHERE { hint:Query hint:optimizer 'None' . { BIND(entity:Q42 AS ?valUrl) . BIND("N/A" AS ?propUrl ) . BIND("Name"@de AS ?propLabel ) . entity:Q42 rdfs:label ?val . FILTER (LANG(?val) = "de") } UNION { BIND(entity:Q42 AS ?valUrl) . BIND("AltLabel"@de AS ?propLabel ) . optional{entity:Q42 skos:altLabel ?val}. FILTER (LANG(?val) = "de") } UNION { BIND(entity:Q42 AS ?valUrl) . BIND("Beschreibung"@de AS ?propLabel ) . optional{entity:Q42 schema:description ?val}. FILTER (LANG(?val) = "de") } UNION { entity:Q42 ?propUrl ?valUrl . ?property ?ref ?propUrl . ?property rdf:type wikibase:Property . ?property rdfs:label ?propLabel. FILTER (lang(?propLabel) = 'de' ) filter isliteral(?valUrl) BIND(?valUrl AS ?val) } UNION { entity:Q42 ?propUrl ?valUrl . ?property ?ref ?propUrl . ?property rdf:type wikibase:Property . ?property rdfs:label ?propLabel. FILTER (lang(?propLabel) = 'de' ) filter isIRI(?valUrl) ?valUrl rdfs:label ?valLabel FILTER (LANG(?valLabel) = "de") BIND(CONCAT(?valLabel) AS ?val) } BIND( SUBSTR(str(?propUrl),38, 250) AS ?propNumber) } ORDER BY xsd:integer(?propNumber) WWII battle durations #defaultView:BubbleChart SELECT DISTINCT ?item ?itemLabel (?end - ?start AS ?duration) WHERE { ?item wdt:P361* wd:Q362 ; wdt:P31/wdt:P279* wd:Q178561 ; wdt:P580 ?start ; wdt:P582 ?end . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } The top 10 heaviest humans #defaultView:BubbleChart #TEMPLATE={ "template": "The top 10 heaviest ?type ", "variables": { "?type": { "query": "SELECT DISTINCT ?id WHERE { ?i wdt:P2067 ?v. ?i wdt:P31 ?id}" } } } SELECT ?item ?itemLabel ?mass ?image WHERE { BIND(wd:Q5 AS ?type) ?item wdt:P31 ?type; p:P2067/psn:P2067/wikibase:quantityAmount ?mass. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,es,fr,de" } } ORDER BY DESC(?mass) LIMIT 10 Timeline of compositions by Wolfgang Amadeus Mozart #defaultView:Timeline SELECT DISTINCT ?item ?itemLabel ?catalog_code ?publication_date WHERE { ?item wdt:P86 wd:Q254 ; # composer: W. A. Mozart wdt:P528 ?catalog_code ; wdt:P577 ?publication_date . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Firearms cartridges and which they are based on #Show firearms cartridges and which they are based on #defaultView:Graph SELECT ?item ?itemLabel ?image ?other ?otherLabel ?image2 WHERE { ?item wdt:P279+ wd:Q37144 . # cartridges ?item wdt:P144 ?other . # if the cartridge is based on another OPTIONAL { ?item wdt:P18 ?image . # grab image ?other wdt:P18 ?image2 . # grab image } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Music genres #graph rendering could be slow due to large number of results #defaultView:Graph SELECT ?item ?itemLabel ?_image ?_subclass_of ?_subclass_ofLabel WHERE { ?item wdt:P31 wd:Q188451; wdt:P279 ?_subclass_of. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } OPTIONAL { ?item wdt:P18 ?_image. } } Groups of characters in the Marvel universe #defaultView:Graph SELECT ?char ?charLabel ?group ?groupLabel ("7FFF00" as ?rgb) WHERE { ?group wdt:P31 wd:Q14514600 ; # group of fictional characters wdt:P1080 wd:Q931597. # from Marvel universe ?char wdt:P463 ?group # member of group SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".} } Population of countries sharing a border with Germany #defaultView:LineChart SELECT ?country ?year ?population ?countryLabel WHERE { { SELECT ?country ?year (AVG(?population) AS ?population) WHERE { { SELECT ?country (str(YEAR(?date)) AS ?year) ?population WHERE { ?country wdt:P47 wd:Q183; # shares border with Germany p:P1082 ?populationStatement. ?populationStatement ps:P1082 ?population; pq:P585 ?date. } } } GROUP BY ?country ?year } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Population of countries sharing a border with Cameroon #defaultView:LineChart SELECT ?country ?year ?population ?countryLabel WHERE { { SELECT ?country ?year (AVG(?population) AS ?population) WHERE { { SELECT ?country (str(YEAR(?date)) AS ?year) ?population WHERE { ?country wdt:P47 wd:Q1009; # shares border with Cameroon p:P1082 ?populationStatement. ?populationStatement ps:P1082 ?population; pq:P585 ?date. } } } GROUP BY ?country ?year } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } List of all the lakes in Cameroon #defaultView:Map SELECT ?itemLabel ?itemDescription ?image ?coord WHERE { ?item (wdt:P31/wdt:P279*) wd:Q23397. ?item wdt:P17 wd:Q1009. ?item wdt:P625 ?coord. OPTIONAL {?item wdt:P18 ?image.} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Number of books by year and genre #defaultView:LineChart SELECT ?year (COUNT(?_genre) AS ?count ) (SAMPLE(?_genreLabel) AS ?genreLabel ) WHERE { ?item wdt:P31 wd:Q571; wdt:P577 ?_publication_date; wdt:P136 ?_genre. BIND(str(YEAR(?_publication_date)) AS ?year) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?_genre rdfs:label ?genreLabel.} FILTER (?_publication_date >= "2000-00-00T00:00:00Z"^^xsd:dateTime) } GROUP BY ?_genreLabel ?year HAVING (?count > 10) Number of bands by year and genre #defaultView:LineChart SELECT ?year (COUNT(?_genre) AS ?count) (SAMPLE(?_genreLabel) AS ?_genreLabel) WHERE { ?item wdt:P31 wd:Q215380; # instance of: band wdt:P571 ?_date; # inception wdt:P136 ?_genre. BIND(str(YEAR(?_date)) AS ?year) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?_genre rdfs:label ?_genreLabel.} FILTER(?_date >= "1960-00-00T00:00:00Z"^^xsd:dateTime) } GROUP BY ?_genreLabel ?year HAVING (?count > 10) Battles per year per continent and country last 80 years (animated) #defaultView:BarChart SELECT (SAMPLE(?_continentLabel) AS ?continent) (COUNT(?_country) AS ?battles) (SAMPLE(?_countryLabel) AS ?_countryLabel) (SAMPLE(?year) AS ?year) WHERE { ?subj wdt:P31 wd:Q178561. # instance of battle OPTIONAL { ?subj wdt:P580 ?d1. } # start date OPTIONAL { ?subj wdt:P585 ?d2. } # point in time OPTIONAL { ?subj wdt:P582 ?d3. } # end date BIND(IF(!BOUND(?d1), IF(!BOUND(?d2), ?d3, ?d2), ?d1) AS ?date) BIND(str(YEAR(?date)) AS ?year) FILTER(BOUND(?year)) ?subj wdt:P276/wdt:P17 ?_country. ?_country wdt:P30 ?_continent. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?_country rdfs:label ?_countryLabel. ?_continent rdfs:label ?_continentLabel.} BIND((NOW()) - ?date AS ?distance) FILTER((0 <= ?distance) && (?distance < 31 * 12 * 80)) } GROUP BY ?year ?_country Yearly Population stacked by country #defaultView:BarChart # male/female population _must_ not be added unqualified as total population (!) # this is an error and should be fixed at the item using P1540 and P1539 instead # (wrong query result may be a manifestation of such) SELECT ?year (AVG(?pop) AS ?population) ?countryLabel (COUNT(*) AS ?number_of_chosen_sources) (SAMPLE(?method) AS ?a_source_of_those_chosen) WHERE { ?country wdt:P31 wd:Q6256; p:P1082 ?popStatement . ?popStatement ps:P1082 ?pop; pq:P585 ?date . BIND(STR(YEAR(?date)) AS ?year) # IF multiple ?pop values per country per year exist, we prioritize by source # census 1st, others 2nd, estimation(s) 3rd, unknown sources (none supplies P459) last # note: wikibase:rank won't help here: each year may have multiple statements for ?pop value # rank:prefered is used for the best value (or values) of the latest or current year # rank:normal may be justified for all of multiple ?pop values for a given year OPTIONAL { ?popStatement pq:P459 ?method. } OPTIONAL { ?country p:P1082 [ pq:P585 ?d; pq:P459 ?estimate ]. FILTER(STR(YEAR(?d)) = ?year). FILTER(?estimate = wd:Q791801). } OPTIONAL { ?country p:P1082 [ pq:P585 ?e; pq:P459 ?census ]. FILTER(STR(YEAR(?e)) = ?year). FILTER(?census = wd:Q39825). } OPTIONAL { ?country p:P1082 [ pq:P585 ?f; pq:P459 ?other ]. FILTER(STR(YEAR(?f)) = ?year). FILTER(?other != wd:Q39825 && ?other != wd:Q791801). } BIND(COALESCE( IF(BOUND(?census), ?census, 1/0), IF(BOUND(?other), ?other, 1/0), IF(BOUND(?estimate), ?estimate, 1/0) ) AS ?pref_method). FILTER(IF(BOUND(?pref_method),?method = ?pref_method,true)) # .. still need to group if multiple values per country per year exist and # - none is qualified with P459 # - multiple ?estimate or multiple ?census (>1 value from same source) # - ?other yields more than one source (>1 values are better than optionally # supplied estimate, but no census source available) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?year ?countryLabel ORDER BY ?year ?countryLabel Built power plants per year per country #defaultView:BarChart SELECT (SAMPLE(?year) AS ?year) (COUNT(?_country) AS ?count) (SAMPLE(?_countryLabel) AS ?_countryLabel) WHERE { ?object wdt:P31/wdt:P279* wd:Q134447. # Power stations or subtypes BIND(STR(YEAR(?_inception)) AS ?year) ?object wdt:P571 ?_inception; wdt:P17 ?_country. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?_country rdfs:label ?_countryLabel. } } GROUP BY ?year ?_country ORDER BY ?_countryLabel Viennese composers and their compositions by tonality #defaultView:BarChart SELECT (SAMPLE(?year) AS ?year) (COUNT(?_country) AS ?count) (SAMPLE(?_countryLabel) AS ?_countryLabel) WHERE { ?object wdt:P31/wdt:P279* wd:Q134447. # Power stations or subtypes BIND(STR(YEAR(?_inception)) AS ?year) ?object wdt:P571 ?_inception; wdt:P17 ?_country. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?_country rdfs:label ?_countryLabel. } } GROUP BY ?year ?_country ORDER BY ?_countryLabel Famous people in categorised into eye and hair color #defaultView:TreeMap SELECT ?eyes ?hairColorLabel (COUNT(?person) as ?count) WHERE { ?person wdt:P1340 ?eyeColor. ?person wdt:P1884 ?hairColor. ?person wdt:P2048 ?height. ?eyeColor rdfs:label ?_eyeColorLabel. FILTER((LANG(?_eyeColorLabel)) = "en") BIND(CONCAT(?_eyeColorLabel, " eyes") AS ?eyes) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?eyes ?hairColorLabel Airports within 100km of Berlin #added before 2016-10 #defaultView:Map SELECT ?place ?placeLabel ?location WHERE { # Berlin coordinates wd:Q64 wdt:P625 ?berlinLoc . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?berlinLoc . bd:serviceParam wikibase:radius "100" . } . # Is an airport FILTER EXISTS { ?place wdt:P31/wdt:P279* wd:Q1248784 } . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } Airports in Belgium #List of airports in Belgium #defaultView:Map SELECT DISTINCT ?airport ?airportLabel ?coor WHERE { ?airport wdt:P31 wd:Q1248784 ; ?range wd:Q31; wdt:P625 ?coor. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Schools between San Jose, CA and Sacramento, CA #List of airports in Belgium #defaultView:Map SELECT DISTINCT ?airport ?airportLabel ?coor WHERE { ?airport wdt:P31 wd:Q1248784 ; ?range wd:Q31; wdt:P625 ?coor. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Big cities, grouped into map layers by population #defaultView:Map SELECT DISTINCT ?city ?cityLabel (SAMPLE(?location) AS ?location) (MAX(?population) AS ?population) (SAMPLE(?layer) AS ?layer) WHERE { ?city wdt:P31/wdt:P279* wd:Q515; wdt:P625 ?location; wdt:P1082 ?population. FILTER(?population >= 500000). BIND( IF(?population < 1000000, "<1M", IF(?population < 2000000, "1M-2M", IF(?population < 5000000, "2M-5M", IF(?population < 10000000, "5M-10M", IF(?population < 20000000, "10M-20M", ">20M"))))) AS ?layer). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?city ?cityLabel Places with free wifi #defaultView:Map # Places with free wi-fi SELECT ?item ?itemLabel (SAMPLE(?coord) AS ?coord) WHERE { ?item wdt:P2848 wd:Q1543615 ; # wi-fi gratis wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?item ?itemLabel Map of U1 subway stations in Berlin #added before 2016-10 #defaultView:Map SELECT ?stationLabel ?coord WHERE { ?station wdt:P81 wd:Q99691 ; wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de" } } Locations of universities in Germany #added before 2016-10 #defaultView:Map SELECT ?universityLabel ?universityDescription ?website ?coord WHERE { ?university wdt:P31/wdt:P279* wd:Q3918 ; wdt:P17 wd:Q183 ; wdt:P625 ?coord . OPTIONAL { ?university wdt:P856 ?website } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" . } } Locations of universities in Cameroon #added before 2016-10 #defaultView:Map SELECT ?universityLabel ?universityDescription ?website ?coord WHERE { ?university wdt:P31/wdt:P279* wd:Q3918 ; wdt:P17 wd:Q1009 ; wdt:P625 ?coord . OPTIONAL { ?university wdt:P856 ?website } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" . } } Distribution of names of human settlements ending in "-ow" or "-itz" in Germany #added before 2016-10 #defaultView:Map SELECT ?item ?itemLabel ?coord WHERE { ?item wdt:P31/wdt:P279* wd:Q486972; wdt:P17 wd:Q183; rdfs:label ?itemLabel; wdt:P625 ?coord; FILTER (lang(?itemLabel) = "de") . FILTER regex (?itemLabel, "(ow|itz)$"). } Locations of power stations #defaultView:Map SELECT DISTINCT ?objectLabel ?coord ?layer WHERE { ?object wdt:P31/wdt:P279* wd:Q159719; wdt:P625 ?coord. ?object wdt:P31 ?type. ?type wdt:P279* wd:Q159719. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?type rdfs:label ?layer } } Locations of stone arch bridges #defaultView:Map SELECT ?label ?coord ?place ?image WHERE { ?place wdt:P31 wd:Q14276458 ; # instance of deck arch bridge wdt:P186 wd:Q22731 ; # made of stone wdt:P625 ?coord . OPTIONAL { ?place wdt:P18 ?image } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?place rdfs:label ?label } } Locations of aqueducts #defaultView:Map SELECT ?place ?placeLabel ?coord ?layer WHERE { ?place wdt:P31/wdt:P279? wd:Q474 ; # instance of aqueduct wdt:P625 ?coord ; wdt:P31 ?type. ?type wdt:P279* wd:Q474 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?type rdfs:label ?layer} } Locations of archaeological sites, with images #defaultView:Map SELECT ?siteLabel ?coord ?image ?site WHERE { ?site wdt:P31/wdt:P279* wd:Q839954 ; wdt:P625 ?coord ; wdt:P18 ?image . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".} } Locations of castles that are also archaeological sites #defaultView:Map SELECT ?label ?coord ?subj WHERE { ?subj wdt:P31 wd:Q839954 ; # instance of archaeological site wdt:P31 wd:Q23413 ; # instance of castle wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?subj rdfs:label ?label} } Locations of battles #added before 2016-10 #defaultView:Map SELECT ?label ?coord ?subj ?year WHERE { ?subj wdt:P31 wd:Q178561 . ?subj wdt:P625 ?coord . OPTIONAL {?subj wdt:P580 ?d1} OPTIONAL {?subj wdt:P585 ?d2} OPTIONAL {?subj wdt:P582 ?d3} BIND(IF(!BOUND(?d1),(IF(!BOUND(?d2),?d3,?d2)),?d1) as ?date) BIND(YEAR(?date) as ?year) ?subj rdfs:label ?label filter (lang(?label) = "en") } Places of worship #added before 2016-10 #defaultView:Map SELECT ?item ?itemLabel ?_coordinate_location ?_image WHERE { ?item wdt:P31/wdt:P279* wd:Q1370598. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } ?item wdt:P625 ?_coordinate_location. ?item wdt:P18 ?_image. } All museums (including subclass of museum) in Washington, D.C. with coordinates #added before 2016-10 #defaultView:Map SELECT DISTINCT ?item ?name ?coord ?lat ?lon WHERE { ?item wdt:P131* wd:Q61 . ?item wdt:P31/wdt:P279* wd:Q33506 . ?item wdt:P625 ?coord . ?item p:P625 ?coordinate . ?coordinate psv:P625 ?coordinate_node . ?coordinate_node wikibase:geoLatitude ?lat . ?coordinate_node wikibase:geoLongitude ?lon . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . ?item rdfs:label ?name } } ORDER BY ASC (?name) All ski resorts with coordinates #defaultView:Map SELECT ?item ?itemLabel ?coord #?lat ?lon WHERE { ?item wdt:P31 wd:Q130003. ?item wdt:P625 ?coord. # ?item p:P625 ?statementnode. # ?statementnode psv:P625 ?valuenode. # ?valuenode wikibase:geoLatitude ?lat. # ?valuenode wikibase:geoLongitude ?lon. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Lighthouses in Norway #added before 2016-10 #defaultView:Map SELECT DISTINCT ?item ?itemLabel ?coords ?image WHERE { ?item wdt:P31 wd:Q39715 ; wdt:P17 wd:Q20 ; wdt:P625 ?coords OPTIONAL { ?item wdt:P18 ?image } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nb,nn,en,fi" } } ORDER BY ?itemLabel Most beautiful villages of France #defaultView:Map SELECT ?item ?itemLabel ?geoLocation ?image WHERE { ?item wdt:P463 wd:Q1010307 ; # member of Les Plus Beaux Villages de France (organisation) wdt:P625 ?geoLocation . OPTIONAL { ?item wdt:P18 ?image } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr" } } Locations in Fiji #defaultView:Map select ?item ?coords_ where { ?item wdt:P17 wd:Q712 . ?item p:P625/psv:P625 ?coords . ?coords wikibase:geoLatitude ?lat ; wikibase:geoLongitude ?lon . bind(strdt(concat("Point(", if((?lon < 0), str(?lon + 360), str(?lon)), " ", str(?lat), ")"), geo:wktLiteral) as ?coords_) . } Women born in Wales without an article in Welsh for Listeria #defaultView:Map select ?item ?coords_ where { ?item wdt:P17 wd:Q712 . ?item p:P625/psv:P625 ?coords . ?coords wikibase:geoLatitude ?lat ; wikibase:geoLongitude ?lon . bind(strdt(concat("Point(", if((?lon < 0), str(?lon + 360), str(?lon)), " ", str(?lat), ")"), geo:wktLiteral) as ?coords_) . } People born in Occitania for Listeria #added before 2016-10 #Definition for Occitania (Q104285) is the one defined by P527 on item Q104285 SELECT ?item ?yob ?yod WHERE { # items with property place of birth ?item wdt:P19 ?pob . #place of birth must be using P131 with one of the "?parts" (or -- note the "*" -- a value that uses one of the parts in P131, etc.) ?pob wdt:P131* ?parts . # ?parts are those listed on item Q104285 with property P527 wd:Q104285 wdt:P527 ?parts . # humans only ?item wdt:P31 wd:Q5 . #for display in the list, extract yob/yod. Could also be done by using P569 and P570 in "columns=" of Listeria's template OPTIONAL { ?item wdt:P569 ?dob . BIND(YEAR(?dob) as ?yob) } OPTIONAL { ?item wdt:P570 ?dod . BIND(YEAR(?dod) as ?yod) } } #LIMIT to 2000 as Listeria can only handle up to 5000 LIMIT 2000 People born in Scotland for Listeria #added before 2016-10 SELECT ?item ?dob WHERE { # place of birth = Scotland (Q22) { ?item wdt:P19 wd:Q22 } # OR place of birth within Scotland. UNION { ?item wdt:P19 ?pob . ?pob wdt:P131* wd:Q22 } # humans only ?item wdt:P31 wd:Q5 . # get DOB for ordering. OPTIONAL { ?item wdt:P569 ?dob } } #Order by date of birth, avoid overriding this in the template with sort= ORDER BY ?dob #Listeria can only handle up to 5000 LIMIT 4000 #start at the first item OFFSET 0 #change to OFFSET 4000 to start at the 4001th item Subproperties of location (P276) #Subproperties of location (P276) SELECT DISTINCT ?subProperties ?subPropertiesLabel WHERE { ?subProperties wdt:P1647* wd:P276. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Properties grouped by their Wikibase datatype (Q19798645) with number of properties #Properties grouped by their type with number of properties SELECT (COUNT(?property) as ?pcount ) ?wbtype WHERE { ?property rdf:type wikibase:Property. ?property wikibase:propertyType ?wbtype. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?wbtype ORDER BY DESC(?pcount) All properties with descriptions and aliases and types SELECT ?p ?pt ?pLabel ?d ?aliases WHERE { { SELECT ?p ?pt ?d (GROUP_CONCAT(DISTINCT ?alias; separator="|") as ?aliases) WHERE { ?p wikibase:propertyType ?pt . OPTIONAL {?p skos:altLabel ?alias FILTER (LANG (?alias) = "en")} OPTIONAL {?p schema:description ?d FILTER (LANG (?d) = "en") .} } GROUP BY ?p ?pt ?d } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Countries that have sitelinks to en.wiki SELECT ?p ?pt ?pLabel ?d ?aliases WHERE { { SELECT ?p ?pt ?d (GROUP_CONCAT(DISTINCT ?alias; separator="|") as ?aliases) WHERE { ?p wikibase:propertyType ?pt . OPTIONAL {?p skos:altLabel ?alias FILTER (LANG (?alias) = "en")} OPTIONAL {?p schema:description ?d FILTER (LANG (?d) = "en") .} } GROUP BY ?p ?pt ?d } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Countries that have a Featured Article on Russian Wikipedia SELECT ?sitelink ?itemLabel WHERE { ?item wdt:P31 wd:Q6256. ?sitelink schema:isPartOf ; schema:about ?item; wikibase:badge wd:Q17437796 . # Sitelink is badged as a Featured Article SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . } ORDER BY ?itemLabel Numbers of sitelinks for items with Art UK artist ID (P1367) for each language SELECT ?lang (COUNT(DISTINCT ?article) AS ?count) WHERE { ?article schema:about/wdt:P1367 ?yp_id . # find articles about things with a BBC 'Your paintings' artist identifier FILTER (SUBSTR(str(?article), 11, 15) = ".wikipedia.org/") . ?article schema:inLanguage ?lang . } GROUP BY ?lang ORDER BY DESC (?count) Titles of articles about Ukrainian villages on Romanian Wikipedia SELECT ?lang (COUNT(DISTINCT ?article) AS ?count) WHERE { ?article schema:about/wdt:P1367 ?yp_id . # find articles about things with a BBC 'Your paintings' artist identifier FILTER (SUBSTR(str(?article), 11, 15) = ".wikipedia.org/") . ?article schema:inLanguage ?lang . } GROUP BY ?lang ORDER BY DESC (?count) Wikisource pages for authors of scientific articles #Wikisource pages for authors of scientific articles, ordered by Wikisource language #added in 2017-09 SELECT DISTINCT ?item ?wikisourceSitelink ?wikisourceLanguage WHERE { ?wikisourceSitelink schema:isPartOf [ wikibase:wikiGroup "wikisource" ]; schema:inLanguage ?wikisourceLanguage; schema:about ?item. ?paper wdt:P31 wd:Q13442814; wdt:P50 ?item. } ORDER BY ?wikisourceLanguage LIMIT 300 Winner of the Academy Awards by Award and Time SELECT DISTINCT ?item ?itemLabel ?awardLabel ?time { ?item wdt:P106/wdt:P279* wd:Q3455803 ; # Items with the Occupation(P106) of Director(Q3455803) or a subclass(P279) p:P166 ?awardStat . # ... with an awarded(P166) statement ?awardStat pq:P805 ?award ; # Get the award (which is "subject of" XXth Academy Awards) ps:P166 wd:Q103360 . # ... that has the value Academy Award for Best Director(Q103360) ?award wdt:P585 ?time . # the "point of time" of the Academy Award SERVICE wikibase:label { # ... include the labels bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY DESC(?time) Academy award data #added before 2016-10 SELECT ?human ?humanLabel ?awardEditionLabel ?awardLabel ?awardWork ?awardWorkLabel ?director ?directorLabel ?time WHERE { { SELECT (SAMPLE(?human) AS ?human) ?award ?awardWork (SAMPLE(?director) AS ?director) (SAMPLE(?awardEdition) AS ?awardEdition) (SAMPLE(?time) AS ?time) WHERE { ?award wdt:P31 wd:Q19020 . # All items that are instance of(P31) of Academy awards (Q19020) { ?human p:P166 ?awardStat . # Humans with an awarded(P166) statement ?awardStat ps:P166 ?award . # ... that has any of the values of ?award ?awardStat pq:P805 ?awardEdition . # Get the award edition (which is "subject of" XXth Academy Awards) ?awardStat pq:P1686 ?awardWork . # The work they have been awarded for ?human wdt:P31 wd:Q5 . # Humans } UNION { ?awardWork wdt:P31 wd:Q11424 . # Films ?awardWork p:P166 ?awardStat . # ... with an awarded(P166) statement ?awardStat ps:P166 ?award . # ... that has any of the values of ?award ?awardStat pq:P805 ?awardEdition . # Get the award edition (which is "subject of" XXth Academy Awards) } OPTIONAL { ?awardEdition wdt:P585 ?time . # the "point of time" of the Academy Award ?awardWork wdt:P57 ?director . } } GROUP BY ?awardWork ?award # We only want every movie once for a category (a 'random' person is selected) } SERVICE wikibase:label { # ... include the labels bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY DESC(?time) People that received both Academy Award and Nobel Prize SELECT DISTINCT ?person ?personLabel WHERE { ?person wdt:P166/wdt:P31? wd:Q7191 . ?person wdt:P166/wdt:P31? wd:Q19020 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } Number of handed out academy awards per award type SELECT DISTINCT ?person ?personLabel WHERE { ?person wdt:P166/wdt:P31? wd:Q7191 . ?person wdt:P166/wdt:P31? wd:Q19020 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } Film directors ranked by number of sitelinks multiplied by their number of films SELECT ?director ?director_label ?films ?sitelinks ((?films * ?sitelinks) as ?rank) WHERE { {SELECT ?director (count(distinct ?film) as ?films) (count(distinct ?sitelink) as ?sitelinks) WHERE { ?director wdt:P106 wd:Q2526255 . # has "film director" as occupation ?film wdt:P57 ?director . # get all films directed by the director ?sitelink schema:about ?director . # get all the sitelinks about the director } GROUP BY ?director } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". # Get label if it exists ?director rdfs:label ?director_label } } ORDER BY DESC(?rank) LIMIT 100 The Simpsons television series episodes list by season SELECT ?show ?showLabel ?seasonNumber ?episode ?episodeLabel WHERE { BIND(wd:Q886 as ?show) . ?season wdt:P361 ?show . ?episode wdt:P361 ?season . ?season p:P179 [ pq:P1545 ?seasonNumber] . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY xsd:integer(?seasonNumber) Pokemon! SELECT ?show ?showLabel ?seasonNumber ?episode ?episodeLabel WHERE { BIND(wd:Q886 as ?show) . ?season wdt:P361 ?show . ?episode wdt:P361 ?season . ?season p:P179 [ pq:P1545 ?seasonNumber] . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY xsd:integer(?seasonNumber) Law & Order episodes # All Law & Order episodes on Wikidata. # According to enwp, “[a] total of 456 original episodes… aired before cancellation” (https://en.wikipedia.org/wiki/List_of_Law_%26_Order_episodes). # As of this writing, the query returns 451 results, so some episodes are missing (either without item or lacking the necessary statements to match this query). SELECT (SAMPLE(?seasonNumber) AS ?seasonNumber) (SAMPLE(?episodeNumber) AS ?episodeNumber) (SAMPLE(?title) AS ?title) (MIN(?pubDate) AS ?pubDate) ?episode { # All episodes should be instance of episode with series Law & Order. ?episode wdt:P31 wd:Q21191270; wdt:P179 wd:Q321423. # Many of them also have the season as series, so we can get episode and season number from qualifiers there. OPTIONAL { ?episode p:P179 [ # the season also has series Law & Order ps:P179/p:P179 [ ps:P179 wd:Q321423; pq:P1545 ?seasonNumber ] ; pq:P1545 ?episodeNumber ] } OPTIONAL { ?episode wdt:P1476 ?title. } OPTIONAL { ?episode wdt:P577 ?pubDate. } } GROUP BY ?episode # make sure we return each episode only once – a few have multiple publication dates, for example ORDER BY IF(BOUND(?seasonNumber), xsd:integer(?seasonNumber), 1000) xsd:integer(?episodeNumber) ?title Main subjects of West Wing episodes # All Law & Order episodes on Wikidata. # According to enwp, “[a] total of 456 original episodes… aired before cancellation” (https://en.wikipedia.org/wiki/List_of_Law_%26_Order_episodes). # As of this writing, the query returns 451 results, so some episodes are missing (either without item or lacking the necessary statements to match this query). SELECT (SAMPLE(?seasonNumber) AS ?seasonNumber) (SAMPLE(?episodeNumber) AS ?episodeNumber) (SAMPLE(?title) AS ?title) (MIN(?pubDate) AS ?pubDate) ?episode { # All episodes should be instance of episode with series Law & Order. ?episode wdt:P31 wd:Q21191270; wdt:P179 wd:Q321423. # Many of them also have the season as series, so we can get episode and season number from qualifiers there. OPTIONAL { ?episode p:P179 [ # the season also has series Law & Order ps:P179/p:P179 [ ps:P179 wd:Q321423; pq:P1545 ?seasonNumber ] ; pq:P1545 ?episodeNumber ] } OPTIONAL { ?episode wdt:P1476 ?title. } OPTIONAL { ?episode wdt:P577 ?pubDate. } } GROUP BY ?episode # make sure we return each episode only once – a few have multiple publication dates, for example ORDER BY IF(BOUND(?seasonNumber), xsd:integer(?seasonNumber), 1000) xsd:integer(?episodeNumber) ?title Movies with Bud Spencer SELECT DISTINCT ?episode ?ordinal ?episodeLabel ?subject ?subjectLabel WHERE { ?episode wdt:P31/wdt:P279* wd:Q1983062; p:P179 ?statement. OPTIONAL{ ?episode wdt:P921 ?subject } ?statement ps:P179 wd:Q3577037; pq:P1545 ?ordinal SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY xsd:integer(?ordinal) Fictional subjects of the Marvel Universe SELECT ?item ?itemLabel (MIN(?date) AS ?date) ?_image WHERE { ?item wdt:P161 wd:Q221074; wdt:P577 ?date SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } OPTIONAL { ?item wdt:P18 ?_image. } } GROUP BY ?item ?itemLabel ?_image ORDER BY (?date) Contemporary Indian actresses SELECT ?item ?itemLabel ?itemDescription (SAMPLE(?img) AS ?image) (SAMPLE(?dob) AS ?dob) ?sl WHERE { ?item wdt:P106 wd:Q33999 ; wdt:P27 wd:Q668 ; wdt:P21 wd:Q6581072 . MINUS { ?item wdt:P570 [] } OPTIONAL { ?item wdt:P18 ?img } OPTIONAL { ?item wdt:P569 ?dob } OPTIONAL { ?item wikibase:sitelinks ?sl } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"} } GROUP BY ?item ?itemLabel ?itemDescription ?sl ORDER BY DESC(?sl) Articles on Punjabi (Gurmukhi) Wikipedia about Pakistani actresses SELECT ?item ?itemLabel ?itemDescription (SAMPLE(?img) AS ?image) (SAMPLE(?dob) AS ?dob) ?sl WHERE { ?item wdt:P106 wd:Q33999 ; wdt:P27 wd:Q668 ; wdt:P21 wd:Q6581072 . MINUS { ?item wdt:P570 [] } OPTIONAL { ?item wdt:P18 ?img } OPTIONAL { ?item wdt:P569 ?dob } OPTIONAL { ?item wikibase:sitelinks ?sl } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"} } GROUP BY ?item ?itemLabel ?itemDescription ?sl ORDER BY DESC(?sl) All Dr. Who performers #added 2017-07-16 SELECT ?doctor ?doctorLabel ?ordinal ?performer ?performerLabel WHERE { ?doctor wdt:P31 wd:Q34358 . OPTIONAL { ?doctor wdt:P1545 ?ordinal } OPTIONAL { ?doctor wdt:P175 ?performer } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ASC(xsd:integer(?ordinal) ) Movies and their narrative location on a map #added 2017-07-16 SELECT ?doctor ?doctorLabel ?ordinal ?performer ?performerLabel WHERE { ?doctor wdt:P31 wd:Q34358 . OPTIONAL { ?doctor wdt:P1545 ?ordinal } OPTIONAL { ?doctor wdt:P175 ?performer } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ASC(xsd:integer(?ordinal) ) Movies released in 2017 #defaultView:Map SELECT ?movie ?movieLabel ?narrative_location ?narrative_locationLabel ?coordinates WHERE { ?movie wdt:P840 ?narrative_location ; wdt:P31 wd:Q11424 . ?narrative_location wdt:P625 ?coordinates . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Some other continents #added before 2016-10 SELECT ?continentLabel WHERE { { # subquery for optimization so the label service doesn’t have to do as much work (228?ms vs 20731?ms) SELECT DISTINCT ?continent WHERE { [] wdt:P30 ?continent. } } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY xsd:integer(SUBSTR(STR(?continent),STRLEN("http://www.wikidata.org/entity/Q")+1)) Places with continent Antarctica more than 3000?km north of south pole #added before 2016-10 #defaultView:Map SELECT ?place ?placeLabel ?location WHERE { wd:Q933 wdt:P625 ?southPole. # coordinates of south pole ?place wdt:P30 wd:Q51; # continent: antarctica wdt:P625 ?location. FILTER(geof:distance(?location, ?southPole) > 3000). # over 3000?km away from south pole SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Largest cities per country #added before 2016-10 #Largest cities per country SELECT DISTINCT ?city ?cityLabel ?population ?country ?countryLabel ?loc WHERE { { SELECT (MAX(?population) AS ?population) ?country WHERE { ?city wdt:P31/wdt:P279* wd:Q515 . ?city wdt:P1082 ?population . ?city wdt:P17 ?country . } GROUP BY ?country ORDER BY DESC(?population) } ?city wdt:P31/wdt:P279* wd:Q515 . ?city wdt:P1082 ?population . ?city wdt:P17 ?country . ?city wdt:P625 ?loc . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } Wikidata people per million inhabitants for all EU countries #added before 2016-10 #Interesting maintenance query that shows the relative prominence of a country's current (living) population on Wikidata. The query tends to time out when using all countries at once, but it might be possible to get the figures for each individual country by using uncommenting the line as indicated below SELECT ?country ?countryLabel ?wikiPersons ?population (ROUND(?wikiPersons/?population*1000000) AS ?wikiPersonsPerM) WHERE { { SELECT ?country (count(*) as ?wikiPersons) WHERE { {SELECT DISTINCT ?person ?country WHERE { ?country wdt:P31 wd:Q185441 . # BIND( wd:Q30 AS ?country ) # use instead of previous line to check individual countries ?person wdt:P31 wd:Q5 . ?person wdt:P27 ?country . FILTER NOT EXISTS{ ?person wdt:P570 ?date } # only count living people } } } GROUP BY ?country } ?country wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?wikiPersonsPerM) Papers about wikidata #added before 2016-10 #papers about Wikidata SELECT ?item ?itemLabel WHERE { ?item (wdt:P31/wdt:P279*) wd:Q191067. ?item wdt:P921 wd:Q2013. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 100 Countries sorted by population # defaultView:BubbleChart SELECT DISTINCT ?countryLabel ?population { ?country wdt:P31 wd:Q6256 ; wdt:P1082 ?population . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?population ?countryLabel ORDER BY DESC(?population) Country populations together with total city populations SELECT ?country ?countryLabel ?population ?totalCityPopulation (?population / ?totalCityPopulation AS ?ratio) { ?country wdt:P1082 ?population . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } { SELECT ?country (SUM(?cityPopulation) AS ?totalCityPopulation) WHERE { ?city wdt:P31 wd:Q515 . ?city wdt:P17 ?country . ?city wdt:P1082 ?cityPopulation . } GROUP BY ?country } } ORDER BY ?ratio Names of African countries in all their official languages and English SELECT DISTINCT ?item ?itemLabel_ol ?official_language ?itemLabel_en WHERE { ?item wdt:P30 wd:Q15 ; wdt:P37 ?officiallanguage ; wdt:P31 wd:Q6256 . ?officiallanguage wdt:P424 ?langcode . ?item rdfs:label ?itemLabel_ol . FILTER(lang(?itemLabel_ol)=?langcode) ?item rdfs:label ?itemLabel_en . FILTER(lang(?itemLabel_en)='en') ?officiallanguage rdfs:label ?official_language . FILTER(lang(?official_language)='en') } ORDER BY ?item ?itemLabel_lol ?official_language Largest cities of the world SELECT DISTINCT ?item ?itemLabel_ol ?official_language ?itemLabel_en WHERE { ?item wdt:P30 wd:Q15 ; wdt:P37 ?officiallanguage ; wdt:P31 wd:Q6256 . ?officiallanguage wdt:P424 ?langcode . ?item rdfs:label ?itemLabel_ol . FILTER(lang(?itemLabel_ol)=?langcode) ?item rdfs:label ?itemLabel_en . FILTER(lang(?itemLabel_en)='en') ?officiallanguage rdfs:label ?official_language . FILTER(lang(?official_language)='en') } ORDER BY ?item ?itemLabel_lol ?official_language Cities as big as Antwerp give or take 1000 #added before 2016-10 #defaultView:Map SELECT DISTINCT ?city ?cityLabel ?populatie2 ?coor WHERE { wd:Q12892 wdt:P1082 ?populatie . ?city wdt:P1082 ?populatie2 ; wdt:P625 ?coor . FILTER (abs(?populatie - ?populatie2) < 1000) SERVICE wikibase:label { bd:serviceParam wikibase:language "nl" } } Cities as big as Eindhoven give or take 1000 #added before 2016-10 #defaultView:Map SELECT DISTINCT ?city ?cityLabel ?populatie2 ?coor WHERE { wd:Q12892 wdt:P1082 ?populatie . ?city wdt:P1082 ?populatie2 ; wdt:P625 ?coor . FILTER (abs(?populatie - ?populatie2) < 1000) SERVICE wikibase:label { bd:serviceParam wikibase:language "nl" } } Where in the world is Antwerp #added before 2016-10 #defaultView:Map SELECT DISTINCT ?city ?cityLabel ?location ?populatie2 WHERE { wd:Q9832 wdt:P1082 ?populatie . ?city wdt:P1082 ?populatie2 ; wdt:P625 ?location . FILTER (abs(?populatie - ?populatie2) < 1000) SERVICE wikibase:label { bd:serviceParam wikibase:language "nl" } } Destinations from Antwerp International airport #added before 2016-10 #defaultView:Map SELECT ?connectsairport ?connectsairportLabel ?place_served ?place_servedLabel ?coor WHERE { VALUES ?airport { wd:Q17480 } # Antwerp international airport wd:Q17480 ?airport wdt:P81 ?connectsairport ; wdt:P625 ?base_airport_coor . ?connectsairport wdt:P931 ?place_served ; wdt:P625 ?coor . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Cities connected by the European route E40 #added before 2016-10 #defaultView:Map SELECT ?city ?cityLabel ?coordinates WHERE { VALUES ?highway {wd:Q327162 } ?highway wdt:P2789 ?city . ?city wdt:P625 ?coordinates . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Cities connected by the Trans-Mongolian and Trans-Siberian Railway #added before 2016-10 #defaultView:Map SELECT ?city ?cityLabel ?coordinates WHERE { VALUES ?highway { wd:Q559037 wd:Q58767 } ?highway wdt:P2789 ?city . ?city wdt:P625 ?coordinates . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Cities connected to Paramaribo (Suriname) by main roads #added before 2016-10 #defaultView:Map SELECT DISTINCT ?connection ?connectionLabel ?connectedWith ?connectedWithLabel ?coor WHERE { VALUES ?city {wd:Q3001} # wd:Q3001 = Paramaribo} ?connection wdt:P2789+ ?city ; wdt:P2789+ ?connectedWith . ?connectedWith wdt:P625 ?coor . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Names of 100 cities with a population larger than 1000000 in the native languages of their countries #added before 2016-10 # Show the names of 100 cities with a population larger than 1000000 in the native languages of their countries SELECT ?city ?cityLabel ?country ?countryLabel ?lang ?langLabel ?langCode ?population WHERE { ?city wdt:P1082 ?population . FILTER(?population>1000000) ?city wdt:P31 wd:Q515; wdt:P17 ?country; rdfs:label ?cityLabel . ?country wdt:P37 ?lang; rdfs:label ?countryLabel . ?lang wdt:P424 ?langCode; rdfs:label ?langLabel . FILTER(lang(?cityLabel)=?langCode) FILTER(lang(?countryLabel)=?langCode) FILTER(lang(?langLabel)=?langCode) } LIMIT 100 grouped per municipality on x-axis, alphabetically #defaultView:ScatterChart PREFIX var_muntype: PREFIX var_area: SELECT ?from (?distGrp1 AS ?kilometers) ?to WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). BIND(STR(ROUND(?distNum)) AS ?distGrp0). BIND(CONCAT(SUBSTR("000",STRLEN(?distGrp0)+1),?distGrp0,".",STR(ROUND((?distNum-FLOOR(?distNum))*10))," km") AS ?distGrp1). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } ORDER BY ?from ?kilometers grouped per municipality on x-axis, by sum of dist #defaultView:ScatterChart PREFIX var_muntype: PREFIX var_area: SELECT ?from (?distNum AS ?kilometers) ?to WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } ORDER BY ?from ?kilometers grouped per municipality on x-axis, animated per municipality on x-axis #defaultView:ScatterChart PREFIX var_muntype: PREFIX var_area: SELECT ?from (?distNum AS ?kilometers) ?to (?from AS ?animation) WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } ORDER BY ?from ?kilometers grouped per municipality on x-axis, animated per municipality on z-axis #defaultView:ScatterChart PREFIX var_muntype: PREFIX var_area: SELECT ?from (?distNum AS ?kilometers) ?to (?to AS ?animation) WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } ORDER BY ?from ?kilometers grouped per municipality on x-axis, animated by fixed dist range groups #defaultView:ScatterChart PREFIX var_muntype: PREFIX var_area: SELECT ?from (?distNum AS ?kilometers) ?to (?to AS ?animation) WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } ORDER BY ?from ?kilometers grouped per municipality on x-axis, animated by ranked dist (farthest, 2nd farthest, ..) #defaultView:ScatterChart PREFIX var_muntype: PREFIX var_area: SELECT ?from ?kilometers ?to ?rank_group WHERE { { SELECT (SAMPLE(?mun) AS ?mun) (SAMPLE(?mun2) AS ?mun2) (SAMPLE(?distNum) AS ?kilometers) (COUNT(*)-1 AS ?rg) (SUBSTR("00",1+STRLEN(STR(?rg))) AS ?rgpad) (IF(FLOOR((?rg-(100*FLOOR(?rg/100)))/10)=1,0,?rg-(10*FLOOR(?rg/10))) AS ?rgmod) (IF(?rgmod=1,"st",IF(?rgmod=2,"nd",IF(?rgmod=3,"rd","th"))) AS ?rgord) (CONCAT(?rgpad,STR(?rg),?rgord,"-most farthest places") AS ?rank_group) WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } OPTIONAL { { SELECT (?mun AS ?mun3) (SAMPLE(?loc) AS ?loc3) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). BIND(geof:distance(?loc, ?loc3) AS ?d). FILTER(?distNum >= ?d). } GROUP BY ?mun ?mun2 ?distNum } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } ORDER BY ?rank_group ?kilometers ?from Longest river of each continent #added before 2016-10 SELECT ?continent ?river ?continentLabel ?riverLabel WHERE { { SELECT ?continent (MAX(?length) AS ?length) WHERE { ?river wdt:P31/wdt:P279* wd:Q355304; wdt:P2043 ?length; wdt:P30 ?continent. } GROUP BY ?continent } ?river wdt:P31/wdt:P279* wd:Q355304; wdt:P2043 ?length; wdt:P30 ?continent. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?continentLabel Rivers in Antarctica #added before 2016-10 SELECT ?river ?riverLabel ?location WHERE { ?river wdt:P31/wdt:P279* wd:Q355304; # watercourse; includes a few creeks – use wd:Q4022 for rivers only wdt:P30 wd:Q51. OPTIONAL { ?river wdt:P625 ?location. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Body of water with the most watercourses ending in it #added before 2016-10 # Bodies of water that most watercourses end in (transitive). # For example, over 4000 watercourses eventually flow into the Ob, # and since the Ob flows into the Kara Sea, the Kara Sea has over 4000 results as well. SELECT ?mouth (COUNT(?watercourse) AS ?count) WHERE { ?watercourse wdt:P403+ ?mouth. } GROUP BY ?mouth ORDER BY DESC(?count) LIMIT 10 Bridges over rivers in former government district of Leipzig #defaultView:Map SELECT (SAMPLE(?bridge) AS ?bridge) (SAMPLE(?bridgeLabel) AS ?bridgeLabel) (SAMPLE(?watercourse) AS ?watercourse) (SAMPLE(?watercourseLabel) AS ?watercourseLabel) (SAMPLE(?loc) AS ?loc) (SAMPLE(?pic) AS ?pic) (CONCAT(SAMPLE(?sKey),": ",STR(YEAR(SAMPLE(?s)))) AS ?start) (CONCAT(SAMPLE(?eKey),": ",STR(YEAR(SAMPLE(?e)))) AS ?end) (SAMPLE(?article) AS ?article) (IF(BOUND(?article),CONCAT(?bridgeLabel," in Wikipedia"),1/0) AS ?articleLabel) WHERE { { SELECT ?bridge ?watercourse WHERE { ?bridge wdt:P31/wdt:P279* wd:Q12280; wdt:P177 ?watercourse. ?watercourse wdt:P31/wdt:P279* wd:Q355304. # the following actually yields a perf penalty atm #?bridge wdt:P17 wd:Q183. #OPTIONAL { ?bridge wdt:P17 ?country. }. FILTER(!BOUND(?country) || ?country = wd:Q183). } } # wd:Q1202, wd:Q183 work as well atm and take progressively more time to complete ?bridge (p:P131|ps:P131)+ wd:Q24186. OPTIONAL { ?bridge wdt:P625 ?loc. }. OPTIONAL { ?bridge wdt:P18 ?pic. }. OPTIONAL { ?bridge wdt:P571 ?s. }. OPTIONAL { ?bridge wdt:P576 ?e. }. OPTIONAL { ?article schema:about ?bridge. FILTER (IF(EXISTS {?article schema:inLanguage "[AUTO_LANGUAGE]".}, SUBSTR(str(?article), 1, 25) = "https://[AUTO_LANGUAGE].wikipedia.org/", IF(EXISTS {?article schema:inLanguage "en".}, SUBSTR(str(?article), 1, 25) = "https://en.wikipedia.org/", SUBSTR(str(?article), 1, 25) = "https://de.wikipedia.org/" ) )). } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de". ?bridge rdfs:label ?bridgeLabel. ?watercourse rdfs:label ?watercourseLabel. wd:P571 rdfs:label ?sKey. wd:P576 rdfs:label ?eKey. } } GROUP BY ?bridge ?watercourse Highest mountains in the universe #added before 2016-10 #Mountains over 8000 elevation SELECT ?subj ?label ?coord ?elev WHERE { ?subj wdt:P2044 ?elev filter(?elev > 8000) . ?subj wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,zh" . ?subj rdfs:label ?label } } Mountains over 8000 elevation #added before 2016-10 SELECT ?subj ?label ?coord ?elev WHERE { ?subj wdt:P2044 ?elev filter(?elev > 8000) . ?subj wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,zh" . ?subj rdfs:label ?label } } Italian mountains higher than 4000 m #defaultView:ImageGrid SELECT ?item ?itemLabel ?coord ?elev ?picture { ?item p:P2044/psn:P2044/wikibase:quantityAmount ?elev ; # normalized height wdt:P625 ?coord ; wdt:P17 wd:Q38 ; wdt:P18 ?picture FILTER(?elev > 4000) SERVICE wikibase:label { bd:serviceParam wikibase:language "it" } } Metro stations in Paris SELECT ?item ?itemLabel ?adjacent ?adjacentL ?coords { ?item wdt:P31/wdt:P279* wd:Q928830 ; wdt:P81 wd:Q13224 ; wdt:P625 ?coords . OPTIONAL { ?item p:P197 [ ps:P197 ?adjacent ; pq:P560 wd:Q585752 ] . ?adjacent rdfs:label ?adjacentL filter (lang(?adjacentL) = "en") } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?itemLabel Map of Broadway venues #added before 2016-10 #defaultView:Map # Venues in Broadway SELECT DISTINCT ?venue ?venueLabel ?coords { ?venue wdt:P1217 ?IDBDB . wd:Q235065 wdt:P625 ?broadWayLoc . SERVICE wikibase:around { ?venue wdt:P625 ?coords . bd:serviceParam wikibase:center ?broadWayLoc . bd:serviceParam wikibase:radius "1.5" . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } How many states this US state borders #added before 2016-10 #defaultView:Map # Venues in Broadway SELECT DISTINCT ?venue ?venueLabel ?coords { ?venue wdt:P1217 ?IDBDB . wd:Q235065 wdt:P625 ?broadWayLoc . SERVICE wikibase:around { ?venue wdt:P625 ?coords . bd:serviceParam wikibase:center ?broadWayLoc . bd:serviceParam wikibase:radius "1.5" . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } Places that are below 10 meters above sea level #added before 2016-10 #defaultView:Map SELECT ?p ?location ?el ?image WHERE { ?p p:P2044/psv:P2044 ?pel. ?pel wikibase:quantityAmount ?el. ?pel wikibase:quantityUnit ?unit. bind(0.01 as ?km). filter( (?el < ?km*1000 && ?unit = wd:Q11573) || (?el < ?km*3281 && ?unit = wd:Q3710) || (?el < ?km && ?unit = wd:Q828224) ). ?p wdt:P625 ?location. optional { ?p wdt:P18 ?image } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Globes used to represent coordinates #added before 2016-10 SELECT (count(?v) as ?c) ?globe WHERE { ?v wikibase:geoGlobe ?globe } GROUP BY ?globe ORDER BY DESC(?c) Places within 1km of the Empire State Building #added before 2016-10 SELECT ?place ?placeLabel ?location ?instanceLabel WHERE { wd:Q9188 wdt:P625 ?loc . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?loc . bd:serviceParam wikibase:radius "1" . } OPTIONAL { ?place wdt:P31 ?instance } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } BIND(geof:distance(?loc, ?location) as ?dist) } ORDER BY ?dist Select French municipalities by INSEE code (select by identifier) SELECT ?item ?itemLabel ?inseeCode { ?item wdt:P374 ?inseeCode . FILTER (?inseeCode in ("75056", "69123", "13055")) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Emergency numbers by population using them #added before 2016-10 #Lists emergency numbers and the total amount of people which can use them #defaultView:BubbleChart SELECT ?emergencyNumber ?emergencyNumberLabel ?tel ?population ?countries WHERE { ?emergencyNumber wdt:P31 wd:Q694554 . OPTIONAL{SELECT ?emergencyNumber (COUNT(?state) as ?countries) (SUM(?pop) as ?population) WHERE { ?state wdt:P2852 ?emergencyNumber . OPTIONAL{?state wdt:P1082 ?pop} . ?state wdt:P31/wdt:P279* wd:Q6256 } GROUP BY ?emergencyNumber } . OPTIONAL{?emergencyNumber wdt:P1329 ?tel } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?population) German states, ordered by the number of company headquarters per million inhabitants #added before 2016-10 #Lists emergency numbers and the total amount of people which can use them #defaultView:BubbleChart SELECT ?emergencyNumber ?emergencyNumberLabel ?tel ?population ?countries WHERE { ?emergencyNumber wdt:P31 wd:Q694554 . OPTIONAL{SELECT ?emergencyNumber (COUNT(?state) as ?countries) (SUM(?pop) as ?population) WHERE { ?state wdt:P2852 ?emergencyNumber . OPTIONAL{?state wdt:P1082 ?pop} . ?state wdt:P31/wdt:P279* wd:Q6256 } GROUP BY ?emergencyNumber } . OPTIONAL{?emergencyNumber wdt:P1329 ?tel } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?population) Popular names per birthplace #added before 2016-10 # German states, ordered by the number of company headquarters per million inhabitants # Replace wd:Q1221156 (state of Germany) by anything else you care about, e.g., wd:Q6256 (country) # Nested queries for correctness (don't count companies twice) and performance (aggregate before adding more data) # Limits: states without population missing; company data in Wikidata is always incomplete # Note: This query shows some not-so-easy nesting of DISTINCT (don't count any company twice) and aggregate, in combination with arithmetic output evaluation functions. It is a hard query that may time out if modified. SELECT ?state ?stateLabel ?companies ?population (?companies/?population*1000000 AS ?companiesPerM) WHERE { { SELECT ?state (count(*) as ?companies) WHERE { {SELECT DISTINCT ?company ?state WHERE { ?state wdt:P31 wd:Q1221156 . ?company wdt:P31/wdt:P279* wd:Q4830453 . ?company wdt:P159/wdt:P131* ?state . FILTER NOT EXISTS{ ?company wdt:P576 ?date } # don't count dissolved companies } } } GROUP BY ?state } ?state wdt:P1082 ?population SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } } ORDER BY DESC(?companiesPerM) Map of places mentioned in travel stories with text in French accessible online #added before 2016-10 #defaultView:Map SELECT DISTINCT ?item ?itemLabel ?ed ?edLabel ?auteurLabel (year(?dateCreation) as ?AnneeCreation) ?lieuLabel ?coord ?lien WHERE { ?item wdt:P136 wd:Q1164267 . # genre :récit de voyage ?item wdt:P31 wd:Q571 . # nature : livre OPTIONAL{ ?item wdt:P50 ?auteur . # [option] auteur } OPTIONAL{ ?item wdt:P571 ?dateCreation. # [option] date de création } ?item wdt:P840 ?lieu . # lieu de l'action MINUS {?item wdt:P840 wd:Q933} # (bug du Pôle Sud) ?lieu wdt:P625 ?coord . # coordonnées géographiques du lieu { ?item wdt:P953 ?lien . # URL, texte intégral disponible sur ?item wdt:P407 wd:Q150 # langue de l'œuvre : français }UNION{ ?ed wdt:P629 ?item . # édition du livre ?ed wdt:P953 ?lien . # URL, texte intégral disponible sur ?ed wdt:P407 wd:Q150 # langue de l'œuvre : français } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". } } ORDER BY ?dateCreation Things located where the equator meets the prime meridian #added before 2016-10 SELECT ?place ?placeLabel ?location WHERE { wd:Q24041662 wdt:P625 ?loc00 . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?loc00 . bd:serviceParam wikibase:radius "0.001" . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?placeLabel French communes with names ending in ac #added before 2016-10 #defaultView:Map SELECT ?item ?itemLabel ?coord WHERE { ?item wdt:P31/wdt:P279* wd:Q484170; wdt:P17 wd:Q142; rdfs:label ?itemLabel; wdt:P625 ?coord; FILTER (lang(?itemLabel) = "fr"). FILTER regex (?itemLabel, "ac$"). FILTER not exists { ?item wdt:P131 wd:Q33788 } # excluding Koumac, New Caledonia... } Buildings in more than one country #added before 2016-10 SELECT ?item ?itemLabel ?count WHERE { { SELECT ?item (COUNT(DISTINCT ?country) AS ?count) WHERE { ?item wdt:P31/wdt:P279* wd:Q41176 . ?item wdt:P17 ?country . FILTER NOT EXISTS { ?country wdt:P576 ?end } } GROUP BY ?item } FILTER ( ?count > 1 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY DESC(?count) ?itemL Streets named after a person #added before 2016-10 SELECT ?item ?itemLabel ?count WHERE { { SELECT ?item (COUNT(DISTINCT ?country) AS ?count) WHERE { ?item wdt:P31/wdt:P279* wd:Q41176 . ?item wdt:P17 ?country . FILTER NOT EXISTS { ?country wdt:P576 ?end } } GROUP BY ?item } FILTER ( ?count > 1 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY DESC(?count) ?itemL Streets in France without a city SELECT ?street ?streetLabel WHERE { ?street wdt:P31/wdt:P279* wd:Q79007 . ?street wdt:P17 wd:Q142 . MINUS { ?street wdt:P131 [] } . SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } } ORDER BY ?streetLabel ATMs around Munich belonging to the Bankcard-Servicenetz interbank network (federated query) #defaultView:Map{"hide":["?atm","?geometry"], "layer": "?bankLabel"} PREFIX lgdo: PREFIX geom: PREFIX bif: SELECT ?atm ?geometry ?bank ?bankLabel WHERE { hint:Query hint:optimizer "None". SERVICE { { ?atm a lgdo:Bank; lgdo:atm true. } UNION { ?atm a lgdo:Atm. } ?atm geom:geometry [geo:asWKT ?geometry]; lgdo:operator ?operator. FILTER(bif:st_intersects(?geometry, bif:st_point(11.5746898, 48.1479876), 5)) # 5 km around Munich } BIND(STRLANG(?operator, "de") as ?bankLabel) ?bank rdfs:label ?bankLabel. # bank is part of the Bankcard service network, either via an explicit statement or implicitly due to its legal form (unless explicitly excluded) { ?bank wdt:P527 wd:Q806724. } UNION { ?bank wdt:P1454 wd:Q5349747. } MINUS { wd:Q806724 wdt:P3113 ?bank. } } Average lifespan by occupation #added before 2016-10 # Select the desired columns and get labels SELECT ?occ ?occLabel ?avgAge ?avgBirthYear ?count WHERE { { # Group the people by their occupation and calculate age SELECT ?occ (count(?p) as ?count) (round(avg(?birthYear)) as ?avgBirthYear) (avg(?deathYear - ?birthYear) as ?avgAge) WHERE { { # Get people with occupation + birth/death dates; combine multiple birth/death dates using avg SELECT ?p ?occ (avg(year(?birth)) as ?birthYear) (avg(year(?death)) as ?deathYear) WHERE { ?p wdt:P31 wd:Q5 ; wdt:P106 ?occ ; p:P569/psv:P569 [ wikibase:timePrecision "9"^^xsd:integer ; # precision of at least year wikibase:timeValue ?birth ; ] ; p:P570/psv:P570 [ wikibase:timePrecision "9"^^xsd:integer ; # precision of at least year wikibase:timeValue ?death ; ] . } GROUP BY ?p ?occ } } GROUP BY ?occ } FILTER (?count > 300) # arbitrary number to weed out values with 'few' observations SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ASC(?avgAge) Items with the most birth dates SELECT ?person (COUNT(?date) AS ?dateC) { ?person wdt:P569 ?date } GROUP BY ?person HAVING (?dateC > 2) ORDER BY DESC (?dateC) LIMIT 100 Things/people with most children SELECT ?person (COUNT(?date) AS ?dateC) { ?person wdt:P569 ?date } GROUP BY ?person HAVING (?dateC > 2) ORDER BY DESC (?dateC) LIMIT 100 Population growth in Suriname from 1960 onward #defaultView:LineChart SELECT ?year ?population { wd:Q730 p:P1082 ?p . ?p pq:P585 ?year ; ps:P1082 ?population . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY ?year Gender distribution in the candidates for the Dutch general election 2017 #defaultView:LineChart SELECT ?year ?population { wd:Q730 p:P1082 ?p . ?p pq:P585 ?year ; ps:P1082 ?population . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY ?year Candidates for the Dutch general election 2017 living in Antwerp, Belgium SELECT ?item ?itemLabel ?twitter ?LinkedIN ?politieke_partij ?politieke_partijLabel ?positie_op_lijst WHERE { ?item p:P3602 ?node. ?item wdt:P551 wd:Q12892. OPTIONAL { ?item wdt:P2002 ?twitter. } OPTIONAL { ?item wdt:P2035 ?LinkedIN. } ?node ps:P3602 wd:Q16061881. OPTIONAL { ?node pq:P1545 ?positie_op_lijst. } OPTIONAL { ?node pq:P1268 ?politieke_partij. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl". } } Candidates for the Dutch general election 2017 living abroad #defaultView:Map SELECT ?item ?itemLabel ?coordinates WHERE { ?item p:P3602 ?node. ?item wdt:P551 ?residence . ?residence wdt:P17 ?country ; wdt:P625 ?coordinates . ?node ps:P3602 wd:Q16061881. FILTER (?country != wd:Q55) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl". } } Occupations of candidates of the Dutch general election 2017 #Kandidaten voor de Nederlandse TK verkiezingen van 2017 #defaultView:Dimensions SELECT ?positie_op_lijst ?genderLabel ?occupationLabel ?politieke_partijLabel WHERE { VALUES ?politieke_partij {wd:Q747910 wd:Q275441} ?item p:P3602 ?node. ?item wdt:P21 ?gender. ?item wdt:P106 ?occupation. ?node ps:P3602 wd:Q16061881. ?node pq:P1545 ?positie_op_lijst. ?node pq:P1268 ?politieke_partij. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl". } } Gender balance of members of Irish parliament #added before 2016-10 SELECT ?genderlabel (COUNT(?genderlabel) as ?total) WHERE { ?subj wdt:P39 wd:Q654291 . ?subj wdt:P21 ?gender . ?gender rdfs:label ?genderlabel filter (lang(?genderlabel) = "en") . ?subj rdfs:label ?label filter (lang(?label) = "en") } GROUP BY ?genderlabel Assemblies by number of seats #added before 2016-10 SELECT DISTINCT ?item ?title ?seats ?jurisdiction (YEAR(?inception) AS ?start) (YEAR(?dissolution) AS ?end) WHERE { ?item wdt:P31/wdt:P279* wd:Q1752346 . OPTIONAL { ?item wdt:P1342 ?seats . } OPTIONAL { ?item wdt:P1001 ?j . ?j rdfs:label ?jurisdiction filter (lang(?jurisdiction) = "en") . } OPTIONAL { ?item wdt:P571 ?inception . } OPTIONAL { ?item wdt:P576 ?dissolution . } OPTIONAL { ?item rdfs:label ?title filter (lang(?title) = "en") . } } ORDER BY DESC(?seats) ?title List of countries by age of the head of government #added by Jura1, rev. 2016-11-08 SELECT DISTINCT ?age ?country ?countryLabel ?hgovernment ?hgovernmentLabel { ?country wdt:P31 wd:Q3624078 . FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240} ?country p:P6 ?statement . ?statement ps:P6 ?hgovernment . ?country wdt:P6 ?hgovernment . FILTER NOT EXISTS { ?statement pq:P582 ?x } ?hgovernment wdt:P569 ?dob . BIND(YEAR(now())-YEAR(?dob) as ?age) FILTER(?age>=65) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?age) Number of ministers who are themselves children of a minister, per country SELECT ?cc (COUNT(DISTINCT ?child) AS ?number) { ?child wdt:P31 wd:Q5 ; # Looking for real humans and not fictional ones wdt:P39/wdt:P279* wd:Q83307 ; (wdt:P22 Members of the French National Assembly born out of France #added before 2016-10 SELECT DISTINCT ?item ?itemLabel ?placeLabel ?countryLabel WHERE { ?item wdt:P39 wd:Q3044918 . ?item wdt:P19 ?place . ?place wdt:P17 ?country . FILTER NOT EXISTS { ?place wdt:P17 wd:Q142 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . } } ORDER BY ?countryLabel ?itemLabel List of parliament buildings with pictures by country #added before 2016-10 #defaultView:ImageGrid SELECT ?building ?buildingLabel ?country ?countryLabel ?picture WHERE { ?building wdt:P31 wd:Q7138926 . ?building wdt:P18 ?picture . OPTIONAL { ?building wdt:P17 ?country } . #if available SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?countryLabel LIMIT 188 Number of jurisdictions by driving side #added before 2016-10 SELECT ?sideLabel (COUNT(?jurisdiction) AS ?count) WHERE { ?jurisdiction wdt:P1622 ?side. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?sideLabel ORDER BY ?sideLabel Billionaires #added before 2016-10 SELECT ?item ?itemLabel ?billions WHERE { ?item wdt:P2218 ?worth. FILTER(?worth>1000000000). BIND(?worth/1000000000 AS ?billions). SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?billions) A network of Drug-disease interactions on infectious diseases (Source: Disease Ontology, NDF-RT and ChEMBL) #added before 2016-10 #defaultView:Graph SELECT DISTINCT ?item ?itemLabel ?rgb ?link WHERE { VALUES ?toggle { true false } ?disease wdt:P699 ?doid; wdt:P279+ wd:Q18123741; wdt:P2176 ?drug. ?drug rdfs:label ?drugLabel. FILTER(LANG(?drugLabel) = "en"). ?disease rdfs:label ?diseaseLabel. FILTER(LANG(?diseaseLabel) = "en"). BIND(IF(?toggle,?disease,?drug) AS ?item). BIND(IF(?toggle,?diseaseLabel,?drugLabel) AS ?itemLabel). BIND(IF(?toggle,"FFA500","7FFF00") AS ?rgb). BIND(IF(?toggle,"",?disease) AS ?link). } The number of Wikidata items on Diseases and the percentage of those with a pointer to the Disease Ontology #added before 2016-10 #defaultView:Graph SELECT DISTINCT ?item ?itemLabel ?rgb ?link WHERE { VALUES ?toggle { true false } ?disease wdt:P699 ?doid; wdt:P279+ wd:Q18123741; wdt:P2176 ?drug. ?drug rdfs:label ?drugLabel. FILTER(LANG(?drugLabel) = "en"). ?disease rdfs:label ?diseaseLabel. FILTER(LANG(?diseaseLabel) = "en"). BIND(IF(?toggle,?disease,?drug) AS ?item). BIND(IF(?toggle,?diseaseLabel,?drugLabel) AS ?itemLabel). BIND(IF(?toggle,"FFA500","7FFF00") AS ?rgb). BIND(IF(?toggle,"",?disease) AS ?link). } Which variant of which gene predicts a positive prognosis in colorectal cancer #added before 2016-10 SELECT (COUNT(?disease) AS ?total) (SUM(?ref) AS ?byDO) (100*?byDO/?total AS ?percent) WHERE { {?disease wdt:P31 wd:Q12136 } UNION {?disease wdt:P279 wd:Q12136 .} OPTIONAL { ?disease p:P699 ?statement. BIND(1 AS ?ref). } } Variants that are associated with renal cell carcinoma #added before 2016-10 SELECT (COUNT(?disease) AS ?total) (SUM(?ref) AS ?byDO) (100*?byDO/?total AS ?percent) WHERE { {?disease wdt:P31 wd:Q12136 } UNION {?disease wdt:P279 wd:Q12136 .} OPTIONAL { ?disease p:P699 ?statement. BIND(1 AS ?ref). } } PubMed references in CIViCdb # variants that are associated with renal cell carcinoma SELECT DISTINCT ?civic_id ?item ?itemLabel WHERE { VALUES ?property { wdt:P3356 # positive diagnostic predictor wdt:P3357 # negative diagnostic predictor wdt:P3358 # positive prognostic predicator wdt:P3359 # negative prognostic predictor } ?item wdt:P3329 ?civic_id . {?item ?property wd:Q1164529.} # wd:Q1164529 = renal cell carcinoma UNION {?item p:P3354 ?o . # positive therapeutic predictor ?o pq:P2175 wd:Q1164529 .} UNION {?item p:P3354 ?o . # negative therapeutic predictor ?o pq:P2175 wd:Q1164529 .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Variant counts by predictor type # variants that are associated with renal cell carcinoma SELECT DISTINCT ?reference ?referenceLabel ?pmid WHERE { ?item wdt:P3329 ?civicId ; ?property ?object . ?object prov:wasDerivedFrom ?provenance . ?provenance pr:P248 ?reference . ?reference wdt:P31 wd:Q13442814 ; wdt:P698 ?pmid . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Metabolite-metabolite interactions (mostly conversions) and their pKa change #defaultView:BubbleChart SELECT ?propertyLabel (count(?prognostic_type) as ?counts) WHERE { VALUES ?prognostic_type {wdt:P3354 wdt:P3355 wdt:P3356 wdt:P3357 wdt:P3358 wdt:P3359} ?item wdt:P3329 ?civic_id ; ?prognostic_type ?prognostic_value . ?property wikibase:directClaim ?prognostic_type . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?propertyLabel ?prognostic_typeLabel ORDER BY ?counts Ranking of most cited work in WikiPathways SELECT ?citation ?citationLabel (count(?pathway) as ?times_cited) WHERE { ?pathway wdt:P2410 ?WikiPathwaysID ; wdt:P2860 ?citation . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?pathway ?citation ?citationLabel Gene and metabolite counts per pathway SELECT ?pathway ?genes ?metabolites ((?genes/?metabolites) as ?g2m_ratio) WHERE { {SELECT DISTINCT ?pathway (count(?pwPart) as ?genes) WHERE { ?pathway wdt:P2410 ?WikiPathwaysID ; wdt:P527 ?pwPart . ?pwPart wdt:P31 wd:Q7187 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?pathway ?genes } {SELECT DISTINCT ?pathway (count(?pwPart) as ?metabolites) WHERE { ?pathway wdt:P2410 ?WikiPathwaysID ; wdt:P527 ?pwPart . ?pwPart wdt:P31 wd:Q11173 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?pathway ?metabolites} } ORDER BY DESC(?genes) Biological pathways with protein structures in the PDB database SELECT ?pathway ?pathwayLabel ?WikiPathways ?Reactome (COUNT(DISTINCT ?protein) as ?count) WHERE { VALUES ?pathwayType { wd:Q4915012 wd:Q2996394 } ?pathway wdt:P31 ?pathwayType . { ?pathway wdt:P527/wdt:P688 ?protein . } UNION { ?pathway wdt:P527 ?protein . } ?protein wdt:P638 ?PDBID . OPTIONAL { ?pathway wdt:P2410 ?WikiPathways } OPTIONAL { ?pathway wdt:P3937 ?Reactome } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?pathway ?pathwayLabel ?WikiPathways ?Reactome ORDER BY DESC(?count) Local annotations from Wikipathways using Federated query on a Pathway with identifier WP716 PREFIX dcterms: PREFIX wp: SELECT DISTINCT ?item ?pw_annotation WHERE { VALUES ?wpid {"WP716"} ?item wdt:P2410 ?wpid ; wdt:P2888 ?source_pathway . SERVICE { ?wp_pathway dc:identifier ?source_pathway . ?wp_pathway wp:ontologyTag ?pw_annotation . # ?pw_annotation rdfs:label ?annotation_label . } } Find drugs for cancers that target genes related to cell proliferation #added before 2016-10 #cases where a drug physically interacts with the product of gene known to be genetically associated a disease #these cases may show opportunities to repurpose a drug for a new disease #See http://database.oxfordjournals.org/content/2016/baw083.long and #http://drug-repurposing.nationwidechildrens.org/search #an example that was recently validated involved a new link between Metformin wd:Q19484 and cancer survival #https://jamia.oxfordjournals.org/content/22/1/179 #currently set up to find drugs for cancers that target genes related to cell proliferation #adapt by changing constraints (e.g. to 'heart disease' Q190805) or removing them SELECT ?drugLabel ?geneLabel ?biological_processLabel ?diseaseLabel WHERE { ?drug wdt:P129 ?gene_product . # drug interacts with a gene_product ?gene wdt:P688 ?gene_product . # gene_product (usually a protein) is a product of a gene (a region of DNA) ?disease wdt:P2293 ?gene . # genetic association between disease and gene ?disease wdt:P279* wd:Q12078 . # limit to cancers wd:Q12078 (the * operator runs up a transitive relation..) ?gene_product wdt:P682 ?biological_process . #add information about the GO biological processes that the gene is related to #limit to genes related to certain biological processes (and their sub-processes): #apoptosis wd:Q14599311 #cell proliferation wd:Q14818032 ?biological_process (wdt:P361 Parent taxons of Blue Whale #added before 2016-10 #defaultView:Graph SELECT ?item ?itemLabel ?pic ?linkTo WHERE { wd:Q42196 wdt:P171* ?item OPTIONAL { ?item wdt:P171 ?linkTo } OPTIONAL { ?item wdt:P18 ?pic } SERVICE wikibase:label {bd:serviceParam wikibase:language "en" } } Mosquito species # Species of mosquitoes # added 2017-06 SELECT ?item ?taxonname WHERE { ?item wdt:P31 wd:Q16521 ; wdt:P105 wd:Q7432 ; wdt:P171* wd:Q7367 ; wdt:P225 ?taxonname . } Taxons and what they are named after #added before 2016-10 SELECT ?taxon ?eponym ?taxonName ?eponymLabel WHERE { ?taxon wdt:P31 wd:Q16521; wdt:P225 ?taxonName; wdt:P138 ?eponym. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?eponym Biologists with Twitter accounts #added before 2016-10 SELECT ?taxon ?eponym ?taxonName ?eponymLabel WHERE { ?taxon wdt:P31 wd:Q16521; wdt:P225 ?taxonName; wdt:P138 ?eponym. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?eponym List of pharmaceutical drugs with picture SELECT DISTINCT ?personLabel (CONCAT("https://twitter.com/",?twitterName) AS ?twitterlink) ?pic WHERE { ?person wdt:P2002 ?twitterName ; wdt:P106 ?occupation . OPTIONAL { ?person wdt:P18 ?pic . } ?occupation wdt:P279* wd:Q864503 . # all subclasses of biologists SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Organisms that are located in the female urogential tract and that have a gene with product indole #added before 2016-10 SELECT ?organism_name WHERE { ?organism_item wdt:P276 wd:Q5880 ; rdfs:label ?organism_name . ?gene wdt:P703 ?organism_item ; wdt:P1056 wd:Q319541 . FILTER (LANG(?organism_name) = "en") . } List of W3C standards #added before 2016-10 SELECT DISTINCT ?standard ?standardLabel ?website WHERE { ?standard wdt:P1462 wd:Q37033 . OPTIONAL{ ?standard wdt:P856 ?website } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY ?standardLabel Oldest software SELECT ?software ?softwareLabel ?date (ROUND((NOW() - ?date)/365.2425) AS ?age) { ?software wdt:P31/wdt:P139* wd:Q7397. OPTIONAL { ?software wdt:P571 ?date. } OPTIONAL { ?software p:P348/pq:P577 ?date. } FILTER(BOUND(?date)). SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?date LIMIT 10 Universities of main programming language authors SELECT ?lang ?langLabel ?human ?humanLabel ?educatedat ?educatedatLabel ?coords { ?lang wdt:P31/wdt:P279* wd:Q9143 . ?human wdt:P31 wd:Q5 . { ?lang wdt:P287 ?human } UNION { ?lang wdt:P170 ?human } UNION { ?lang wdt:P943 ?human } UNION { ?lang wdt:P178 ?human } . ?human wdt:P69 ?educatedat . ?educatedat wdt:P625 ?coords . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr" } } LIMIT 100 Websites with OpenAPI endpoints SELECT ?database ?databaseLabel ?license ?licenseLabel ?value WHERE { ?database ?p ?wds . OPTIONAL { ?database wdt:P275 ?license } ?wds ?v ?value. ?wdP wikibase:statementProperty ?v. ?wdP wikibase:claim ?p. ?wds pq:P31 wd:Q27075870. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ASC(?databaseLabel) E-Readers that support the mobipocket file format SELECT ?ereader ?ereaderLabel WHERE { ?ereader wdt:P31 wd:Q726235 . ?ereader wdt:P1072 wd:Q1941622 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } Software applications ranked in descending order by the number of writable file formats #defaultView:BubbleChart SELECT ?app ?appLabel (COUNT(?format) AS ?count) WHERE { ?app (p:P31/ps:P31/wdt:P279) wd:Q7397 . ?app wdt:P1072 ?format . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?app ?appLabel ORDER BY DESC(?count) Return a bubble chart of mediatypes by count of file formats SELECT DISTINCT ?mediaType (COUNT (?ff) as ?count) WHERE { ?ff wdt:P31/wdt:P279* wd:Q235557. ?ff wdt:P1163 ?mediaType. SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?mediaType ORDER BY DESC (?count) Erdos Numbers and images of people who have oral histories in the Computer History Museum's collection #defaultView:ImageGrid SELECT ?personLabel ?image ?Erdos WHERE { ?person wdt:P485 wd:Q964035 . ?person wdt:P18 ?image . ?person wdt:P2021 ?Erdos SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } Chemical elements and their isotopes by number of neutrons (min/max) #added before 2016-10 SELECT ?element (SAMPLE(?symbol) AS ?symbol) (SAMPLE(?protons) AS ?protons) (MIN(?neutrons) AS ?minNeutrons) (MAX(?neutrons) AS ?maxNeutrons) WHERE { ?element wdt:P31 wd:Q11344; wdt:P1086 ?protons; wdt:P246 ?symbol. ?isotope wdt:P279 ?element; wdt:P1148 ?neutrons. } GROUP BY ?element ORDER BY ?protons Colors of chemical compounds #added before 2016-10 #defaultView:BubbleChart SELECT ?rgb ?colorLabel (COUNT(?compound) AS ?count) WHERE { ?compound wdt:P31 wd:Q11173; wdt:P462 ?color. OPTIONAL { ?color wdt:P465 ?rgb. } BIND(IF(BOUND(?rgb),?rgb,"CCCCCC") AS ?rgb). SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?rgb ?colorLabel All pKa data in Wikidata and the source titles #added before 2016-10 SELECT ?compound ?compoundLabel ?pKa ?source ?sourceLabel ?doi WHERE { ?compound wdt:P31 wd:Q11173 ; p:P1117 ?statement . ?statement rdf:type wikibase:BestRank ; ps:P1117 ?pKa . OPTIONAL { ?statement prov:wasDerivedFrom/pr:P248 ?source . OPTIONAL { ?source wdt:P356 ?doi . } } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } #English label } All CAS registry numbers in Wikidata #added before 2016-10 SELECT DISTINCT ?compound ?compoundLabel ?cas WHERE { ?compound wdt:P231 ?cas . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Chemical compounds in Wikidata sharing the same CAS registry number #added before 2016-10 #two chemical compounds with the same CAS registry number SELECT DISTINCT ?cas ?compound1 ?compound1Label ?compound2 ?compound2Label WHERE { ?compound1 wdt:P231 ?cas . ?compound2 wdt:P231 ?cas . FILTER (?compound1 != ?compound2) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } The number of Chemical compounds in Wikidata sharing the same CAS registry number #added before 2016-10 #two chemical compounds with the same CAS registry number SELECT DISTINCT ?cas ?compound1 ?compound1Label ?compound2 ?compound2Label WHERE { ?compound1 wdt:P231 ?cas . ?compound2 wdt:P231 ?cas . FILTER (?compound1 != ?compound2) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Awarded Chemistry Nobel Prizes #defaultView:Timeline SELECT DISTINCT ?item ?itemLabel ?when (YEAR(?when) as ?date) ?pic WHERE { ?item p:P166 ?awardStat . # … with an awarded(P166) statement ?awardStat ps:P166 wd:Q44585 . # … that has the value Nobel Prize in Chemistry (Q35637) ?awardStat pq:P585 ?when . # when did he receive the Nobel prize SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } OPTIONAL { ?item wdt:P18 ?pic } } Images of organic acids #defaultView:ImageGrid SELECT ?compound ?compoundLabel ?image WHERE { ?compound wdt:P279+ Who discovered the most planets? (with list) #added before 2016-10 SELECT ?discoverer ?discovererLabel (COUNT(DISTINCT ?planet) as ?count) (GROUP_CONCAT(DISTINCT(?planetLabel); separator=", ") as ?planets) WHERE { ?ppart wdt:P279* wd:Q634 . ?planet wdt:P31 ?ppart . ?planet wdt:P61 ?discoverer . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?discoverer rdfs:label ?discovererLabel . ?planet rdfs:label ?planetLabel } } GROUP BY ?discoverer ?discovererLabel ORDER BY DESC(?count) List of space probes with pictures #added before 2016-10 #defaultView:ImageGrid SELECT ?spaceProbeLabel ?date ?picture WHERE { ?spaceProbe wdt:P31 wd:Q26529; wdt:P18 ?picture; wdt:P619 ?date . #mandatory SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . } } ORDER BY ?date LIMIT 88 Birthplaces of astronauts #added before 2016-10 # select all astronauts with name, image, birthdate, birthplace and coordinates of the birthplace SELECT ?astronaut ?astronautLabel ?image ?birthdate ?birthplace ?coord WHERE { ?astronaut ?x1 wd:Q11631; wdt:P18 ?image; wdt:P569 ?birthdate; wdt:P19 ?birthplace. ?birthplace wdt:P625 ?coord SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?birthdate) Most eponymous mathematicians #added before 2016-10 SELECT ?eponym ?eponymLabel ?count ?sample ?sampleLabel WHERE { { SELECT ?eponym (COUNT(?item) as ?count) (SAMPLE(?item) AS ?sample) WHERE { ?item wdt:P138 ?eponym. ?eponym wdt:P106 wd:Q170790. } GROUP BY ?eponym } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?count) Authors of scientific articles by occupation #added before 2016-10 #defaultView:BubbleChart SELECT ?occupationLabel (count(DISTINCT ?author) as ?count) WHERE { ?object wdt:P31 wd:Q13442814 ; wdt:P50 ?author . ?author wdt:P106 ?occupation . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr" } } GROUP BY ?occupationLabel ORDER BY DESC(?count) Authors of scientific articles who received a Nobel prize #added in 2016-10 #Authors of scientific articles who received a Nobel prize SELECT ?item ?itemLabel ?person ?personLabel ?_image ?award ?awardLabel WHERE { ?person wdt:P166 ?award ; #person received an award wdt:P31 wd:Q5 . #person is instance of human ?award wdt:P279* wd:Q7191 . #award is a Nobel Prize ?item wdt:P50 ?person ; #person is an author of item wdt:P31 wd:Q13442814 . #item is a scientific article SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } OPTIONAL { ?person wdt:P18 ?_image. } #Wikimedia Commons has an image of person } Using VALUES for extracting scientific articles of specific authors SELECT ?entity ?entityLabel ?authorLabel WHERE { VALUES ?author {wd:Q18016466} #initialize "?author with the Wikidata item "Lydia Pintscher" ?entity wdt:P31 wd:Q13442814. #filter by scientific articles ?entity wdt:P50 ?author. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Female scientists with most number of sitelinks (but not English Wikipedia) #added before 2016-10 #Female scientists with most number of sitelinks (but not English Wikipedia) PREFIX schema: SELECT ?item ?itemLabel ?linkcount WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P21 wd:Q6581072 . ?item wdt:P106 wd:Q901 . ?item wikibase:sitelinks ?linkcount . FILTER (?linkcount >= 1) . # only include items with 1 or more sitelinks FILTER NOT EXISTS { ?article schema:about ?item . ?article schema:inLanguage "en" . ?article schema:isPartOf } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,es,ar,fr" } } GROUP BY ?item ?itemLabel ?linkcount ORDER BY DESC(?linkcount) Inventors killed by their own invention #added before 2016-10 SELECT ?inventor ?inventorLabel ?gadget ?gadgetLabel WHERE { ?inventor wdt:P157 ?gadget. ?gadget wdt:P61 ?inventor. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Most cited female authors #added 2016-12 ##defaultView:BubbleChart SELECT ?author ?authorLabel (COUNT(?publication) AS ?count) WHERE { ?item wdt:P2860 ?publication . #citations ?publication wdt:P50 ?author . #authors ?author wdt:P21 wd:Q6581072. #females SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?author ?authorLabel ORDER BY DESC(?count) The number of statements by DOI SELECT ?doi (COUNT (?entry) as ?entries) { ?entry ?p ?statement . ?statement prov:wasDerivedFrom/pr:P248/wdt:P356 ?doi . } GROUP BY ?doi ORDER BY DESC(?entries) number of statements backed by a reference with a DOI #added before 2016-10 SELECT (COUNT (?statement) as ?statements) WHERE { ?entry ?p ?statement . ?statement prov:wasDerivedFrom/ / wdt:P356 ?doi . } Statements originating from a specific DOI #added before 2016-10 SELECT ?entryRes ?entry ?statement WHERE { ?entryRes ?p ?statement ; rdfs:label ?entry . ?statement prov:wasDerivedFrom/ / wdt:P356 "10.1021/ja01577a030" . FILTER(lang(?entry) = "en") } Translations of the Disease Ontology term DOID:399 (Tuberculosis) #added before 2016-10 SELECT ?entryRes ?entry ?statement WHERE { ?entryRes ?p ?statement ; rdfs:label ?entry . ?statement prov:wasDerivedFrom/ / wdt:P356 "10.1021/ja01577a030" . FILTER(lang(?entry) = "en") } Library and Information Science journals #added before 2016-10 SELECT DISTINCT ?journal ?name WHERE { ?journal wdt:P31 wd:Q5633421 . # is scientific journal { { ?journal wdt:P921 wd:Q199655 } # with topic library science UNION { ?journal wdt:P921 wd:Q16387 } # and/or topic information science UNION { ?journal wdt:P921 wd:Q13420675 } # and/or topic library and information science } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?journal rdfs:label ?name . } } Most popular subjects of scientific articles select (count(?work) as ?count) ?subject ?subjectLabel where { ?work wdt:P31 wd:Q13442814; wdt:P921 ?subject . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } group by ?subject ?subjectLabel order by desc(?count) limit 200 Scientific journals with editors on Twitter SELECT ?journal ?journalLabel ?editor ?editorLabel ?twitter ?ex_publisher ?ex_publisherLabel WITH { SELECT ?journal ?editor ?twitter (SAMPLE(?publisher) AS ?ex_publisher) WHERE { ?journal wdt:P31 wd:Q5633421 ; wdt:P98 ?editor . OPTIONAL { ?journal wdt:P123 ?publisher } ?editor wdt:P2002 ?twitter . } GROUP BY ?journal ?editor ?twitter } AS %result WHERE { INCLUDE %result SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?journalLabel Databases listed in Wikidata and if available applicable licenses #added before 2016-10 SELECT DISTINCT * WHERE { ?item wdt:P31 wd:Q8513 ; rdfs:label ?name . OPTIONAL { ?item wdt:P275 ?licenseItem . ?licenseItem rdfs:label ?license . FILTER (LANG(?license) = "en")} FILTER (LANG(?name) = "en") } Scientists who have worked together but whose Erdos numbers don’t reflect that #added before 2016-10 # Finds authors who have published scientific articles together, # but whose Erdos numbers are more than one apart. # These would appear to violate the definition of the Erdos number. SELECT # Q#s ?paper ?author1 ?author2 # title (either from title statement or label) (IF(BOUND(?title), ?title, ?paperLabel) AS ?title) # author labels (should be names) and their Erdos numbers ?author1Label ?erdos1 ?author2Label ?erdos2 # distance between Erdos numbers ?distance WHERE { # paper, instance of or subclass of scientific article; also has two authors ?paper wdt:P31/wdt:P279* wd:Q13442814; wdt:P50 ?author1, ?author2. # if it has a title, we’ll grab that as well, but it’s also okay if there’s no title OPTIONAL { ?paper wdt:P1476 ?title. } # grab Erdos numbers of the two authors ?author1 wdt:P2021 ?erdos1. ?author2 wdt:P2021 ?erdos2. # introduce a new variable for the difference of the Erdos numbers BIND(?erdos2 - ?erdos1 AS ?distance). # select those cases where the distance is > 1 # (note: by *not* taking the absolute value of the distance, we avoid getting duplicated cases because the author variables might be swapped) FILTER(?distance > 1). # get *Label variables automagically SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } # sort by distance first (descending), then by first author, then by second author ORDER BY DESC(?distance) ?author1Label ?author2Label Fictional universes with most fictional planets #added before 2016-10 SELECT ?universe (SAMPLE(?label) AS ?label) (COUNT(?planet) AS ?count) WHERE { ?planet wdt:P31 wd:Q2775969; wdt:P1080 ?universe. ?universe rdfs:label ?label. FILTER(LANG(?label) = "en"). } GROUP BY ?universe ORDER BY DESC(?count) Objects with most mass #added before 2016-10 SELECT ?universe (SAMPLE(?label) AS ?label) (COUNT(?planet) AS ?count) WHERE { ?planet wdt:P31 wd:Q2775969; wdt:P1080 ?universe. ?universe rdfs:label ?label. FILTER(LANG(?label) = "en"). } GROUP BY ?universe ORDER BY DESC(?count) Biological databases listed in Wikidata and, if available, applicable licenses SELECT ?item ?itemLabel ?url ?licence ?licenceLabel WHERE { ?item wdt:P31 wd:Q4117139. OPTIONAL { ?item wdt:P856 ?url } OPTIONAL { ?item wdt:P275 ?licence } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?itemLabel American universities founded before the states they reside in were created SELECT ?uLabel ?founded ?stateLabel ?stateStart WHERE { ?u wdt:P31/wdt:P279* wd:Q3918 ; wdt:P131+ ?state ; wdt:P571 ?founded . ?state wdt:P31 wd:Q35657 ; wdt:P571 ?stateStart . FILTER (?founded < ?stateStart) . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } LIMIT 10 Universities ranked by PageRank on English Wikipedia (federated query) PREFIX vrank: SELECT DISTINCT ?uni ?uniLabel ?pr WHERE { ?uni wdt:P31/wdt:P279* wd:Q3918. SERVICE { ?uni vrank:hasRank/vrank:rankValue ?pr } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?pr) LIMIT 50 Presidents and their causes of death ranking #added before 2016-10 #defaultView:BubbleChart SELECT ?cid ?cause (count(*) as ?count) WHERE { ?pid wdt:P39 wd:Q11696 . ?pid wdt:P509 ?cid . OPTIONAL { ?cid rdfs:label ?cause filter (lang(?cause) = "en") . } } GROUP BY ?cid ?cause ORDER BY DESC(?count) ASC(?cause) Politicians who died of cancer (of any type) #added before 2016-10 #defaultView:BubbleChart SELECT ?cid ?cause (count(*) as ?count) WHERE { ?pid wdt:P39 wd:Q11696 . ?pid wdt:P509 ?cid . OPTIONAL { ?cid rdfs:label ?cause filter (lang(?cause) = "en") . } } GROUP BY ?cid ?cause ORDER BY DESC(?count) ASC(?cause) List of popes #added before 2016-10 SELECT ?link ?linkLabel ?picture ?age WHERE { ?link wdt:P31 wd:Q5 ; p:P39 [ ps:P39 wd:Q19546 ; pq:P580 ?startTime ] . OPTIONAL { ?link wdt:P569 ?dateOfBirth } OPTIONAL { ?link wdt:P18 ?picture } OPTIONAL { ?link wdt:P570 ?dateOfDeath } BIND(YEAR(?dateOfDeath) - YEAR(?dateOfBirth) as ?age) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,en" } } ORDER BY DESC(?startTime) Years with 3 popes #added before 2016-10 SELECT ?year ?pope1Label ?pope2Label ?pope3Label WHERE { ?pope2 p:P39 [ ps:P39 wd:Q19546; pq:P580 ?p2s; pq:P582 ?p2e; pq:P1365 ?pope1; pq:P1366 ?pope3 ]. ?pope1 p:P39 [ ps:P39 wd:Q19546; pq:P582 ?p1e ]. ?pope3 p:P39 [ ps:P39 wd:Q19546; pq:P580 ?p3s ]. BIND(YEAR(?p2s) AS ?year). FILTER(YEAR(?p2e) = ?year && YEAR(?p1e) = ?year && YEAR(?p3s) = ?year). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?year Popes with children #added before 2016-10 # All popes with number of children SELECT (SAMPLE(?father) as ?father) ?fatherLabel (SAMPLE(?picture) as ?picture) (COUNT(?father) as ?children) WHERE { ?subj wdt:P22 ?father . ?father wdt:P31 wd:Q5 . ?father wdt:P39 wd:Q19546 . OPTIONAL { ?father wdt:P18 ?picture . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?fatherLabel ORDER BY DESC(?children) LIMIT 50 French heads of government by length of service SELECT DISTINCT ?item ?itemLabel ?positionLabel ?picture ?start ?end ?days WHERE { ?item wdt:P31 wd:Q5 ; p:P39 ?position_statement . ?position_statement ps:P39 ?position ; pq:P580 ?start FILTER (?start >= "1815-01-01T00:00:00Z"^^xsd:dateTime) . ?position wdt:P279* wd:Q15135541 . OPTIONAL { ?position_statement pq:P582 ?x } OPTIONAL { ?item wdt:P18 ?picture } bind(if(bound(?x), ?x, NOW()) as ?end ) bind(floor(?end - ?start) as ?days) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY DESC(?days) ?itemLabel List of countries in 1754 #added before 2016-10 SELECT ?h ?hLabel ?inception ?dissolved ?coor WHERE { VALUES ?countryclass { wd:Q3024240 wd:Q6256 } ?h wdt:P31 ?countryclass . ?h wdt:P571 ?inception . OPTIONAL { ?h wdt:P576 ?dissolved } . FILTER (?inception < "1755-01-01T00:00:00Z"^^xsd:dateTime) FILTER (?dissolved >= "1755-01-01T00:00:00Z"^^xsd:dateTime || !Bound(?dissolved) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } OPTIONAL { ?h wdt:P625 ?coor } . } ORDER BY ?inception Population in Europe after 1960 #added before 2016-10 SELECT ?objectLabel (YEAR(?date) as ?year) ?population (?objectLabel as ?Location) WHERE { ?object wdt:P31 wd:Q185441 ; p:P1082 ?populationStatement . ?populationStatement ps:P1082 ?population ; pq:P585 ?date . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } FILTER (YEAR(?date) >= 1960) } ORDER BY ?objectLabel ?year Locations of air accidents #added before 2016-10 SELECT ?label ?coord ?place WHERE { ?subj wdt:P31 wd:Q744913 . ?subj wdt:P625 ?coord . ?subj rdfs:label ?label filter (lang(?label) = "en") } Most prolific fathers #added before 2016-10 SELECT (SAMPLE(?father) as ?father) ?fatherLabel (SAMPLE(?picture) as ?picture) (COUNT(?father) as ?children) WHERE { ?subj wdt:P22 ?father . OPTIONAL { ?father wdt:P18 ?picture . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?fatherLabel ORDER BY DESC(?children) LIMIT 50 List of suicide attacks #added before 2016-10 SELECT ?h ?hLabel ?location (CONCAT("injured: ",str(?injured)) as ?injuredl) (concat("dead: ",str(?dead)) as ?deadl) ?date ?image WHERE { ?h wdt:P31 ?attack. values (?attack) { (wd:Q18493502) (wd:Q217327) } optional { ?h wdt:P1339 ?injured . } optional { ?h wdt:P1120 ?dead. } optional { ?h wdt:P276?/wdt:P625 ?location } optional { ?h wdt:P585 ?date } optional { ?h wdt:P18 ?image } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } People who died by burning - on a timeline #added before 2016-10 #defaultView:Timeline SELECT ?person ?personLabel ?date WHERE { ?person wdt:P31 wd:Q5; wdt:P509 wd:Q468455; wdt:P570 ?date. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?date People who lived in the same period as another person #added before 2016-10 select ?person ?personLabel ?personDescription ?birth ?death ?age WHERE { ?person wdt:P31 wd:Q5. # instance of human ?person wdt:P569 ?birth . # birth date ?person wdt:P570 ?death . # death date bind( year(?death)-year(?birth) as ?age ) # Make a new variable called ?age that we can use filter (?age > 10 && ?age < 100) # Only find people with realistic ages filter (?birth > "1452-04-15"^^xsd:dateTime && ?death < "1519-05-02"^^xsd:dateTime) # And between these two dates service wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # used to display a label } List of torture devices #added before 2016-10 SELECT ?thing ?thingLabel ?image WHERE { ?thing wdt:P366 wd:Q132781 . ?thing wdt:P18 ?image . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Animals that were executed #added before 2016-10 SELECT ?thing ?thingLabel ?image WHERE { ?thing wdt:P366 wd:Q132781 . ?thing wdt:P18 ?image . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } People who were stateless for some time # persons who were stateless (country of citizenship: no value) for some time (start time and end time qualifiers) SELECT ?person ?personLabel ?start ?end WHERE { ?person wdt:P31 wd:Q5; p:P27 [ rdf:type wdno:P27; pq:P580 ?start; pq:P582 ?end ]. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?end - ?start) Poets who were through An Lushan Rebellion # Poets who were through An Lushan Rebellion SELECT ?poet ?poetLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],zh-hant,zh". } wd:Q253774 wdt:P580 ?battleStartTime. wd:Q253774 wdt:P582 ?battleEndTime. ?poet wdt:P106 wd:Q49757. ?poet wdt:P497 ?cbdbId. ?poet wdt:P569 ?birthDate. FILTER(?birthDate < ?battleStartTime). ?poet wdt:P570 ?deathDate. FILTER(?deathDate > ?battleEndTime). } Periods of Japanese history and what they were named after # Poets who were through An Lushan Rebellion SELECT ?poet ?poetLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],zh-hant,zh". } wd:Q253774 wdt:P580 ?battleStartTime. wd:Q253774 wdt:P582 ?battleEndTime. ?poet wdt:P106 wd:Q49757. ?poet wdt:P497 ?cbdbId. ?poet wdt:P569 ?birthDate. FILTER(?birthDate < ?battleStartTime). ?poet wdt:P570 ?deathDate. FILTER(?deathDate > ?battleEndTime). } All museums in Barcelona with coordinates #added before 2016-10 #All museums (including subclass of museum) in Barcelona with coordinates SELECT DISTINCT ?item ?name ?coord ?lat ?lon WHERE { ?item wdt:P131* wd:Q1492 . ?item wdt:P31/wdt:P279* wd:Q33506 . ?item wdt:P625 ?coord . ?item p:P625 ?coordinate . ?coordinate psv:P625 ?coordinate_node . ?coordinate_node wikibase:geoLatitude ?lat . ?coordinate_node wikibase:geoLongitude ?lon . SERVICE wikibase:label { bd:serviceParam wikibase:language "ca" . ?item rdfs:label ?name } } ORDER BY ASC (?name) Museums in Antwerp #added before 2016-10 #defaultView:Map SELECT ?item ?itemLabel ?coordinates WHERE { ?item wdt:P31/wdt:P279* wd:Q33506 ; wdt:P131 wd:Q12892 ; wdt:P625 ?coordinates . SERVICE wikibase:label { bd:serviceParam wikibase:language "nl, en" } } Louvre artworks in display cases #defaultView:ImageGrid SELECT ?item ?itemLabel ?itemDescription ?image WHERE { #part1: objects in cases { ?item wdt:P276 ?case . ?case wdt:P31 wd:Q3561331 . ?case wdt:P276 ?room . ?room wdt:P31/wdt:P279* wd:Q180516 . # wd:Q15206795 ?room wdt:P466 ?dep . ?dep wdt:P361+ wd:Q19675 } OPTIONAL { ?item wdt:P18 ?image } # Optionally with an image SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr" } } List of theatre plays #added before 2016-10 SELECT ?play ?playLabel WHERE { ?play wdt:P31 wd:Q25379 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,pt,de,fr,ja,zh" . } } LIMIT 1000 List of actors with pictures with year of birth and/or death #added before 2016-10 #defaultView:ImageGrid SELECT ?human ?humanLabel ?yob ?yod ?picture WHERE { ?human wdt:P31 wd:Q5 ; wdt:P106 wd:Q33999 . ?human wdt:P18 ?picture . OPTIONAL { ?human wdt:P569 ?dob . ?human wdt:P570 ?dod }. BIND(YEAR(?dob) as ?yob) . #if available: year BIND(YEAR(?dod) as ?yod) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } LIMIT 88 Actors who played the same role more than 40 years apart SELECT DISTINCT ?actor ?actorLabel ?characterLabel ?movie1Label ?movie2Label WHERE { ?movie1 p:P161 [ ps:P161 ?actor; pq:P453 ?character ]; wdt:P577 ?movie1Publication. ?movie2 p:P161 [ ps:P161 ?actor; pq:P453 ?character ]; wdt:P577 ?movie2Publication. MINUS{?movie1 wdt:P31/wdt:P279? wd:Q24856} # Not a series MINUS{?movie2 wdt:P31/wdt:P279? wd:Q24856} # Not a series FILTER(?character != wd:Q18086706). # Not as "himself/herself" FILTER(?movie1Publication + "P40Y"^^xsd:duration < ?movie2Publication) # 40 years between them SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Birth places of German poets #added before 2016-10 SELECT ?play ?playLabel WHERE { ?play wdt:P31 wd:Q25379 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,pt,de,fr,ja,zh" . } } LIMIT 1000 Books or literary works published before 1830 with place of publication or narrative location coordinates #added before 2016-10 SELECT ?subj ?label ?coord ?place WHERE { {?subj wdt:P31 wd:Q571 } UNION {?subj wdt:P31 wd:Q7725634}. ?subj wdt:P577 ?date FILTER (?date < "1830-01-01T00:00:00Z"^^xsd:dateTime) . OPTIONAL { {?subj wdt:P291 ?place} UNION {?subj wdt:P840 ?place }. ?place wdt:P625 ?coord }. ?subj rdfs:label ?label filter (lang(?label) = "en") } Books by a given Author including genres, series, and publication year #added before 2016-10 SELECT ?book ?bookLabel ?authorLabel ?genre_label ?series_label ?publicationDate WHERE { ?author ?label "Ernest Hemmingway"@en . ?book wdt:P31 wd:Q571 . ?book wdt:P50 ?author . OPTIONAL { ?book wdt:P136 ?genre . ?genre rdfs:label ?genre_label filter (lang(?genre_label) = "en"). } OPTIONAL { ?book wdt:P179 ?series . ?series rdfs:label ?series_label filter (lang(?series_label) = "en"). } OPTIONAL { ?book wdt:P577 ?publicationDate . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } Text by author containing case-insensitive title with optional cover image select distinct ?item ?authorLabel ?itemLabel ?image where { ?item wdt:P31/wdt:P279* wd:Q234460. ?author ?label 'Bram Stoker'. ?item wdt:P50 ?author. ?item rdfs:label ?itemLabel. filter contains(lcase(?itemLabel), 'dracula'). optional {?item wdt:P18 ?image.} service wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE]".} } limit 50 Literary works by label count #added before 2016-10 SELECT ?s ?desc (COUNT(DISTINCT ?label) as ?labelcount) WHERE { ?s wdt:P31 wd:Q7725634 . ?s rdfs:label ?label . OPTIONAL { ?s rdfs:label ?desc filter (lang(?desc) = "en"). } } GROUP BY ?s ?desc ORDER BY DESC(?labelcount) All subclasses of "Literary Work" #added before 2016-10 SELECT ?s ?desc WHERE { ?s wdt:P279 wd:Q7725634 . OPTIONAL { ?s rdfs:label ?desc filter (lang(?desc) = "en"). } } Epic poems by label count #added before 2016-10 SELECT ?s ?desc (COUNT(DISTINCT ?label) as ?labelcount) WHERE { ?s wdt:P31 wd:Q37484 . ?s rdfs:label ?label . OPTIONAL { ?s rdfs:label ?desc filter (lang(?desc) = "en"). } } GROUP BY ?s ?desc ORDER BY DESC(?labelcount) Epic poems by sitelink count #added before 2016-10 #old method for sitelink count SELECT ?s ?desc ?linkcount WHERE { ?s wdt:P31 wd:Q37484 . ?s wikibase:sitelinks ?linkcount . OPTIONAL { ?s rdfs:label ?desc filter (lang(?desc) = "en"). } } GROUP BY ?s ?desc ?linkcount ORDER BY DESC(?linkcount) Instance of Book by sitelink count #added before 2016-10 #old method for sitelink count SELECT ?s ?desc ?linkcount WHERE { ?s wdt:P31 wd:Q571 . ?s wikibase:sitelinks ?linkcount . OPTIONAL { ?s rdfs:label ?desc filter (lang(?desc) = "en"). } } GROUP BY ?s ?desc ?linkcount ORDER BY DESC(?linkcount) Poets and monarchs #added before 2016-10 SELECT ?poetLabel ?image ?yob ?yod ?start ?end ?monarchLabel WHERE { ?poet p:P39 ?positionStat. ?positionStat ps:P39 wd:Q877838; pq:P580 ?start; pq:P748 ?monarch. OPTIONAL { ?positionStat pq:P582 ?end. } OPTIONAL { ?poet wdt:P18 ?image; wdt:P569 ?dob; wdt:P570 ?dod. } BIND(YEAR(?dob) AS ?yob). BIND(YEAR(?dod) AS ?yod). SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY ?start DESC(?monarchLabel) List of digital libraries in the world #added before 2016-10 SELECT DISTINCT ?digitalLibrary ?digitalLibraryLabel ?website WHERE { ?digitalLibrary wdt:P31 wd:Q212805 ; wdt:P856 ?website . SERVICE wikibase:label { bd:serviceParam wikibase:language "en, es, de" } } ORDER BY ?digitalLibraryLabel List of authors unsuccessfully nominated for Nobel prize in literature SELECT ?nominee ?nomineeLabel (SAMPLE(?citizenshipLabel) AS ?country) (COUNT(DISTINCT ?year) as ?timesNominated) WHERE { BIND( wd:Q37922 as ?prize ) ?nominee p:P1411 [ ps:P1411 ?prize; pq:P585 ?time ] BIND( year(?time) as ?year ) OPTIONAL { ?nominee wdt:P27 [ rdfs:label ?citizenshipLabel ] filter (lang(?citizenshipLabel) = "en") . } FILTER NOT EXISTS { ?nominee wdt:P166 ?prize . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?nominee ?nomineeLabel ORDER BY DESC(?timesNominated) ?nomineeLabel Authors whose works enter the public domain in 2017 (died in 1946) SELECT DISTINCT ?item WHERE { ?item wdt:P31 wd:Q5 ; wdt:P106/wdt:P279* wd:Q482980 . ?item wdt:P570 ?time0 . FILTER((?time0 >= "1945-01-01T00:00:00Z"^^xsd:dateTime) && (?time0 <= "1946-01-01T00:00:00Z"^^xsd:dateTime)) } Most popular tonality #added before 2016-10 SELECT ?tonalityLabel (COUNT(?tonalityLabel) as ?count) WHERE { ?work wdt:P826 ?tonality. SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?tonalityLabel ORDER BY DESC(?count) Music composers by birth place #defaultView:Map SELECT ?item ?itemLabel ?_coordinates ?_image WHERE { ?item wdt:P106 wd:Q36834; # occupation: composer wdt:P18 ?_image; # with an image depicting them wdt:P19/wdt:P625 ?_coordinates # their birthplace, specifically the coordinates of their birthplace SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } # labels in English } Composers and their most-used tonality #added before 2016-10 # Each composer’s most used tonality, with number of works in that tonality. # (If this is ambiguous – multiple tonalities with the same number – there are multiple results for one composer.) # # The SPARQL for this is an evil perversion of three subqueries (one of them nested in another). # To understand it, you have to go inside out… follow the numbers. SELECT ?composerLabel ?tonalityLabel ?count WHERE { { # 4. Group again, this time just by the composer. # We also select the highest count of a tonality. # Notice that we don’t know what tonality this count is associated with – we’ll get to that. # So now we have each composer, along with how often they used whatever tonality they used most. SELECT ?composer (MAX(?count) AS ?count) WHERE { { # 2. Group by composer and tonality, so that for each composer and tonality, we get a count of how often the composer used this tonality. SELECT ?composer ?tonality (COUNT(?composition) AS ?count) WHERE { # 1. Extremely straightforward: the ?composition has the composer ?composer and the tonality ?tonality. # (I’m not bothering with any “instance of” because the presence of these two properties is a sufficient indicator of ?composition being a composition.) ?composition wdt:P86 ?composer; wdt:P826 ?tonality. } GROUP BY ?composer ?tonality HAVING(?count > 1) # 3. Limit that to counts > 1, because using a tonality once is hardly “most used”. } } GROUP BY ?composer } { # 6. Identical to 2. SELECT ?composer ?tonality (COUNT(?composition) AS ?count) WHERE { # 5. Identical to 1. ?composition wdt:P86 ?composer; wdt:P826 ?tonality. } GROUP BY ?composer ?tonality HAVING(?count > 1) # 7. Identical to 3. } # 8. That’s it. Wait, what? # From 4, we now have ?composer, any composer, and ?count, the count of how often they used whatever tonality they used most. # From 6, we also have a ?composer, as well as a ?tonality, and the count of how often they used that particular tonality. # The trick is that ?composer and ?count are the same variable in each subquery, and so now, when the two subqueries are joined, # we select only that ?tonality from 6 where the ?composer and the ?count are identical to those from 4 – # that is, where this tonality was used as often as the composer’s most-used tonality. # In other words, this must *be* the composer’s most-used tonality (except when there are multiple tonalities with the same count). SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?count) # 9. Order by count (highest first), because the result isn’t very meaningful for low counts (many compositions aren’t on Wikidata or don’t have a tonality statement). Songs with longest melody #added before 2016-10 SELECT ?song ?songLabel ?code WHERE { ?song wdt:P1236 ?code. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(STRLEN(REPLACE(?code, " ", ""))) LIMIT 10 How many musicians dies at certain age #added before 2016-10 # Query to find all musicians who have already died # calculate their age (full years) at death # count how many of them died at each age SELECT ?age (COUNT (DISTINCT ?a) AS ?count) WHERE { ?a wdt:P31 wd:Q5 . #instance of human ?a wdt:P106/wdt:P279 wd:Q639669 . #occupation a subclass of musician ?a p:P569/psv:P569 ?birth_date_node . ?a p:P570/psv:P570 ?death_date_node . ?birth_date_node wikibase:timeValue ?birth_date . ?death_date_node wikibase:timeValue ?death_date . FILTER(?age > 10 && ?age < 100) . #ignore outlyers, several of which are probably errors BIND( year(?death_date) - year(?birth_date) - if(month(?death_date) 2) LIMIT 20000 Painters type of relations with anonymous works #Paintings by anonymous painters, types of relationships with other painters #defaultView:BubbleChart SELECT ?qualifierpropertyLabel (COUNT(?creatorqualifier) AS ?count) WHERE { ?item wdt:P31 wd:Q3305213 . ?item wdt:P170 wd:Q4233718 . OPTIONAL { ?item p:P170 ?creatorstatement . ?creatorstatement rdf:type wikibase:BestRank . ?creatorstatement ?qualifier ?creatorqualifier . ?qualifierproperty wikibase:qualifier ?qualifier } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?qualifierpropertyLabel HAVING (?count > 2) LIMIT 2000 Using formatter url to construct links in SPARQL #Paintings by anonymous painters, types of relationships with other painters #defaultView:BubbleChart SELECT ?qualifierpropertyLabel (COUNT(?creatorqualifier) AS ?count) WHERE { ?item wdt:P31 wd:Q3305213 . ?item wdt:P170 wd:Q4233718 . OPTIONAL { ?item p:P170 ?creatorstatement . ?creatorstatement rdf:type wikibase:BestRank . ?creatorstatement ?qualifier ?creatorqualifier . ?qualifierproperty wikibase:qualifier ?qualifier } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?qualifierpropertyLabel HAVING (?count > 2) LIMIT 2000 Cathedrals in Paris #added before 2016-10 SELECT ?item ?itemLabel ?placeLabel ?coords ?image WHERE { ?item wdt:P31 wd:Q2977 . ?item wdt:P131 ?place . ?place wdt:P131 wd:Q90 . OPTIONAL { ?item wdt:P625 ?coords . } OPTIONAL { ?item wdt:P18 ?image . } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . } } ORDER BY ?placeLabel ?itemLabel Public art in Paris #added before 2016-10 SELECT DISTINCT ?item (SAMPLE (?titleL) AS ?title) (group_concat(distinct ?creatorL ; separator = ", ") as ?creator) (group_concat(distinct ?genreL ; separator = ", ") as ?genre) (group_concat(distinct ?placeL ; separator = ", ") as ?place) (group_concat(distinct ?arr ; separator = ", ") as ?arrondissement) (SAMPLE (?img) AS ?image) (SAMPLE (?coord) AS ?coordinates) WHERE { SELECT ?item ?titleL ?creatorL ?genreL ?placeL ?arr ?img ?coord WHERE { # selecting items... { # items in Paris... ?item wdt:P131 wd:Q90 . } UNION { # ...or in an arrondissement of Paris ?item wdt:P131/wdt:P131* wd:Q90 . } # genre: public art ?item wdt:P136 wd:Q557141 . # creators OPTIONAL { ?item wdt:P170 ?c. ?c rdfs:label ?creatorL filter (lang(?creatorL) = "fr") . } #genre OPTIONAL { { ?item wdt:P136 ?g . FILTER ( STR(?g) != 'http://www.wikidata.org/entity/Q557141') } UNION { ?item wdt:P31 ?g . } ?g rdfs:label ?genreL filter (lang(?genreL) = "fr") . } # place OPTIONAL { ?item wdt:P276 ?p . ?p rdfs:label ?placeL filter (lang(?placeL) = "fr") . } # arrondissement OPTIONAL { ?item wdt:P131 ?a . ?a wdt:P131 wd:Q90 . ?a rdfs:label ?arrL filter (lang(?arrL) = "fr"). BIND(REPLACE(?arrL, '^([0-9]+).*$', "$1", "si") AS ?arr) } Works of art where the name might be a rhyme #added before 2016-10 SELECT ?work ?title WHERE { ?work wdt:P31/wdt:P279* wd:Q838948; wdt:P1476 ?title. FILTER(REGEX(?title, "^\\w*(\\w{3})(\\W+\\w*\\1)+$", "i") && !REGEX(?title, "^(\\w+)(\\W+\\1)+$", "i")). } ORDER BY STR(?title) Works of art where the title is an alliteration #added before 2016-10 SELECT ?work ?title WHERE { ?work wdt:P31/wdt:P279* wd:Q838948; wdt:P1476 ?title. FILTER(REGEX(STR(?title), "^(\\p{L})\\w+(?:\\W+\\1\\w+){2,}$", "i")). } ORDER BY STR(?title) Distribution of public art by place #added before 2016-10 SELECT ?work ?title WHERE { ?work wdt:P31/wdt:P279* wd:Q838948; wdt:P1476 ?title. FILTER(REGEX(STR(?title), "^(\\p{L})\\w+(?:\\W+\\1\\w+){2,}$", "i")). } ORDER BY STR(?title) Birthplaces of Europeana280 artists #added before 2016-10 #defaultView:Map SELECT ?creator ?creatorLabel ?placebirthLabel ?geoloc where { ?item wdt:P31/wdt:P279* wd:Q838948 . # œuvre d’art et ss-classe ?item wdt:P608 wd:Q20980830 . # du projet Europeana 280 ?item wdt:P170 ?creator . # créateur ?creator wdt:P19 ?placebirth . # lieu de naissance ?placebirth wdt:P625 ?geoloc . #coordonnées géo SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,es,en" . } } Female artists #added before 2016-10 SELECT DISTINCT ?women ?womenLabel WHERE { ?women wdt:P31 wd:Q5 . ?women wdt:P21 wd:Q6581072 . ?women wdt:P106/wdt:P279* wd:Q483501 . # artists SERVICE wikibase:label {bd:serviceParam wikibase:language "fr,en" } } LIMIT 500 Common phrases #added before 2016-10 SELECT ?q ?qLabel WHERE { ?q wdt:P31 wd:Q15841920. SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Artists entering in public domain by countries #added before 2017-02 SELECT ?item ?itemLabel ?genderLabel (GROUP_CONCAT(DISTINCT ?occupationLabel; SEPARATOR=", ") AS ?occupations) (GROUP_CONCAT(DISTINCT ?countryLabel; SEPARATOR=", ") AS ?countries) ?death { VALUES ?target_country { wd:Q16 wd:Q31 wd:Q39 wd:Q142 } . #countries: Canada, France, Switzerland, Belgium. Remove this line to get worldwide. VALUES ?occupation { wd:Q483501 wd:Q36834 wd:Q639669 wd:Q753110 wd:Q488205 wd:Q49757 wd:Q4964182 wd:Q1281618 wd:Q36180 wd:Q482980 wd:Q1028181 wd:Q6625963 wd:Q28389 wd:Q1930187 wd:Q33999 wd:Q3282637 wd:Q81096 wd:Q201788 wd:Q18939491 wd:Q486748 wd:Q3658608 wd:Q214917 wd:Q11774202 wd:Q205375 } . #occupation: composer, poet, sculptor, writer, artist, painter, etc. ?item wdt:P31 wd:Q5; wdt:P21 ?gender; wdt:P570 ?death; wdt:P27 ?target_country; wdt:P27 ?country; wdt:P106 ?occupation . FILTER( YEAR( ?death ) = 1966 ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en,ru,el,es,fa" . ?item rdfs:label ?itemLabel . ?gender rdfs:label ?genderLabel . ?occupation rdfs:label ?occupationLabel . ?country rdfs:label ?countryLabel . } . } GROUP BY ?item ?itemLabel ?genderLabel ?death ORDER BY ?itemLabel Sandwiches #added before 2016-10 #defaultView:ImageGrid SELECT ?item ?itemLabel ?_image WHERE { ?item wdt:P279 wd:Q28803. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } OPTIONAL { ?item wdt:P18 ?_image. } } LIMIT 100 Sandwich ingredients #added before 2016-10 SELECT ?sandwich ?ingredient ?sandwichLabel ?ingredientLabel WHERE { ?sandwich wdt:P31?/wdt:P279* wd:Q28803; wdt:P527 ?ingredient. MINUS { ?ingredient wdt:P279* wd:Q7802. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en", "fr". } } ORDER BY UCASE(STR(?sandwichLabel)) What is the relation between Terrell Buckley and Miami Dolphins? #added before 2016-10 SELECT ?l WHERE { wd:Q5571382 ?p wd:Q223243 . ?property ?ref ?p . ?property rdf:type wikibase:Property . ?property rdfs:label ?l FILTER (lang(?l) = "en") } The awards received by Cristiano Ronaldo by year SELECT ?entity ?desc (year(?date) as ?year) { wd:Q11571 p:P166 [ps:P166 ?entity ; pq:P585 ?date ] OPTIONAL { ?entity rdfs:label ?desc FILTER((LANG(?desc)) = "en") } } ORDER BY ?year Female brewer SELECT ?entity ?desc (year(?date) as ?year) { wd:Q11571 p:P166 [ps:P166 ?entity ; pq:P585 ?date ] OPTIONAL { ?entity rdfs:label ?desc FILTER((LANG(?desc)) = "en") } } ORDER BY ?year Female scientists # Female scientists SELECT ?item ?itemLabel ?lastnameLabel ?birthdate ?deathdate ?nationalityLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P21 wd:Q6581072 . ?item wdt:P106/wdt:P279* wd:Q901 . optional { ?item wdt:P734 ?lastname . } optional { ?item wdt:P569 ?birthdate . } optional { ?item wdt:P570 ?deathdate . } optional { ?item wdt:P27 ?nationality . } SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,en,fr,de,es,it,no" } } order by ?itemLabel Verify women descriptions SELECT ?item ?itemLabel ?occupationLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q5. ?item wdt:P21 wd:Q6581072. ?item wdt:P27 wd:Q31. optional{ ?item wdt:P106 ?occupation. } SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". } } Streets in France named after a woman SELECT ?item ?itemLabel ?occupationLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q5. ?item wdt:P21 wd:Q6581072. ?item wdt:P27 wd:Q31. optional{ ?item wdt:P106 ?occupation. } SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". } } Most common Zika author SELECT ?short_author ?short_authorLabel (count(?item) as ?count) WHERE { { ?item wdt:P921 wd:Q202864 . } UNION { ?item wdt:P921 wd:Q8071861 . } {?item wdt:P2093 ?short_author .} UNION {?item wdt:P50 ?short_author .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?short_author ?short_authorLabel ORDER BY DESC(?count) Scientific articles that have subject Zika virus or fever and that are used as a reference in another item #added before 2016-10 SELECT ?item ?itemLabel ?reference ?referenceType WHERE { ?item wdt:P31 wd:Q13442814#Scientific article { ?item wdt:P921 wd:Q202864 } #Zika virus UNION { ?item wdt:P921 wd:Q8071861 } #Zika fever ?reference ?referenceType ?item #find references to item having any property and store reference type SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Get the Wikipathways citation corpus SELECT ?wpid ?item ?itemLabel ?referenceLabel WHERE { ?item wdt:P2410 ?wpid ; wdt:P2860 ?reference ; SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Get the Reactome citation corups SELECT ?reactome_id ?item ?itemLabel ?referenceLabel WHERE { ?item wdt:P3937 ?reactome_id ; wdt:P2860 ?reference ; SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Suriname citation corpora SELECT ?reactome_id ?item ?itemLabel ?referenceLabel WHERE { ?item wdt:P3937 ?reactome_id ; wdt:P2860 ?reference ; SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Disease items with statements capturing Disease Ontology IDs that haven't been update for more then a month SELECT ?item ?itemLabel ?_PubMed_ID WHERE { ?item wdt:P31 wd:Q13442814 ; rdfs:label ?itemLabel . FILTER(CONTAINS(LCASE(?itemLabel), "suriname")) OPTIONAL { ?item wdt:P698 ?_PubMed_ID. } } Items on human genes that haven't been updated for more then a month #added before 2016-10 SELECT DISTINCT ?date_range ?date_update (count(?gene) as ?counts) (GROUP_CONCAT(?gene ;separator = "; ") as ?genes) (GROUP_CONCAT(?ncbi_gene ;separator = "; ") as ?gene_ids) WHERE { ?gene p:P351 ?ncbigene ; wdt:P351 ?ncbi_gene . ?ncbigene prov:wasDerivedFrom ?derivedFrom . ?derivedFrom pr:P813 ?date_update . BIND (now() - ?date_update as ?date_range) FILTER (?date_range > 31) } GROUP BY ?date_range ?date_update ORDER BY DESC(?counts) Missing description for a target language #Search for missing descriptions in a target language. #Can be input for Q29032512 SELECT ?item ?itemLabel ?genderLabel ?occupationLabel ?domainLabel ?positionLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q5. # instance of human ?item wdt:P27 wd:Q31. # country of citizenship Belgium optional{ ?item wdt:P21 ?gender.} optional{ ?item wdt:P106 ?occupation.} optional{ ?item wdt:P101 ?domain.} optional{ ?item wdt:P39 ?position.} SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,fr,en,de,it,es,pt,no". } FILTER(NOT EXISTS { ?item schema:description ?itemdesc. FILTER(LANG(?itemdesc) = "nl") # with missing Dutch description }) } order by ?itemLabel Identifying redirects and their targets in a list of QIDs # Identify redirects using item property owl:sameAs SELECT (REPLACE(STR(?item),".*Q","Q") AS ?qid) (REPLACE(STR(?tgt),".*Q","Q") AS ?tgtQid) ?tgtLabel WHERE { VALUES (?item) { (wd:Q6636058) (wd:Q8989284) (wd:Q243634) (wd:Q13383295) (wd:Q659516) (wd:Q1020776) (wd:Q10124662) (wd:Q9066399) (wd:Q12309669) (wd:Q16033883) (wd:Q733744) (wd:Q226569) (wd:Q14210256) (wd:Q408041) (wd:Q750594) (wd:Q11075312) } ?item owl:sameAs ?tgt . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?qid Find duplicate IMDB identifiers #added before 2016-10 SELECT * WHERE { { SELECT ?id (COUNT(?obj) AS ?count) (GROUP_CONCAT(?obj; SEPARATOR = " , ") AS ?items) WHERE { ?obj wdt:P345 ?id. } GROUP BY ?id } FILTER(?count > 1) } Administrative entities located within themselves #added before 2016-10 SELECT ?x WHERE { ?x wdt:P131 ?x . } People born before year 1880 with no death date #added before 2016-10 SELECT ?x WHERE { ?x wdt:P131 ?x . } Properties that are defined as "qualifier only" but are used in references #added before 2016-10 SELECT ?h ?date WHERE { ?h wdt:P31 wd:Q5 . ?h wdt:P569 ?date . OPTIONAL {?h wdt:P570 ?d } FILTER (?date < "1880-01-01T00:00:00Z"^^xsd:dateTime) FILTER (!bound(?d)) } LIMIT 100 Objects that have globe which does not match their coordinates #added before 2016-10 SELECT ?item ?body ?globe WHERE { ?item wdt:P376 ?body . ?item p:P625/psv:P625/wikibase:geoGlobe ?globe . filter (?globe != ?body) . } LIMIT 30 Aliases of properties which are used more than once #added before 2016-10 SELECT ?item ?body ?globe WHERE { ?item wdt:P376 ?body . ?item p:P625/psv:P625/wikibase:geoGlobe ?globe . filter (?globe != ?body) . } LIMIT 30 Actresses without a description in Spanish #added before 2016-10 SELECT DISTINCT ?item ?itemLabel WHERE { ?item wdt:P106 wd:Q33999 . ?item wdt:P21 wd:Q6581072 . OPTIONAL { ?item schema:description ?itemDescription } FILTER (!BOUND(?itemDescription)) ?item wdt:P31 wd:Q5 . SERVICE wikibase:label { bd:serviceParam wikibase:language "es"} } LIMIT 111 French people with an article on the English Wikipedia but not on the French one #added before 2016-10 SELECT ?item ?itemLabel (COUNT(distinct ?sitelink) as ?count) WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q142 . ?sitelink schema:about ?item . FILTER EXISTS { ?wen schema:about ?item . ?wen schema:inLanguage "en" } FILTER NOT EXISTS { ?wfr schema:about ?item . ?wfr schema:inLanguage "fr" } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . } } GROUP BY ?item ?itemLabel ORDER BY DESC(?count) Deprecated rank statements #added before 2016-10 SELECT ?wdLabel ?wdPLabel ?valueLabel ?wd ?wdP ?wds ?value WHERE { hint:Query hint:optimizer "None" . ?wds wikibase:rank wikibase:DeprecatedRank . ?wd ?p ?wds . ?wds ?v ?value . ?wdP wikibase:statementProperty ?v . ?wdP wikibase:claim ?p . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } LIMIT 100 Actors whose Spanish label ends with “ (actor)” #added before 2016-10 SELECT ?wdLabel ?wdPLabel ?valueLabel ?wd ?wdP ?wds ?value WHERE { hint:Query hint:optimizer "None" . ?wds wikibase:rank wikibase:DeprecatedRank . ?wd ?p ?wds . ?wds ?v ?value . ?wdP wikibase:statementProperty ?v . ?wdP wikibase:claim ?p . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } LIMIT 100 Labels containing HTML escape sequences #added before 2016-10 SELECT ?item ?label WHERE { ?item rdfs:label ?label. FILTER CONTAINS(?label, """). } LIMIT 1 Person labels containing parentheses #added before 2016-10 SELECT ?item ?label WHERE { ?item rdfs:label ?label. FILTER CONTAINS(?label, """). } LIMIT 1 Instances of weapon #added before 2016-10 SELECT ?weapon ?weaponLabel WHERE { ?weapon wdt:P31/wdt:P279* wd:Q728. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Non-integer populations #added before 2016-10 SELECT ?weapon ?weaponLabel WHERE { ?weapon wdt:P31/wdt:P279* wd:Q728. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Odd countries #added before 2016-10 SELECT ?item ?country ?itemLabel ?countryLabel WHERE { ?item wdt:P17 ?country. MINUS { ?country wdt:P31/wdt:P279* wd:Q7275. } # excludes normal countries MINUS { ?country wdt:P31/wdt:P279* wd:Q183366. } # excludes Scotland MINUS { ?country wdt:P31/wdt:P279* wd:Q15893266. } # excludes Brittany MINUS { ?country wdt:P31/wdt:P279* wd:Q1048835. } # excludes the European Union SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 1000 Paintings on taxons #added before 2016-10 SELECT ?item ?country ?itemLabel ?countryLabel WHERE { ?item wdt:P17 ?country. MINUS { ?country wdt:P31/wdt:P279* wd:Q7275. } # excludes normal countries MINUS { ?country wdt:P31/wdt:P279* wd:Q183366. } # excludes Scotland MINUS { ?country wdt:P31/wdt:P279* wd:Q15893266. } # excludes Brittany MINUS { ?country wdt:P31/wdt:P279* wd:Q1048835. } # excludes the European Union SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 1000 Descriptions that are just the default Portuguese description #added before 2016-10 SELECT ?material ?painting ?materialLabel ?paintingLabel WHERE { ?painting wdt:P31/wdt:P279* wd:Q3305213; p:P186 [ ps:P186 ?material; pq:P518 wd:Q861259 ]. ?material wdt:P31 wd:Q16521. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Descriptions that are just the default English description #added before 2016-10 SELECT ?item ?label WHERE { ?item schema:description "enter a description"@en. OPTIONAL { ?item rdfs:label ?label. FILTER(LANG(?label) = "en"). } } Items that are simultaneously instance and subclass of the same class #added before 2016-10 SELECT ?item ?label WHERE { ?item schema:description "enter a description"@en. OPTIONAL { ?item rdfs:label ?label. FILTER(LANG(?label) = "en"). } } Items with specific picture #added before 2016-10 SELECT ?item ?itemLabel WHERE { ?item wdt:P18 SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } LIMIT 100 Language statements that point to a country #added before 2016-10 SELECT DISTINCT ?work ?workLabel ?languageLabel WHERE { ?work wdt:P37|wdt:P103|wdt:P364|wdt:P407|wdt:P1412 ?language. ?language wdt:P31/wdt:P279* wd:Q7275. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ?languageLabel People with statements where start and end time are over 100 years apart #added before 2016-10 SELECT ?person ?personLabel ?duration WHERE { ?person wdt:P31 wd:Q5; ?p [ pq:P580 ?start; pq:P582 ?end ]. BIND(ROUND((?end - ?start)/365.2425) AS ?duration). FILTER(?duration > 100). FILTER(?p != p:P119) . # "place of burial" can be an exception SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?duration) Human gene items with unreferenced statements #added before 2016-10 SELECT ?prop (count(?prop) as ?counts) WHERE {SELECT DISTINCT ?item ?prop WHERE { ?item wdt:P279 wd:Q7187 ; wdt:P703 wd:Q5 ; ?prop ?statement . FILTER(!(regex(str(?prop), "http://www.wikidata.org/prop/direct/" ) )) FILTER(regex(str(?prop), "http://www.wikidata.org/prop/" ) ) FILTER NOT EXISTS { ?item ?prop ?statement . ?statement prov:wasDerivedFrom ?derivedFrom .} } } GROUP BY ?prop ORDER BY desc(?counts) Capitals that aren’t capitals #added before 2016-10 SELECT ?capital ?capitalLabel ?ofLabel ?start ?end WHERE { ?capital p:P31 ?capitalStat. ?capitalStat ps:P31 wd:Q5119. OPTIONAL { ?capitalStat pq:P642 ?of. } OPTIONAL { ?capitalStat pq:P580 ?start. } OPTIONAL { ?capitalStat pq:P582 ?end. } MINUS { [] wdt:P36 ?capital. } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Chemical compounds with no CAS registry number #added before 2016-10 #All CAS registry numbers in Wikidata SELECT DISTINCT ?compound ?compoundLabel ?formula ?inchikey ?chemspider ?pubchem WHERE { ?compound wdt:P31 wd:Q11173 . OPTIONAL { ?compound wdt:P231 ?cas . } OPTIONAL { ?compound wdt:P274 ?formula . } OPTIONAL { ?compound wdt:P235 ?inchikey . } OPTIONAL { ?compound wdt:P661 ?chemspider . } OPTIONAL { ?compound wdt:P662 ?pubchem . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } FILTER(!BOUND(?cas)) } Human settlements that are not described in the English Wikipedia # settlements not being described in the English Wikipedia #defaultView:Map SELECT DISTINCT ?settlement ?settlementLabel ?coor WHERE { VALUES ?type {wd:Q3957 wd:Q515 wd:Q532 wd:Q486972} ?settlement wdt:P31 wd:Q3957 ; wdt:P625 ?coor . ?article schema:about ?settlement . FILTER NOT EXISTS { ?wen schema:about ?settlement ; schema:inLanguage "en" } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Human settlements not being described in any language version of Wikipedia # settlements not being described in the English Wikipedia #defaultView:Map SELECT DISTINCT ?settlement ?settlementLabel ?coor WHERE { VALUES ?type {wd:Q3957 wd:Q515 wd:Q532 wd:Q486972} ?settlement wdt:P31 wd:Q3957 ; wdt:P625 ?coor . ?article schema:about ?settlement . FILTER NOT EXISTS { ?wen schema:about ?settlement ; schema:inLanguage "en" } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Files used as “image” in more than 10 items #added before 2016-10 SELECT ?image (count(?image) AS ?cnt) (group_concat(?item) AS ?items) { ?item wdt:P18 ?image } group by ?image having (?cnt>10) Properties, their labels, descriptions and if they exist of which they are a subproperty #added before 2016-10 SELECT DISTINCT ?property ?propertyLabel ?propertyDescription ?subpropertyOf ?subpropertyOfLabel WHERE { ?property rdf:type wikibase:Property . OPTIONAL {?property wdt:P1647 ?subpropertyOf .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Most frequent occupations without a label in a given language #added before 2016-10 #Most frequent occupations without a label in Latvian (lv) #by Edgars2007/Jura1, 2016-05-09 SELECT ?occup ?occupLabel ?count WHERE { { SELECT ?occup (COUNT(?person) as ?count) WHERE { ?person wdt:P106 ?occup } GROUP BY ?occup ORDER BY DESC(?count) LIMIT 1000 } OPTIONAL {?occup rdfs:label ?label1 filter(lang(?label1) = "lv")} FILTER(!BOUND(?label1)) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,pl,ja,zh,ru" } } ORDER BY DESC(?count) LIMIT 50 Items and properties where the description is the same as the label #Items and properties where the description is the same as the label #by YMS, 2016-09-26 select distinct ?item ?label ?description (lang(?label) as ?lang) where { ?item rdfs:label ?label filter(str(?label) = str(?description)). ?item schema:description ?description filter(lang(?label) = lang(?description)). } limit 50 A batch of entities that were imported from Commons that would need to be merged with pre-existing entities SELECT ?subject ?subjectLabel ?gallery WHERE { ?subject wdt:P31 wd:Q5 . ?subject wdt:P935 ?gallery. FILTER NOT EXISTS { ?subject wdt:P18 ?x } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" } FILTER regex(str(?subject), "Q211", "i") } LIMIT 100 How many people are there whose "number of children (P1971)" matches with "child (P40)"? SELECT (COUNT(DISTINCT(?person)) AS ?countPerson) WHERE { { # non-zero number of children matches ?person wdt:P1971 ?numOfChildren . {SELECT ?person (COUNT(?child) AS ?numOfChildrenComputed) WHERE { ?person wdt:P40 ?child } GROUP BY ?person} FILTER (?numOfChildren = ?numOfChildrenComputed) } UNION { # zero number of children matches ?person wdt:P1971 "0"^^xsd:decimal . FILTER NOT EXISTS { ?person wdt:P40 ?child } } } Class distribution of a property SELECT ?class (COUNT(?subject) AS ?countSubject) WHERE { { SELECT DISTINCT ?subject ?class WHERE { ?subject wdt:P40 ?object . ?subject wdt:P31 ?class } } } GROUP BY ?class ORDER BY DESC(?countSubject) Disambiguation pages entities used as publishers SELECT ?publisher ?publisherLabel ?work WHERE { # entities used as publisher ?work wdt:P123 ?publisher . # but that are actually a disambiguation page ?publisher wdt:P31 wd:Q4167410 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,de" . } } Instances of actual languages SELECT ?publisher ?publisherLabel ?work WHERE { # entities used as publisher ?work wdt:P123 ?publisher . # but that are actually a disambiguation page ?publisher wdt:P31 wd:Q4167410 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,de" . } } Look up q-codes based on English description SELECT ?lab ?item WHERE { ?item rdfs:label ?lab . MINUS {?item wdt:P31 wd:Q4167836 } . # no category items VALUES ?lab {"Agelenopsis pennsylvanica"@en "Agelenopsis potteri"@en "Anelosimus studiosus"@en } . } CONSTRUCT query to get the RDF graph for a Wikidata item (e.g. asthma) CONSTRUCT { wd:Q35869 ?p ?o . ?o ?qualifier ?f . ?o prov:wasDerivedFrom ?u . ?u ?a ?b . } WHERE { wd:Q35869 ?p ?o . optional {?o ?qualifier ?f .} OPTIONAL {?o prov:wasDerivedFrom ?u . ?u ?a ?b .} } Personendaten template equivalent (dewiki) CONSTRUCT { wd:Q35869 ?p ?o . ?o ?qualifier ?f . ?o prov:wasDerivedFrom ?u . ?u ?a ?b . } WHERE { wd:Q35869 ?p ?o . optional {?o ?qualifier ?f .} OPTIONAL {?o prov:wasDerivedFrom ?u . ?u ?a ?b .} } People that have a label in Hebrew, but their given name doesn't have a label in Hebrew SELECT ?item ?itemLabelHE ?name WHERE { ?item wdt:P31 wd:Q5. ?item wdt:P735 ?name. FILTER NOT EXISTS {?name rdfs:label ?nameLabelHE filter (lang(?nameLabelHE) = "he")} . ?item rdfs:label ?itemLabelHE filter (lang(?itemLabelHE) = "he") . } Fathers with non-existent or unusual gender statements # Fathers with non-existent or unusual gender statements SELECT (?father as ?father_id) ?father_name ?father_is_a ?father_gender (?child as ?child_id) ?child_name ?child_is_a WHERE { ?child wdt:P22 ?father . ?father wdt:P31 ?f_is_a . #?father wdt:P31 wd:Q5 . ?child wdt:P31 ?c_is_a . #?child wdt:P31 wd:Q5 . OPTIONAL { ?father wdt:P21 ?f_gender . } # Aliases for the headings in the results table. Must be done this way because # SELECT (?var as ?varAlias) works, but (?varLabel as ?varLabelAlias) doesn't. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . ?father rdfs:label ?father_name . ?f_is_a rdfs:label ?father_is_a . ?f_gender rdfs:label ?father_gender . ?child rdfs:label ?child_name . ?c_is_a rdfs:label ?child_is_a . } # Show only results where the father's gender: FILTER( # ...is not set NOT EXISTS { ?father wdt:P21 [] } # ...or is set to something other than "male" or "male organism", or "unknown value" {{!!}} ?f_gender NOT IN(wd:Q6581097, wd:Q44148) && !isBLANK(?f_gender) ) } ORDER BY DESC(?f_gender) Animals owned by people holding any position # Fathers with non-existent or unusual gender statements SELECT (?father as ?father_id) ?father_name ?father_is_a ?father_gender (?child as ?child_id) ?child_name ?child_is_a WHERE { ?child wdt:P22 ?father . ?father wdt:P31 ?f_is_a . #?father wdt:P31 wd:Q5 . ?child wdt:P31 ?c_is_a . #?child wdt:P31 wd:Q5 . OPTIONAL { ?father wdt:P21 ?f_gender . } # Aliases for the headings in the results table. Must be done this way because # SELECT (?var as ?varAlias) works, but (?varLabel as ?varLabelAlias) doesn't. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . ?father rdfs:label ?father_name . ?f_is_a rdfs:label ?father_is_a . ?f_gender rdfs:label ?father_gender . ?child rdfs:label ?child_name . ?c_is_a rdfs:label ?child_is_a . } # Show only results where the father's gender: FILTER( # ...is not set NOT EXISTS { ?father wdt:P21 [] } # ...or is set to something other than "male" or "male organism", or "unknown value" {{!!}} ?f_gender NOT IN(wd:Q6581097, wd:Q44148) && !isBLANK(?f_gender) ) } ORDER BY DESC(?f_gender) Properties of type external-id # Make a list of properties of the type external-id SELECT ?property ?propertyLabel ?propertyDescription WHERE { ?property wikibase:propertyType wikibase:ExternalId . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?propertyLabel Biografisch Portaal number with not enough statements # Make a list of items that have Biografisch Portaal number (P651), but have less than 6 statements # The minimum set of statements expected are: # * Biografisch Portaal number (P651) # * instance of (P31) -> human (Q5) # * sex or gender (P21) # * place of birth (P19) # * date of birth (P569) # The SPARQL database isn't complete up to date for the number of statements so this query will return less or wrong items. SELECT ?item ?itemLabel ?itemDescription ?statementcount WHERE { ?item wdt:P651 [] . ?item wikibase:statements ?statementcount . FILTER (?statementcount < 6 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl" . } } ORDER BY ?itemLabel Most specific parent classes of Wikidata classes # What is or are the lowest common ancestor(s) of a # church, a mosque, a synagogue and a palace in the # Wikidata ontology ? Answer : an architectural structure SELECT ?lcs ?lcsLabel WHERE { ?lcs ^wdt:P279* wd:Q32815, wd:Q34627, wd:Q16970, wd:Q16560 . filter not exists { ?sublcs ^wdt:P279* wd:Q32815, wd:Q34627, wd:Q16970, wd:Q16560 ; wdt:P279 ?lcs . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en" . } } Overall causes of death ranking #defaultView:BubbleChart #TEMPLATE={"template":"Overall causes of death ranking of ?thing ","variables":{"?thing": {"query":"SELECT ?id (COUNT(?id) AS ?count) WHERE { ?sub wdt:P509 ?y. ?sub wdt:P31 ?id. } GROUP BY ?id "} } } SELECT ?cid ?cause (COUNT(*) AS ?count) WHERE { BIND(wd:Q5 AS ?thing) ?pid wdt:P31 ?thing; wdt:P509 ?cid. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?cid rdfs:label ?cause} } GROUP BY ?cid ?cause ORDER BY DESC(?count) ?cause Timeline of space probes #defaultView:Timeline SELECT ?item ?itemLabel ?launchdate (SAMPLE(?image) AS ?image) WHERE { ?item wdt:P31 wd:Q26529 . ?item wdt:P619 ?launchdate . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } OPTIONAL { ?item wdt:P18 ?image } } GROUP BY ?item ?itemLabel ?launchdate Dimensions of elements #defaultView:Dimensions SELECT ?elementLabel ?boiling_point ?melting_point ?electronegativity ?density ?mass WHERE { ?element wdt:P31 wd:Q11344; wdt:P2102 ?boiling_point; wdt:P2101 ?melting_point; wdt:P1108 ?electronegativity; wdt:P2054 ?density; wdt:P2067 ?mass. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } LIMIT 100 Children of Genghis Khan #defaultView:Graph PREFIX gas: SELECT ?item ?itemLabel ?pic ?linkTo WHERE { SERVICE gas:service { gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP" ; gas:in wd:Q720 ; gas:traversalDirection "Forward" ; gas:out ?item ; gas:out1 ?depth ; gas:maxIterations 4 ; gas:linkType wdt:P40 . } OPTIONAL { ?item wdt:P40 ?linkTo } OPTIONAL { ?item wdt:P18 ?pic } SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } Average number of children per year #defaultView:LineChart SELECT (str(?year) AS ?year) (AVG( ?_number_of_children ) AS ?count) WHERE { ?item wdt:P31 wd:Q5. ?item wdt:P1971 ?_number_of_children. ?item wdt:P569 ?_date_of_birth. BIND( year(?_date_of_birth) as ?year ). FILTER( ?year > 1900) } GROUP BY ?year Battles per year per country last 80 years #defaultView:BarChart SELECT(SAMPLE(?year) AS ?year) (COUNT(?_country) AS ?battles) (SAMPLE(?_countryLabel) AS ?_countryLabel) WHERE { ?subj wdt:P31 wd:Q178561. # instance of battle OPTIONAL { ?subj wdt:P580 ?d1. } # start time OPTIONAL { ?subj wdt:P585 ?d2. } # point in time OPTIONAL { ?subj wdt:P582 ?d3. } # end time BIND(IF(!BOUND(?d1), IF(!BOUND(?d2), ?d3, ?d2), ?d1) AS ?date) BIND(STR(YEAR(?date)) AS ?year) FILTER(BOUND(?year)) ?subj wdt:P276/wdt:P17 ?_country. # country of location of battle BIND((NOW()) - ?date AS ?distance) FILTER((0 <= ?distance) && (?distance < 31 * 12 * 80)) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?_country rdfs:label ?_countryLabel.} } GROUP BY ?year ?_country ORDER BY ?_countryLabel Cancer deaths per year and cancer type #defaultView:AreaChart SELECT ?cid (STR(SAMPLE(?year)) AS ?year) (COUNT(*) AS ?count) ?cause WHERE { ?pid wdt:P31 wd:Q5; # instance of human wdt:P509 ?cid; # cause of death wdt:P570 ?_date_of_death. ?cid wdt:P279* wd:Q12078. # type of cancer SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?cid rdfs:label ?cause. } BIND ( YEAR(?_date_of_death) AS ?year ) FILTER( ?year > 1960 ) } GROUP BY ?cid ?cause ?year Continents, countries, regions and capitals #defaultView:Tree SELECT ?continent ?continentFlag ?continentLabel ?country ?countryLabel ?countryFlag ?region ?regionLabel ?regionFlag ?city ?cityLabel ?cityImage ?property ?propertyLabel ?value ?valueLabel WHERE { { SELECT * WHERE { ?continent wdt:P31 wd:Q5107. ?country wdt:P30 ?continent. ?country wdt:P31 wd:Q6256. ?country wdt:P150 ?region. OPTIONAL { ?continent wdt:P242 ?continentFlag. ?country wdt:P41 ?countryFlag. ?region wdt:P41 ?regionFlag. } OPTIONAL { ?region wdt:P36 ?city. ?city wdt:P31 wd:Q515. ?city wdt:P18 ?cityImage. OPTIONAL { VALUES (?prop) { (wdt:P1082) (wdt:P6) (wdt:P190) (wdt:P31) (wdt:P571) (wdt:P150) (wdt:P206) (wdt:P527) } ?city ?prop ?value. ?property ?ref ?prop. ?property rdf:type wikibase:Property. } } } } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Popular television series (in treeview) #added before 2016-10 #defaultView:TreeMap SELECT ?show ?showLabel ?season ?cleanSeasonLabel ?episode ?episodeLabel WHERE { { BIND(wd:Q886 as ?show) . ?season wdt:P361 ?show . ?season rdfs:label ?_seasonLabel. FILTER((LANG(?_seasonLabel)) = "en") BIND(SUBSTR(?_seasonLabel, 0, STRLEN(?_seasonLabel)-23) AS ?cleanSeasonLabel) ?episode wdt:P361 ?season . } UNION { BIND(wd:Q16538 as ?show) . ?season wdt:P361 ?show . ?season rdfs:label ?_seasonLabel. FILTER((LANG(?_seasonLabel)) = "en") BIND(SUBSTR(?_seasonLabel, 0, STRLEN(?_seasonLabel)-20) AS ?cleanSeasonLabel) ?episode wdt:P361 ?season . } UNION { BIND(wd:Q147235 as ?show) . ?season wdt:P361 ?show . ?season rdfs:label ?_seasonLabel. FILTER((LANG(?_seasonLabel)) = "en") BIND(CONCAT("S", SUBSTR(?_seasonLabel, 25)) AS ?cleanSeasonLabel) ?episode wdt:P361 ?season . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Number of films by year and genre #defaultView:ScatterChart SELECT ?year (COUNT(?_genre) AS ?count ) (SAMPLE(?_genreLabel) AS ?label ) (?year as ?year_shown) WHERE { ?item wdt:P31 wd:Q11424. ?item wdt:P577 ?_publication_date. ?item wdt:P136 ?_genre. ?_genre rdfs:label ?_genreLabel. BIND(str(YEAR(?_publication_date)) AS ?year) FILTER((LANG(?_genreLabel)) = "en") FILTER (?_publication_date >= "2000-00-00T00:00:00Z"^^xsd:dateTime) } GROUP BY ?_genreLabel ?year HAVING (?count > 30) Locations of national parks #defaultView:Map SELECT ?objectLabel ?objectDescription ?link ?coord WHERE { ?object wdt:P31/wdt:P279? wd:Q46169 ; wdt:P856 ?link ; wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr" } } Properties grouped by their parent property #Properties grouped by their parent property #TODO: should display links and numeric ids #defaultView:Tree SELECT ?property2 ?property2Label ?property1 ?property1Label WHERE { ?property1 rdf:type wikibase:Property. #not replaceable with wikibase:Item, wikibase:Statement, wikibase:Reference at WDQS #https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#WDQS_data_differences ?property1 wdt:P1647 ?property2. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Rock bands that start with "M" SELECT DISTINCT ?band ?bandLabel WHERE { ?band wdt:P31 wd:Q5741069 . ?band rdfs:label ?bandLabel . FILTER(STRSTARTS(?bandLabel, 'M')) . } Continents #added before 2016-10 SELECT ?continent ?continentLabel WHERE { ?continent wdt:P31 wd:Q5107. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY xsd:integer(SUBSTR(STR(?continent),STRLEN("http://www.wikidata.org/entity/Q")+1)) List of present-day countries and capital(s) #added before 2016-10 SELECT DISTINCT ?country ?countryLabel ?capital ?capitalLabel WHERE { ?country wdt:P31 wd:Q3624078 . #not a former country FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240} #and no an ancient civilisation (needed to exclude ancient Egypt) FILTER NOT EXISTS {?country wdt:P31 wd:Q28171280} OPTIONAL { ?country wdt:P36 ?capital } . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY ?countryLabel Former capitals #added before 2016-10 #defaultView:Map SELECT DISTINCT ?country ?countryLabel ?capital ?capitalLabel ?coordinates ?ended WHERE { ?country p:P36 ?stat. ?stat ps:P36 ?capital. ?capital wdt:P625 ?coordinates. OPTIONAL { ?country wdt:P582|wdt:P576 ?ended. } OPTIONAL { ?capital wdt:P582|wdt:P576 ?ended. } OPTIONAL { ?stat pq:P582 ?ended. } FILTER(BOUND(?ended)). SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } grouped by dist range, color-coded #defaultView:BarChart PREFIX var_muntype: PREFIX var_area: SELECT ?from ?to ?distGrp WHERE { { SELECT ?from ?to ?distNum ?mun ?mun2 WHERE { { SELECT ?mun (SAMPLE(?loc) AS ?loc) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } OPTIONAL { { SELECT (?mun AS ?mun2) (SAMPLE(?loc) AS ?loc2) WHERE { ?mun wdt:P31/wdt:P279* var_muntype:; wdt:P131 var_area:; wdt:P625 ?loc. } GROUP BY ?mun } } BIND(geof:distance(?loc, ?loc2) AS ?distNum). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?mun rdfs:label ?from. ?mun2 rdfs:label ?to. } } } FILTER(CONCAT(?from,STR(?mun)) <= CONCAT(?to,STR(?mun2))). #BIND(IF(STR(?from) < STR(?to),CONCAT(?from," <--> ",?to), # CONCAT(?to," <--> ",?from)) AS ?distLabel). BIND(COALESCE( IF(?distNum >= 40, "40 - .. km", 1/0), IF(?distNum >= 30, "30 - 40 km", 1/0), IF(?distNum >= 20, "20 - 30 km", 1/0), IF(?distNum >= 10, "10 - 20 km", 1/0), IF(?distNum >= 5, "05 - 10 km", 1/0), IF(?distNum >= 1, "01 - 05 km", "00 - 01 km")) AS ?distGrp). } ORDER BY ?from ?distGrp Longest rivers #added before 2016-10 #defaultView:BubbleChart SELECT ?item ?itemLabel ?length ?pic ?location WHERE { ?item wdt:P31/wdt:P279* wd:Q4022 . ?item wdt:P2043 ?length . ?item wdt:P18 ?pic . ?item wdt:P625 ?location SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY DESC(?length) ?itemLabel LIMIT 50 Mountains, with coordinates, not located on Earth SELECT DISTINCT ?item ?name ?coord ?lat ?lon ?globe { ?item wdt:P31 wd:Q8502 ; p:P625 [ psv:P625 [ wikibase:geoLatitude ?lat ; wikibase:geoLongitude ?lon ; wikibase:geoGlobe ?globe ; ] ; ps:P625 ?coord ] FILTER ( ?globe != wd:Q2 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?item rdfs:label ?name } } ORDER BY ASC (?name) Birthplaces of people named Antoine SELECT DISTINCT ?item ?name ?coord ?lat ?lon ?globe { ?item wdt:P31 wd:Q8502 ; p:P625 [ psv:P625 [ wikibase:geoLatitude ?lat ; wikibase:geoLongitude ?lon ; wikibase:geoGlobe ?globe ; ] ; ps:P625 ?coord ] FILTER ( ?globe != wd:Q2 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?item rdfs:label ?name } } ORDER BY ASC (?name) Candidates for the Dutch general election in 2017 SELECT ?item ?itemLabel ?twitter ?LinkedIN ?politieke_partij ?politieke_partijLabel ?positie_op_lijst WHERE { ?item p:P3602 ?node . OPTIONAL { ?item wdt:P2002 ?twitter } OPTIONAL { ?item wdt:P2035 ?LinkedIN } ?node ps:P3602 wd:Q16061881 . OPTIONAL { ?node pq:P1545 ?positie_op_lijst } OPTIONAL { ?node pq:P1268 ?politieke_partij } OPTIONAL { ?node pq:P2035 ?LinkedIN } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl" } } Map of places of birth of dead economists, colour-coded by era #defaultView:Map SELECT DISTINCT ?person ?name ?birthplace ?birthyear ?coord ?layer WHERE { {?person wdt:P106 wd:Q188094} UNION {?person wdt:P101 wd:Q8134} ?person wdt:P570 ?dod; wdt:P19 ?place . ?place wdt:P625 ?coord OPTIONAL { ?person wdt:P569 ?dob } BIND(YEAR(?dob) as ?birthyear) BIND(IF( (?birthyear < 1700), "Pre-1700", IF((?birthyear < 1751), "1700-1750", IF((?birthyear < 1801), "1751-1800", IF((?birthyear < 1851), "1801-1850", IF((?birthyear < 1901), "1851-1900", IF((?birthyear < 1951), "1901-1950", "Post-1950") ) ) ) )) AS ?layer ) ?person rdfs:label ?name filter (lang(?name) = "en") ?place rdfs:label ?birthplace filter (lang(?birthplace) = "en") } ORDER BY ?birthyear The number of existing translations for diseases in Wikidata #added before 2016-10 SELECT ?disease ?doid ?enLabel (count(?language) as ?languages) WHERE { ?disease wdt:P699 ?doid ; rdfs:label ?label ; rdfs:label ?enLabel . FILTER (lang(?enLabel) = "en") BIND (lang(?label) AS ?language) } group by ?disease ?doid ?enLabel order by desc(?languages) Human genes updated this week SELECT DISTINCT ?item ?ncbi_gene ?date_modified WHERE { ?item wdt:P351 ?ncbi_gene ; wdt:P703 wd:Q15978631 ; schema:dateModified ?date_modified . BIND (now() - ?date_modified as ?date_range) FILTER (?date_range < 8) } Counts of gene-variant types sourced from the CIViC database #defaultView:BarChart SELECT ?variant_typeLabel (count(?variant_typeLabel) as ?counts) WHERE { ?item wdt:P3329 ?civic_id ; wdt:P31 ?variant_type . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?variant_typeLabel ORDER BY ?counts Get Wikidata - UniprotId mappings for homo sapiens SELECT ?item ?itemLabel ?uniprotid ?tax_node WHERE { ?item wdt:P352 ?uniprotid ; wdt:P703 wd:Q15978631 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Metabolites and the species where they are found in PREFIX pr: PREFIX rdf: PREFIX prov: SELECT ?compound ?compoundLabel ?speciesLabel ?sourceLabel ?doi ?wpid WHERE { ?compound wdt:P31 wd:Q11173. MINUS { ?compound wdt:P31 wd:Q8054. } ?compound p:P703 ?statement. ?statement rdf:type wikibase:BestRank. ?statement ps:P703 ?species. OPTIONAL { ?statement (prov:wasDerivedFrom/pr:P248) ?source. OPTIONAL { ?statement (prov:wasDerivedFrom/pr:P2410) ?wpid. } OPTIONAL { ?statement (prov:wasDerivedFrom/pr:P356) ?doi. } } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ASC(?compound) Asterophryinae parent taxon reverse graph #defaultView:Graph PREFIX gas: SELECT ?item ?itemLabel ?pic ?linkTo WHERE { SERVICE gas:service { gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP" ; gas:in wd:Q1968598; gas:traversalDirection "Reverse" ; gas:out ?item ; gas:out1 ?depth ; gas:maxIterations 3 ; gas:linkType wdt:P171 . } OPTIONAL { ?item wdt:P171 ?linkTo } OPTIONAL { ?item wdt:P18 ?pic } SERVICE wikibase:label {bd:serviceParam wikibase:language "en" } } All human pathways from Wikipathways SELECT ?pathway ?pathwayLabel ?wpid WHERE { ?pathway wdt:P2410 ?wpid ; wdt:P703 wd:Q15978631 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Get known variants reported in CIViC database (Q27612411) of genes reported in a Wikipathways pathway: Bladder Cancer (Q30230812) SELECT DISTINCT ?pathway ?pathwayLabel ?pwpart ?pwpartLabel ?variant ?variantLabel ?disease?diseaseLabel WHERE { VALUES ?predictor {p:P3354 p:P3355 p:P3356 p:P3357 p:P3358 p:P3359} VALUES ?predictorQualifier {pq:P2175} VALUES ?wpID {"WP2828"} ?pathway wdt:P2410 ?wpID ; # Pathways has a Wikipathways identifier wdt:P527 ?pwpart . # which contains pathways parts ?disease wdt:P279+ wd:Q504775 . # The disease is a subclass of urinary bladder cancer # based on annotations in the Disease ontology ?variant wdt:P3329 ?civicID ; # a variant known in CIViC ?predictor ?node ; # has a predicting relation with diseases # labeled as being a subclass of urinary bladder cancer wdt:P3433 ?pwpart . # variant is biological variant of {?node ?predictorStatement ?drug_label ; ?predictorQualifier ?disease .} UNION { ?node ?predictorStatement ?disease . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Known interaction types in Wikipathways for a pathway with Identifier WP716 PREFIX dcterms: PREFIX wp: SELECT DISTINCT ?interaction_type WHERE { VALUES ?wpid {"WP716"} ?item wdt:P2410 ?wpid ; wdt:P2888 ?source_pathway . SERVICE { ?wp_pathway dc:identifier ?source_pathway . ?s dcterms:isPartOf ?wp_pathway, ?interaction . ?interaction rdf:type wp:Interaction . ?interaction rdf:type ?interaction_type . ?interaction wp:participants ?participants . } } List of computer files formats #added before 2016-10 SELECT DISTINCT ?idExtension ?extension ?mediaType ?idExtensionLabel WHERE { ?idExtension wdt:P31 wd:Q235557 ; wdt:P1195 ?extension . OPTIONAL { ?idExtension wdt:P1163 ?mediaType } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY ?extension ?mediaType Chemical elements and their properties #added before 2016-10 SELECT ?elementLabel ?_boiling_point ?_melting_point ?_electronegativity ?_density ?_mass WHERE { ?element wdt:P31 wd:Q11344. ?element wdt:P2102 ?_boiling_point. ?element wdt:P2101 ?_melting_point. ?element wdt:P1108 ?_electronegativity. ?element wdt:P2054 ?_density. ?element wdt:P2067 ?_mass. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 100 Who discovered the most asteroids? #added before 2016-10 SELECT ?discoverer ?name (COUNT(?asteroid) AS ?count) WHERE { ?asteroid wdt:P31 wd:Q3863 . ?asteroid wdt:P61 ?discoverer . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . ?discoverer rdfs:label ?name } } GROUP BY ?discoverer ?name ORDER BY DESC(?count) LIMIT 20 Number of scientists per gender #added before 2016-10 SELECT ?gender (count(distinct ?human) as ?number) WHERE { ?human wdt:P31 wd:Q5 ; wdt:P21 ?gender ; wdt:P106/wdt:P279* wd:Q901 . } GROUP BY ?gender LIMIT 10 PMID-DOI mappings #added before 2016-10 SELECT DISTINCT ?pmid ?doi WHERE { ?item wdt:P698 ?pmid ; wdt:P356 ?doi . } Mathematical proofs #added before 2016-10 SELECT ?proof ?proofLabel WHERE { ?proof wdt:P31 wd:Q11538. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } US presidents and spouses #added before 2016-10 #TEMPLATE={"template":"Presidents of ?country and their spouses","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q6256 . }"} } } SELECT ?p ?pLabel ?ppicture ?w ?wLabel ?wpicture WHERE { BIND(wd:Q30 AS ?country) ?country (p:P6/ps:P6) ?p. ?p wdt:P26 ?w. OPTIONAL { ?p wdt:P18 ?ppicture. ?w wdt:P18 ?wpicture. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } List of presidents with causes of death #added before 2016-10 #TEMPLATE={"template":"Presidents of ?country and their spouses","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q6256 . }"} } } SELECT ?p ?pLabel ?ppicture ?w ?wLabel ?wpicture WHERE { BIND(wd:Q30 AS ?country) ?country (p:P6/ps:P6) ?p. ?p wdt:P26 ?w. OPTIONAL { ?p wdt:P18 ?ppicture. ?w wdt:P18 ?wpicture. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Museums in Brittany #added before 2016-10 SELECT DISTINCT ?museumLabel ?museumDescription ?villeId ?villeIdLabel (?villeIdLabel AS ?ville) ?coord ?lat ?lon WHERE { ?museum wdt:P539 ?museofile. # french museofile Id ?museum wdt:P131* wd:Q12130. # in Brittany ?museum wdt:P131 ?villeId. #city of the museum # ?object wdt:P166 wd:Q2275045 # that have french label "musées de France" OPTIONAL {?museum wdt:P856 ?link.} # official website OPTIONAL {?museum wdt:P625 ?coord .} # geographic coord OPTIONAL { ?museum p:P625 ?statement. ?statement psv:P625 ?node. ?node wikibase:geoLatitude ?lat. ?node wikibase:geoLongitude ?lon. } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". } #french label } ORDER BY ?villeIdLabel Characters portrayed by most actors #added before 2016-10 SELECT ?character ?characterLabel (COUNT(?actor) AS ?count) WHERE { { SELECT DISTINCT ?character ?actor WHERE { ?film p:P161 [ ps:P161 ?actor; pq:P453 ?character ]. #?character wdt:P31 wd:Q5. # uncomment to filter for real people } } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } GROUP BY ?character ?characterLabel ORDER BY DESC(?count) LIMIT 25 Authors, writers and poets ranked by sitelink and also includes "country of citizenship" #added before 2016-10 SELECT distinct ?writer ?place ?linkcount WHERE { {?s wdt:P106 wd:Q36180 .} UNION { ?s wdt:P106 wd:Q482980 . } UNION { ?s wdt:P106 wd:Q49757 . } ?s wdt:P27 ?pl . ?s wikibase:sitelinks ?linkcount . OPTIONAL { ?s rdfs:label ?writer filter (lang(?writer) = "en"). } OPTIONAL { ?pl rdfs:label ?place filter (lang(?place) = "en"). } } GROUP BY ?place ?writer ?linkcount HAVING (?linkcount > 10) ORDER BY DESC(?linkcount) Timeline of albums by Manu Chao and Mano Negra #defaultView:Timeline SELECT ?album ?performerLabel ?albumLabel ?publication_date WHERE { VALUES ?performer { wd:Q936474 wd:Q207898 } ?album wdt:P175 ?performer ; wdt:P577 ?publication_date . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Public sculptures in Paris #added before 2016-10 SELECT DISTINCT ?item ?Titre ?createur (year(?date) as ?AnneeCreation) ?image ?coord WHERE { ?item wdt:P31/wdt:P279* wd:Q860861. # sculpture ?item wdt:P136 wd:Q557141 . # genre : art public {?item wdt:P131 wd:Q90.} # ... située dans Paris UNION {?item wdt:P131 ?arr. # ... ou dans un arrondissement de Paris ?arr wdt:P131 wd:Q90. } ?item rdfs:label ?Titre filter (lang(?Titre) = "fr"). # Titre OPTIONAL {?item wdt:P170 ?Qcreateur. # créateur/créatrice (option) ?Qcreateur rdfs:label ?createur filter (lang(?createur) = "fr") .} OPTIONAL {?item wdt:P571 ?date.} # date de création (option) OPTIONAL {?item wdt:P18 ?image.} # image (option) OPTIONAL {?item wdt:P625 ?coord.} # coordonnées géographiques (option) } German breweries #added before 2016-10 #Locations of breweries in Germany #defaultView:Map select ?breweryLabel ?breweryDescription ?coord WHERE { ?brewery wdt:P31/wdt:P279* wd:Q131734 ; wdt:P17 wd:Q183 ; wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "en, de" . } } Mushers with neither a ranking in a race nor a reason for not finishing it #added before 2016-10 #Locations of breweries in Germany #defaultView:Map select ?breweryLabel ?breweryDescription ?coord WHERE { ?brewery wdt:P31/wdt:P279* wd:Q131734 ; wdt:P17 wd:Q183 ; wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "en, de" . } } Women mushers #added before 2016-10 select distinct ?musher ?musherLabel where { { ?musher wdt:P31 wd:Q5 . ?musher wdt:P106 wd:Q500097 . ?musher wdt:P21 wd:Q6581072} SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . } Get all items with "Zika" in the item label SELECT DISTINCT ?item ?itemLabel ?_PubMed_ID WHERE { ?item wdt:P31 wd:Q13442814 ; rdfs:label ?itemLabel . OPTIONAL { ?item wdt:P698 ?_PubMed_ID. } FILTER(CONTAINS(LCASE(?itemLabel), "zika")) FILTER (LANG(?itemLabel)="en") } Get the CIViC citation corpus SELECT DISTINCT ?pmid ?citation ?citationLabel WHERE { VALUES ?predictor {p:P3354 p:P3355 p:P3356 p:P3357 p:P3358 p:P3359 } ?item p:P3329 ?civicId ; ?predictor ?predictor_value . ?civicId ps:P3329 ?id . ?predictor_value prov:wasDerivedFrom ?reference . ?reference pr:P248 ?citation . ?citation wdt:P698 ?pmid ; SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Get the Pathways citation corpus SELECT ?id ?item ?itemLabel ?referenceLabel WHERE { {?item wdt:P3937 ?id } UNION {?item wdt:P2410 ?id } ?item wdt:P2860 ?reference . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } Disease items with redirected values #added before 2016-10 SELECT * WHERE { ?disease ?p ?o ; wdt:P699 ?doid. ?o owl:sameAs ?sa . } Missing labels for a target language #Search for labels in other languages that do not exist in a target language #Can be input for Q29032512 SELECT ?item ?itemLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q5. #instance of human ?item wdt:P27 wd:Q31. #country of citizenship Belgium SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,fr,en,de,it,es,no,pt". } FILTER(NOT EXISTS { ?item rdfs:label ?lang_label. FILTER(LANG(?lang_label) = "it") #with missing Italian label }) } ORDER BY ?itemLabel Occupations with a German label SELECT DISTINCT ?occ ?occLabelEN ?occLabelDE { ?occ (wdt:P31/wdt:P31* | wdt:P279/wdt:P279*) wd:Q12737077 . FILTER NOT EXISTS { ?occ wdt:P31 wd:Q5 } FILTER NOT EXISTS { ?occ wdt:P31 wd:Q13406463 } FILTER ( ?occ != wd:Q28640 ) ?occ rdfs:label ?occLabelDE filter (lang(?occLabelDE) = "de") . OPTIONAL { ?occ rdfs:label ?occLabelEN filter (lang(?occLabelEN) = "en") } }