Wikidata:SPARQL query service/queries/examples

This page is a translated version of the page Wikidata:SPARQL query service/queries/examples and the translation is 69% complete.
Outdated translations are marked like this.

Tuto stránku parsuje webové rozhraní dotazovací služby (query service) a tyto údaje vyplní dialogové okno příkladů dotazů. Mnohé z příkladů fungují také ve volání šablony {{Wikidata list}} analyzované pomocí ListeriaBot, které však vyžaduje výběr proměnné pole ?item.

Zvažte přidání komentáře k dotazu, který uveden, co příklad ilustruje, kdy a kým byl napsán a jaká jsou jeho omezení vzhledem k současným datům a využití vlastností na Wikidatech.

Některé dotazy se sem nevešly z důvodu technických omezení:


Viz též

Jednoduché dotazy

Tyto základní dotazy pomůžou porozumět jazyku SPARQL a Wikibase RDF formátu.

Kočky

This query looks at all items whose value of instance of (P31) is house cat (Q146). It uses the service wikibase:label to return the labels in your default language or in English.

SELECT ?item ?itemLabel
WHERE
{
  ?item wdt:P31 wd:Q146. # <span class="mw-translate-fuzzy">Musí být kočky</span>
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } # <span class="mw-translate-fuzzy">Pomůže získat štítek ve vašem jazyce, pokud neexistuje, pak v anglickém jazyce</span>
}
Try it!

Koně (zobrazí nějaké info o nich)

This query looks at items whose value of instance of (P31) is horse (Q726) or any subclass of (subclass of (P279)) horse (Q726). It displays the value of mother (P25), father (P22), and sex or gender (P21) and computes the birth year using date of birth (P569) and the death year using date of death (P570). Items are ordered using the horses' qid.

#Illustrates optional fields, instances of subclasses, language fallback on label service, date to year conversion
#title: <span lang="en" dir="ltr" class="mw-content-ltr">Horses on Wikidata</span>
SELECT DISTINCT ?horse ?horseLabel ?mother ?motherLabel ?father ?fatherLabel (year(?birthdate) as ?birthyear) (year(?deathdate) as ?deathyear) ?genderLabel
WHERE
{
  ?horse wdt:P31/wdt:P279* wd:Q726 .     # Instance of and subclasses of Q726 (horse)

  OPTIONAL{?horse wdt:P25 ?mother .}     # mother
  OPTIONAL{?horse wdt:P22 ?father .}     # father
  OPTIONAL{?horse wdt:P569 ?birthdate .} # date of birth
  OPTIONAL{?horse wdt:P570 ?deathdate .} # date of death
  OPTIONAL{?horse wdt:P21 ?gender .}     # sex or gender

  SERVICE wikibase:label { #BabelRainbow
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,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
Horses on Wikidata

Kočky, s obrázky

This query looks at all items with value of instance of (P31) equals to house cat (Q146) with a image (P18). The results are displayed as a gallery with the option '#defaultView:ImageGrid'.

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Cats, with pictures</span>
#defaultView:ImageGrid
SELECT ?item ?itemLabel ?pic WHERE {
  ?item wdt:P31 wd:Q146;
    wdt:P18 ?pic.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Cats, with pictures

Mapa nemocnic

The query displays all items whose value of instance of (P31) is hospital (Q16917) or any subclass of (P279) of hospital (Q16917) with coordinate location (P625). The results are displayed on a map using 'defaultView:Map'.

#added 2017-08
#defaultView:Map
SELECT DISTINCT * WHERE {
  ?item wdt:P31/wdt:P279* wd:Q16917;
        wdt:P625 ?geo .
}
Try it!

Mapa hackerspaces

The query displays on a map ("defaultView:Map") all items whose value of instance of (P31) is hackspace (Q1032372) and which have values for properties coordinate location (P625) and country (P17). P17 is also used as the color of the marker.

Warnings:

#added 2021-12
#defaultView:Map{"layer":"?country"}
SELECT DISTINCT * WHERE {
  ?item wdt:P31 wd:Q1032372;
        wdt:P625 ?geo ;
        wdt:P17 ?country
}
Try it!

Počet lidí ve Wikidatech

This query takes all items whose value of instance of (P31) is human (Q5) and count the total number of items using COUNT function.

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Number of humans in Wikidata</span>
SELECT (COUNT(*) AS ?count)
WHERE {
  ?item wdt:P31 wd:Q5 .
}
Number of humans in Wikidata

Bezdětní lidé

Only truthy values

In the simplest form (using only truthy values):

#<span lang="en" dir="ltr" class="mw-content-ltr">Demonstrates "no value" handling</span>
#title: <span lang="en" dir="ltr" class="mw-content-ltr">Humans without children (only truthy values)</span>
SELECT ?human ?humanLabel
WHERE
{
  ?human wdt:P31 wd:Q5 .       #find humans
  ?human rdf:type wdno:P40 .   #with at least one truthy P40 (child) statement defined to be "no value"
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Humans without children (only truthy values)

Including non-truthy values

A similar query which also considers non-truthy (for example, values with deprecated rank) "no value" statements:

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Humans without children (including non-truthy values)</span>
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],mul,en" . }
}
Humans without children (including non-truthy values)

Lidé narození v New York City

Tento příklad ukazuje správný způsob použití vlastnosti P19 a následně i vlastnosti P20. P19 je nejpřesnější známé místo narození. Například je známo, že Donald Trump (Q22686) se narodil v Jamaica Hospital (Q23497866). Proto by se v prvním dotazu nezobrazoval.

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Humans born in New York City</span>
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?sitelinks
WHERE {
    ?item wdt:P31 wd:Q5;            # Any instance of a human
          wdt:P19/wdt:P131* wd:Q60; # Who was born in any value (eg. a hospital)
# that has the property of 'administrative area of' New York City or New York City itself.

# Note that using wdt:P19 wd:Q60;  # Who was born in New York City.
# Doesn't include humans with the birth place listed as a hospital
# or an administrative area or other location of New York City.

          wikibase:sitelinks ?sitelinks.

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY DESC(?sitelinks)
Humans born in New York City

Humans who died on a specific date on the English Wikipedia, ordered by label

# <span lang="en" dir="ltr" class="mw-content-ltr">Humans who died on August 25 2001 according to the English Wikipedia</span>
SELECT ?item ?articlename ?itemLabel ?itemDescription ?sl
WHERE {
   VALUES ?dod {"+2001-08-25"^^xsd:dateTime}
    ?dod ^wdt:P570 ?item .
    ?item wikibase:sitelinks ?sl .
    ?item ^schema:about ?article .
    ?article schema:isPartOf <https://en.wikipedia.org/>;
    schema:name ?articlename .
  SERVICE wikibase:label
    {
      bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
      ?item rdfs:label ?itemLabel .
      ?item schema:description ?itemDescription .
    }
  BIND(REPLACE(?itemLabel, "^.*(?<! [Vv][ao]n| [Dd][aeiu]| [Dd][e][lns]| [Ll][ae]) (?!([SJ]r\\.?|[XVI]+)$)", "") AS ?sortname)
} ORDER BY ASC(UCASE(?sortname)) ASC(UCASE(?itemLabel))
Try it!

Položky s odkazem na stránky Wikispecies

# <span lang="en" dir="ltr" class="mw-content-ltr">illustrates sitelink selection, ";" notation</span>
#title: <span lang="en" dir="ltr" class="mw-content-ltr">Items with a Wikispecies sitelink</span>
SELECT ?item ?itemLabel ?article
WITH {
  SELECT *
  WHERE {
    ?article schema:about ?item ;
      schema:isPartOf <https://species.wikimedia.org/> .
  }
  LIMIT 200
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
Items with a Wikispecies sitelink

Položky o autorech se stránkou na Wikispecies

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Items about authors with a Wikispecies page</span>
SELECT ?author ?authorLabel ?count
WITH {
  SELECT ?author (COUNT(?paper) AS ?count)
  WHERE {
    ?article schema:about ?author ;
      schema:isPartOf <https://species.wikimedia.org/> .
    ?author wdt:P31 wd:Q5.
    ?paper wdt:P50 ?author.
  }
  GROUP BY ?author
  ORDER BY DESC(?count)
  LIMIT 200
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?count)
Items about authors with a Wikispecies page

Nedávné události

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Recent events</span>
SELECT ?event ?eventLabel ?date
WITH {
  SELECT DISTINCT ?event ?date
  WHERE {
    # find events
    ?event wdt:P31/wdt:P279* wd:Q1190554.
    # with a point in time or start date
    OPTIONAL { ?event wdt:P585 ?date. }
    OPTIONAL { ?event wdt:P580 ?date. }
    # but at least one of those
    FILTER(BOUND(?date) && DATATYPE(?date) = xsd:dateTime).
    # not in the future, and not more than 31 days ago
    BIND(NOW() - ?date AS ?distance).
    FILTER(0 <= ?distance && ?distance < 31).
  }
  LIMIT 150
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
Recent events

Časté barvy očí lidí

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Popular eye colors among humans</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">illustrates bubblechart view, count</span>
#defaultView:BubbleChart
SELECT ?eyeColor ?eyeColorLabel ?rgb (COUNT(?human) AS ?count)
WHERE
{
  ?human wdt:P31 wd:Q5.
  ?human wdt:P1340 ?eyeColor.
  OPTIONAL { ?eyeColor wdt:P465 ?rgb. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
GROUP BY ?eyeColor ?eyeColorLabel ?rgb
ORDER BY DESC(?count)
Popular eye colors among humans

Lidé, u kterých víme, že jejich gender je neznámý

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Humans whose gender we know we don't know</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Demonstrates filtering for "unknown value"</span>
SELECT ?human ?humanLabel
WHERE
{
  ?human wdt:P31 wd:Q5 . # instance of human
  ?human wdt:P21 ?gender .
  FILTER wikibase:isSomeValue(?gender)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Humans whose gender we know we don't know

URL Wikipedií ve všech jazycích

Tento dotaz poskytuje alternativu ke scrapování stránky portálů na Wikipedii a různých seznamů/tabulek na různých verzích Wikipedie. (Další alternativou je sitematrix API.)

#title: <span lang="en" dir="ltr" class="mw-content-ltr">URLs of Wikipedia in all languages</span>
SELECT ?wikipedia WHERE {
  ?wikipedia wikibase:wikiGroup "wikipedia".
}
URLs of Wikipedia in all languages

Názvy článků na Wikipedii ve více jazycích

Dotaz vyhledá názvy článků Wikipedie (v hlavním jmenném prostoru) v různých jazycích pro zadanou položku Q. Místo skutečných názvů článků jsou vráceny štítky.

SELECT DISTINCT ?lang ?name WHERE {
  ?article schema:about wd:Q5 . hint:Prior hint:runFirst true.
  ?article schema:inLanguage ?lang ;
    schema:name ?name ;
    schema:isPartOf [ wikibase:wikiGroup "wikipedia" ] .
  FILTER(?lang in ('en', 'uz', 'ru', 'ko')) .
  FILTER (!CONTAINS(?name, ':')) .
}
Try it!

Všechny položky s vlastností

# <span lang="en" dir="ltr" class="mw-content-ltr">Sample to query all values of a property</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Property talk pages on Wikidata include basic queries adapted to each property</span>
SELECT
  ?item ?itemLabel
  ?value ?valueLabel
# <span lang="en" dir="ltr" class="mw-content-ltr">valueLabel is only useful for properties with item-datatype</span>
WHERE
{
  ?item wdt:P1800 ?value
  # <span lang="en" dir="ltr" class="mw-content-ltr">change P1800 to another property</span>
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
# <span lang="en" dir="ltr" class="mw-content-ltr">remove or change limit for more results</span>
LIMIT 10
Try it!

All statements of an item containing another item (direct / first-degree connections)

#defaultView:Graph
#TEMPLATE={ "template": { "en": "All statements of ?item containing another item" }, "variables": { "?item": {} } }
SELECT ?item ?itemLabel ?itemImage ?value ?valueLabel ?valueImage ?edgeLabel WHERE {
  BIND(wd:Q12345 AS ?item)
  ?item ?wdt ?value.
  ?edge a wikibase:Property;
        wikibase:propertyType wikibase:WikibaseItem; # <span lang="en" dir="ltr" class="mw-content-ltr">note: to show all statements, removing this is not enough, the graph view only shows entities</span>
        wikibase:directClaim ?wdt.
  OPTIONAL { ?item wdt:P18 ?itemImage. }
  OPTIONAL { ?value wdt:P18 ?valueImage. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Položky Wikidat článků Wikipedie

# <span lang="en" dir="ltr" class="mw-content-ltr">Returns a list of Wikidata items for a given list of Wikipedia article names</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">List of Wikipedia article names (lemma) is like "WIKIPEDIA ARTICLE NAME"@LANGUAGE CODE with de for German, en for English, etc.</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Language version and project is defined in schema:isPartOF with de.wikipedia.org for German Wikipedia, es.wikivoyage for Spanish Wikivoyage, etc.</span>
SELECT ?lemma ?item WHERE {
  VALUES ?lemma {
    "Wikipedia"@de
    "Wikidata"@de
    "Berlin"@de
    "Technische Universität Berlin"@de
  }
  ?sitelink schema:about ?item;
    schema:isPartOf <https://de.wikipedia.org/>;
    schema:name ?lemma.
}
Try it!

Wikidata items with English spoken text audio

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata items with English spoken text audio</span>
SELECT DISTINCT ?item ?itemLabel WHERE {
  ?item p:P989 ?statement .# check for spoken text audio statement and exclude those without P989 value
  ?statement ps:P989 ?spokentext .
  ?statement pq:P407 ?lang . # get qualifier language
  FILTER(?lang = wd:Q1860) . # filter for EN
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Wikidata items with English spoken text audio

Celkový počet obyvatel v regionu Øresund

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Total population in the Øresund Region</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Illustrates the SUM aggregate function</span>

SELECT DISTINCT ?area ?areaLabel (sum(?folkm_ngd) as ?total_folkm) # <span lang="en" dir="ltr" class="mw-content-ltr">the first two variables can be removed</span>
                                                                   # <span lang="en" dir="ltr" class="mw-content-ltr">if only the number is needed</span>
WHERE {
  ?item wdt:P361 wd:Q297853. # <span lang="en" dir="ltr" class="mw-content-ltr">part of (P361) Øresund Region (Q297853)</span>
  ?item wdt:P1082 ?folkm_ngd. # <span lang="en" dir="ltr" class="mw-content-ltr">population (P1082)</span>
  ?area wdt:P31 wd:Q1907114. # <span lang="en" dir="ltr" class="mw-content-ltr">instance of (P31) metropolitan area (Q1907114)</span>
  ?area wdt:P527 ?item. # <span lang="en" dir="ltr" class="mw-content-ltr">has part (P527)</span>
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
GROUP BY ?area ?areaLabel
Total population in the Øresund Region

Starostové, kteří jsou jakýmkoli druhem domestikovaného zvířete

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Mayors that are any kind of domesticated animal</span>
SELECT ?image ?speciesLabel ?mayorLabel ?placeLabel WHERE {
  ?species wdt:P279* wd:Q622852 .
  ?mayor wdt:P31 ?species .

  ?mayor p:P39 ?node .
  ?node ps:P39 wd:Q30185 .
  ?node pq:P642 ?place .
  OPTIONAL {?mayor wdt:P18 ?image}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Mayors that are any kind of domesticated animal

Starostové, kteří jsou buď pes, kočka nebo kuře

# <span lang="en" dir="ltr" class="mw-content-ltr">Illustrates the VALUES clause.</span>
SELECT ?image ?speciesLabel ?mayorLabel ?placeLabel WHERE {
  VALUES ?species {wd:Q144 wd:Q146 wd:Q780}
  ?mayor wdt:P31 ?species .
  ?mayor p:P39 ?node .
  ?node ps:P39 wd:Q30185 .
  ?node pq:P642 ?place .
  OPTIONAL {?mayor wdt:P18 ?image}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Items in the Messier Catalog, with image

#defaultView:ImageGrid
# <span lang="en" dir="ltr" class="mw-content-ltr">Items in the Messier Catalog</span>
SELECT DISTINCT ?item ?itemLabel ?numero (SAMPLE(?image) AS ?image)
WHERE {
  ?item p:P528 ?catalogStatement .
  ?catalogStatement ps:P528 ?numero .
  ?catalogStatement pq:P972 wd:Q14530 .
  OPTIONAL {?item wdt:P18 ?image . }

	SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
GROUP BY ?item ?itemLabel ?numero 
ORDER BY ?numero
Try it!

Brightest stars, with image

#defaultView:ImageGrid
# <span lang="en" dir="ltr" class="mw-content-ltr">Brightest celestial bodies</span>
SELECT ?star ?starLabel ?images ?apparent_magnitude
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  { SELECT  ?star ?apparent_magnitude ?images
    WHERE {   
      ?star wdt:P31 wd:Q523;
            wdt:P1215 ?apparent_magnitude;
            wdt:P18 ?images .
      FILTER(?apparent_magnitude < 1)
    } LIMIT 10 
  }
} ORDER BY (?apparent_magnitude)
Try it!

Map of the world's sign languages with number of practicians

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Map of the world's sign languages with number of practicians</span>
#defaultView:Map
SELECT ?sign_language ?sign_languageLabel ?indigenous_to ?coordinate_location ?practicians WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  OPTIONAL { ?sign_language wdt:P1098 ?practicians. }
  OPTIONAL { ?sign_language wdt:P17 ?country. }
  OPTIONAL { ?country wdt:P625 ?coordinate_location. }
  ?sign_language wdt:P31 wd:Q34228. 
}
Map of the world's sign languages with number of practicians

Dotazy na lexémy

Senses on Swedish phrase lexemes with a synonym

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Senses on Swedish phrase lexemes with a synonym</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">date: 2024-04-25</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">author: So9q</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">note: Thanks to Nikki and Ainali for help with selecting the synonym lexeme</span> 
SELECT ?l ?sense ?lemma ?synonym ?synonym_lemma WHERE {
  ?l   ontolex:sense ?sense ; # <span lang="en" dir="ltr" class="mw-content-ltr">the sense</span>
       dct:language wd:Q9027 ; # <span lang="en" dir="ltr" class="mw-content-ltr">the language</span>
       wikibase:lemma ?lemma ; # <span lang="en" dir="ltr" class="mw-content-ltr">and the lemma</span>
       wikibase:lexicalCategory ?category.
  ?category wdt:P279/wdt:P31* wd:Q187931. # <span lang="en" dir="ltr" class="mw-content-ltr">subclass of phrase</span>
  ?sense wdt:P5973 ?synonym_sense .
  ?synonym ontolex:sense ?synonym_sense . # <span lang="en" dir="ltr" class="mw-content-ltr">select synonym lexeme</span>
  ?synonym wikibase:lemma ?synonym_lemma . # <span lang="en" dir="ltr" class="mw-content-ltr">get the synonym lemma</span>
}
Senses on Swedish phrase lexemes with a synonym

Senses on English lexemes with an offensive or profanity style statement

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Senses on English lexemes with an offensive or profanity style statement</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">date: 2024-01-25</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">author: So9q</span>
SELECT ?l ?sense ?lemma ?swearLabel WHERE {
  ?l ontolex:sense ?sense ; # the sense
     dct:language wd:Q1860 ; # the language
     wikibase:lemma ?lemma . # and the lemma
  VALUES ?swear {
    wd:Q184439
    wd:Q545779
  }
  ?sense wdt:P6191 ?swear .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
Senses on English lexemes with an offensive or profanity style statement

Chybějící švédské lexémy v SAOB

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Swedish lexemes that are missing in the biggest official printed Swedish dictionary SAOB.</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">date: 2021-10-12</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">author:So9q</span>
SELECT ?lemma
WHERE {
  ?lexemeId dct:language wd:Q9027;
            wikibase:lemma ?lemma;
            wdt:P9660 wd:Q1935308.
}
Swedish lexemes that are missing in the biggest official printed Swedish dictionary SAOB.

Formy ve švédštině, které nemají žádný ukázkový příklad

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Forms in Swedish that have no example demonstrating them</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">2021-08-06</span>
SELECT ?form ?lemma
WHERE {
  ?lexemeId dct:language wd:Q9027;
            wikibase:lemma ?lemma;
            ontolex:lexicalForm ?form.
  MINUS {
  ?lexemeId p:P5831 ?statement.
  ?statement ps:P5831 ?example;
             pq:P6072 [];
             pq:P5830 ?form_with_example.
  }
}
Forms in Swedish that have no example demonstrating them

Lemmatizace slova v angličtině

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Get the lemma for an inflected word in English</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Author: So9q</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">2021-07-25</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">inspired by https://sinaahmadi.github.io/posts/10-essential-sparql-queries-for-lexicographical-data-on-wikidata.html</span>
SELECT DISTINCT ?l ?word ?lemma WHERE {
  VALUES ?word { "bought"@en }
  ?l dct:language wd:Q1860 ;
     wikibase:lemma ?lemma ;
     ontolex:lexicalForm ?form .
  ?form ontolex:representation ?word .
}
Get the lemma for an inflected word in English

Švédská abeceda

#title:<span lang="en" dir="ltr" class="mw-content-ltr">The Swedish alphabet</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Author: So9q</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">2021-07-22</span>
SELECT ?lexemeId ?lemma WHERE {
  ?lexemeId dct:language wd:Q9027;
            wikibase:lemma ?lemma.
  ?lexemeId wikibase:lexicalCategory wd:Q9788
}
ORDER BY ?lemma
The Swedish alphabet

Dánské idiomy

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Danish phrases</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Author: So9q</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Date: 2024-01-03</span>
SELECT ?l ?lemma WHERE {
  ?l dct:language wd:Q9035; # Change language here
     wikibase:lemma ?lemma;
     wikibase:lexicalCategory ?cat.
  ?cat wdt:P279 wd:Q187931.
}
Danish phrases

Všechny formy ve švédštině s chybějící výslovností pro formu s reprezentací shodnou s lemmatem lexému

#title:<span lang="en" dir="ltr" class="mw-content-ltr">All forms in Swedish missing a pronunciation for the form with a representation identical to the lemma of the lexeme</span>
# So9q 13-01-2021
SELECT ?l ?lemma ?form ?audio WHERE {
  ?l dct:language wd:Q9027;
     wikibase:lemma ?lemma;
     ontolex:lexicalForm ?form .
  ?form ontolex:representation ?lemma .
  MINUS {?form wdt:P443 ?audio.}
}
All forms in Swedish missing a pronunciation for the form with a representation identical to the lemma of the lexeme

Lexémy v angličtině, které odpovídají výrazu

# <span lang="en" dir="ltr" class="mw-content-ltr">Lexemes in English that match an expression</span>
SELECT ?lexemeId ?lemma WHERE {
  ?lexemeId dct:language wd:Q1860;
            wikibase:lemma ?lemma.
  # only those lemmas that begin with "pota", i.e. "potato"
  FILTER (regex(?lemma, '^pota.*'))
}
Try it!

Lexémy ve švédštině s příkladem použití, který demonstruje formu i význam

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Lexemes in Swedish with usage example that demonstrates both a form and a sense</span>
# So9q 23-12-2020
SELECT ?lexemeId ?lemma ?example WHERE {
  ?lexemeId dct:language wd:Q9027;
            wikibase:lemma ?lemma.
  ?lexemeId p:P5831 ?statement.
  ?statement ps:P5831 ?example;
             pq:P6072 [];
             pq:P5830 [].
}
Lexemes in Swedish with usage example that demonstrates both a form and a sense

Obrázky podstatných jmen v angličtině (obrázkový slovník à la Wikidata)

# <span lang="en" dir="ltr" class="mw-content-ltr">Lexemes in English with picture and description fetched from the concept Q-item</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">NB: when 2 or more pictures occur for the same lemma a preferred rank is missing on the Q-item.</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Please fix that if you know how.</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">by So9q</span>
#defaultView:ImageGrid
SELECT DISTINCT ?lexemeId ?lemma ?q_concept ?q_conceptDescription ?picture
WHERE {
  ?lexemeId dct:language wd:Q1860;
            wikibase:lemma ?lemma;
            ontolex:sense ?sense.
  ?sense wdt:P5137 ?q_concept.
  ?q_concept wdt:P18 ?picture.
  # <span lang="en" dir="ltr" class="mw-content-ltr">if you wish to only browse certain items you can insert a FILTER</span>
  # <span lang="en" dir="ltr" class="mw-content-ltr">regular expression here, like in the example above.</span>
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY lcase(?lemma) # order a-z
Try it!

Německý obrázkový slovník pro malé děti

# <span lang="en" dir="ltr" class="mw-content-ltr">German picture dictionary for young children</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">NB: when 2 or more pictures occur for the same lemma a preferred rank is missing on the Q-item.</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Please fix that if you know how.</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">If any inapproriate terms show up it is probably because the sense is missing a correct P5137</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">by So9q</span>
#defaultView:ImageGrid
SELECT DISTINCT ?lexemeId ?lemma ?q_concept ?q_conceptDescription ?picture
WHERE {
  ?lexemeId dct:language wd:Q188; # change language here
            wikibase:lemma ?lemma;
            ontolex:sense ?sense.
  ?sense wdt:P5137 ?q_concept.
  ?q_concept wdt:P18 ?picture.
  ############
  # <span lang="en" dir="ltr" class="mw-content-ltr">Exclusions</span>
  ############
  # <span lang="en" dir="ltr" class="mw-content-ltr">Exclude out of scope concepts</span>
  MINUS {?q_concept wdt:P31 wd:Q3624078.}. # countries

  # <span lang="en" dir="ltr" class="mw-content-ltr">Exclude non suitable concepts</span>
  VALUES ?minus {
  wd:Q47092 # <span lang="en" dir="ltr" class="mw-content-ltr">rape</span>
  wd:Q198   # <span lang="en" dir="ltr" class="mw-content-ltr">war</span>
  wd:Q124490 # <span lang="en" dir="ltr" class="mw-content-ltr">violence</span>
  wd:Q170382 # <span lang="en" dir="ltr" class="mw-content-ltr">revolver</span>
  wd:Q1576   # <span lang="en" dir="ltr" class="mw-content-ltr">cigar</span>
  #... <span lang="en" dir="ltr" class="mw-content-ltr">add yours here</span>
  }.
  MINUS {?sense wdt:P5137 ?minus.}.

  # <span lang="en" dir="ltr" class="mw-content-ltr">Exclude senses not suitable for young children:</span>
  VALUES ?filter {
  wd:Q8102
  wd:Q545779
  wd:Q1521634
  wd:Q184439}.
  FILTER NOT EXISTS {?sense wdt:P6191 ?filter.}.
  # <span lang="en" dir="ltr" class="mw-content-ltr">if you wish to only browse certain items you can insert a FILTER</span>
  # <span lang="en" dir="ltr" class="mw-content-ltr">regular expression here, like in the example above.</span>
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en,mul". }
}
ORDER BY lcase(?lemma) # order a-z
Try it!

Lexémy jazyků podle počtu příkladů použití

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Lexeme languages by number of usage examples</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">by Vesihiisi</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">improved by So9q 23-02-2020 to only show those with both a form and a sense,</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">because that's what we really want</span>

#defaultView:BubbleChart
SELECT ?languageLabel (COUNT(?example) AS ?count) WHERE {
  ?l dct:language ?language;
     p:P5831 ?statement.
  ?statement ps:P5831 ?example;
             pq:P6072 [];
             pq:P5830 [].
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
GROUP BY ?languageLabel
ORDER BY DESC(?count)
Lexeme languages by number of usage examples

Lexémy popisující barvu

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Lexemes describing a color</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">By Vesihiisi</span>

SELECT ?l ?lemma ?languageLabel WHERE {
  ?l dct:language ?language;
     wikibase:lemma ?lemma;
     wdt:P31 wd:Q376431.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY ?languageLabel
Lexemes describing a color

Lexémy, které znamenají slovo voda uspořádanou podle jazyka

# <span lang="en" dir="ltr" class="mw-content-ltr">By So9q</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">Lexemes that means (liquid) water</span>
SELECT ?l ?sense ?lemma ?languageLabel WHERE {
  ?l a ontolex:LexicalEntry ; # <span lang="en" dir="ltr" class="mw-content-ltr">get from the special LexicalEntry</span>
       ontolex:sense ?sense ; # <span lang="en" dir="ltr" class="mw-content-ltr">the sense</span>
       dct:language ?language ; # <span lang="en" dir="ltr" class="mw-content-ltr">the language</span>
       wikibase:lemma ?lemma. # <span lang="en" dir="ltr" class="mw-content-ltr">and the lemma</span>
  ?sense wdt:P5137 wd:Q29053744 .
                   # <span lang="en" dir="ltr" class="mw-content-ltr">change Q29053744 to anything you want</span>
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
# <span lang="en" dir="ltr" class="mw-content-ltr">Lower case before order</span>
ORDER BY (LCASE(?languageLabel))
Try it!

100 nejčastěji překládaných pojmů ve jmenném prostoru Lexeme

# <span lang="en" dir="ltr" class="mw-content-ltr">by So9q, 2019-11-21</span>
#defaultView:BubbleChart
SELECT ?meaning ?meaningLabel ?count
WITH {
  SELECT ?meaning (count(?l) as ?count)
  WHERE {
    ?l a ontolex:LexicalEntry ;
      ontolex:sense ?sense.
    ?sense wdt:P5137 ?meaning.
  }
  GROUP BY ?meaning
  ORDER BY desc(?count)
  LIMIT 100
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY desc(?count)
Try it!

Demonyma na mapě

# <span lang="en" dir="ltr" class="mw-content-ltr">Words describing people from a certain place</span>
# <span lang="en" dir="ltr" class="mw-content-ltr">e.g. swede</span>
# by Vesihiisi
#defaultView:Map
SELECT ?l ?lemma ?demoPlaceLabel ?coords WHERE {
  ?l a ontolex:LexicalEntry ;
       dct:language ?language ;
       wikibase:lemma ?lemma .
  ?language wdt:P218 'sv'. # <span lang="en" dir="ltr" class="mw-content-ltr">language</span>
  ?l ontolex:sense ?sense.
     ?sense wdt:P6271 ?demoPlace.
  ?demoPlace wdt:P625 ?coords
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Formy v hebrejštině, které jsou jak ženského, tak mužského rodu

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Forms of nouns in Hebrew that are both feminine and masculine</span>
# by Uziel302
SELECT ?lexemeId ?lemma ?form ?word WHERE {
  ?lexemeId dct:language wd:Q9288;
            wikibase:lexicalCategory wd:Q1084;
            wikibase:lemma ?lemma;
            ontolex:lexicalForm ?form.
  ?form wikibase:grammaticalFeature wd:Q499327, wd:Q1775415;
        ontolex:representation ?word.
}
Forms of nouns in Hebrew that are both feminine and masculine

Lexémy podle počtu výroků

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Lexemes by number of statements</span>
SELECT * {
  ?l dct:language [];
     wikibase:statements ?c.
}
ORDER BY desc(?c) LIMIT 50
Lexemes by number of statements

Standard Mandarin Lexeme Forms missing Pinyin Transliteration

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Standard Mandarin Lexeme Forms missing Pinyin Transliteration</span>
#author:0xDeadbeef 2022-07-31
SELECT ?lexemeId ?lemma ?form ?word WHERE {
  ?lexemeId dct:language wd:Q727694;
    wikibase:lemma ?lemma;
    ontolex:lexicalForm ?form.
  ?form ontolex:representation ?word.
  FILTER(NOT EXISTS { ?form wdt:P1721 ?o. })
}
Standard Mandarin Lexeme Forms missing Pinyin Transliteration

List of French nouns that have no audio recording added, formatted for LinguaLibre.org generator

# author: Lea Lacroix (WMDE) 2018-12-18
#contact: Yug
SELECT ?id ?label
WHERE {
  ?l a ontolex:LexicalEntry ; dct:language wd:Q150 ; wikibase:lexicalCategory wd:Q1084 ; ontolex:lexicalForm ?id .
  ?id ontolex:representation ?label .
  FILTER NOT EXISTS { ?id wdt:P443 ?audio. }
}
Try it!

List of Puno Quechua lexeme-forms that have no audio recording added, formatted for LinguaLibre.org generator

#author: Elwinlhq 2022-11-20
#contact: Yug
SELECT ?id ?label WHERE {
  ?l a ontolex:LexicalEntry ; dct:language wd:Q5218 ; wikibase:lexicalCategory wd:Q24905 ; ontolex:lexicalForm ?id .
  ?id ontolex:representation ?label .
  FILTER NOT EXISTS { ?id wdt:P443 ?audio. }  
  FILTER (LANG(?label) = "qu-x-q7260479"). # retrieve Puno Quechua lexemes/forms: qu-x-Q7260479 !!Lowercase
}
Try it!

Predikáty Wikibase

Vlastnosti

Vlastnosti seskupené podle nadřazené vlastnosti

#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],mul,en". }
}
Try it!

Zděděné vlastnosti položky 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],mul,en". }
}
Try it!

Vlastnosti seskupené podle jejich Wikibase datatype (Q19798645) s počtem vlastností

#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],mul,en". }
}
GROUP BY ?wbtype
ORDER BY DESC(?pcount)
Try it!

vlastnosti používané k propojení s instancemi technical standard (Q317623)

#properties used to link to instances of technical standard
SELECT DISTINCT ?propertyRel ?propertyItem ?propertyItemLabel WHERE
{
   ?item ?propertyRel ?standard.
   ?standard wdt:P31 wd:Q317623.
   ?propertyItem wikibase:directClaim ?propertyRel
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Všechny vlastnosti s popisy a aliasy a typy

SELECT ?property ?propertyType ?propertyLabel ?propertyDescription ?propertyAltLabel WHERE {
  ?property wikibase:propertyType ?propertyType .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY ASC(xsd:integer(STRAFTER(STR(?property), 'P')))
Try it!

Vlastnosti spojující položky typu zoo (Q43501) s položkami typu animal (Q729)

SELECT ?p ?pLabel (count (*) as ?count) {
  ?s ?pd ?o .
  ?p wikibase:directClaim ?pd .
  ?s wdt:P31/wdt:P279* wd:Q729 .
  ?o wdt:P31/wdt:P279* wd:Q43501 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?p ?pLabel ORDER BY desc(?count)
Try it!

Identifikátoru vlastností, které jsou přítomny u jedné položky, ale chybí u jiné.

#added November 1, 2020 (76 ids then)
#TEMPLATE={ "template":"Identifiers present on the item for Penelope Cruz, but not on the item for Sean Connery"}
SELECT
  ?p ?pLabel
  (SAMPLE(?url) as ?url_comp2)
WHERE
{
    hint:Query hint:optimizer "None".
    BIND( wd:Q4573 as ?comp1)
    BIND( wd:Q39666 as ?comp2)
    {
        ?comp2 ?wdt ?v .
        ?p wikibase:directClaim ?wdt ; wikibase:propertyType wikibase:ExternalId .
        FILTER NOT EXISTS { ?comp1 ?wdt [] }
        OPTIONAL { ?p wdt:P1630 ?f }
        BIND(uri(REPLACE(?f,"\\$1",?v)) as ?url)
    }
    UNION { BIND(wd:Q4573 as ?p) }
    UNION { BIND(wd:Q39666 as ?p) }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
GROUP BY ?p ?pLabel
ORDER BY ?url_comp2

Try it!

A 7 level inverse tree (of Property categories)

#defaultView:Tree
SELECT ?root ?rootLabel ?item ?itemL ?itemImage ?item2 ?itemL2 ?itemImage2 ?item3 ?itemL3 ?itemImage3 ?item4 ?itemL4 ?itemImage4 ?item5 ?itemL5 ?itemImage5 ?item6 ?itemL6 ?itemImage6 ?item7 ?itemL7 ?itemImage7 WHERE {
  BIND(wd:Q18616576 AS ?root)
  BIND(wdt:P279 AS ?property)
  ?item ?property ?root.
  OPTIONAL { ?item wdt:P18 ?itemImage. }
  OPTIONAL {
    ?item2 ?property ?item.
    OPTIONAL { ?item2 wdt:P18 ?itemImage2. }
    OPTIONAL {
      ?item3 ?property ?item2.
      OPTIONAL { ?item3 wdt:P18 ?itemImage3. }
      OPTIONAL {
        ?item4 ?property ?item3.
        OPTIONAL { ?item4 wdt:P18 ?itemImage4. }
        OPTIONAL {
          ?item5 ?property ?item4.
          OPTIONAL { ?item5 wdt:P18 ?itemImage5. }
          OPTIONAL {
            ?item6 ?property ?item5.
            OPTIONAL { ?item6 wdt:P18 ?itemImage6. }
            OPTIONAL {
              ?item7 ?property ?item6.
              OPTIONAL { ?item7 wdt:P18 ?itemImage7. }
            }
          }
        }
      }
    }
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,es,fr,de,mul".
    ?root rdfs:label ?rootLabel.
    ?item rdfs:label ?itemLabel;
      schema:description ?itemDescription.
    ?item2 rdfs:label ?itemLabel2;
      schema:description ?itemDescription2.
    ?item3 rdfs:label ?itemLabel3;
      schema:description ?itemDescription3.
    ?item4 rdfs:label ?itemLabel4;
      schema:description ?itemDescription4.
    ?item5 rdfs:label ?itemLabel5;
      schema:description ?itemDescription5.
    ?item6 rdfs:label ?itemLabel6;
      schema:description ?itemDescription6.
    ?item7 rdfs:label ?itemLabel7;
      schema:description ?itemDescription7.
  }
  BIND(CONCAT(?itemLabel, ": ", COALESCE(?itemDescription, "")) AS ?itemL)
  BIND(CONCAT(?itemLabel2, ": ", COALESCE(?itemDescription2, "")) AS ?itemL2)
  BIND(CONCAT(?itemLabel3, ": ", COALESCE(?itemDescription3, "")) AS ?itemL3)
  BIND(CONCAT(?itemLabel4, ": ", COALESCE(?itemDescription4, "")) AS ?itemL4)
  BIND(CONCAT(?itemLabel5, ": ", COALESCE(?itemDescription5, "")) AS ?itemL5)
  BIND(CONCAT(?itemLabel6, ": ", COALESCE(?itemDescription6, "")) AS ?itemL6)
  BIND(CONCAT(?itemLabel7, ": ", COALESCE(?itemDescription7, "")) AS ?itemL7)
}
ORDER BY (?itemL) (?itemL2) (?itemL3) (?itemL4) (?itemL5) (?itemL6) (?itemL7)
LIMIT 20000

Try it!

Properties likely missing type constraints

# All properties whose values are items and which lack a type constraint and property scope constraint.
# Some of these may be actually general properties, while others just don't have their relevant type constraint defined yet.
#
# The lack of property scope constraint just identifies high priority ones, as that constraint is always required, so
# if it is missing, it makes it more likely that there is a reasonable type constraint that just hasn't been defined.
SELECT ?property (GROUP_CONCAT(?propertyCategoryLabel; SEPARATOR = "; ") AS ?categories) ?propertyLabel ?propertyDescription ?propertyAltLabel WHERE {
  {
    SELECT ?property ?propertyCategoryLabel ?propertyLabel ?propertyDescription ?propertyAltLabel WHERE {
      ?property wikibase:propertyType wikibase:WikibaseItem.
      MINUS { ?property wdt:P2302 wd:Q21503250. }
      MINUS { ?property wdt:P2302 wd:Q53869507. }
      OPTIONAL { ?property wdt:P31 ?propertyCategory. }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
    }
  }
}
GROUP BY ?property ?propertyLabel ?propertyDescription ?propertyAltLabel

Try it!

==== Most used properties ====

#title: Most Used Properties for Hospitals in Wikidata
#defaultView:BubbleChart
# This query retrieves the most frequently used properties for items that are instances of a hospital (Q16917).
# It counts how many times each property is used and displays the results in descending order.
# The visualization is set to a Bubble Chart to provide a visual representation of property usage.

SELECT ?property ?propertyLabel ?count
WHERE {
  # Subquery to calculate the count of each property used by hospital items
  {
    SELECT 
      (IRI(REPLACE(STR(?prop), "http://www.wikidata.org/prop/direct/", "http://www.wikidata.org/entity/")) AS ?property)  # Convert direct property to property entity
      (COUNT(*) AS ?count)  # Count the number of occurrences for each property
    WHERE {
      ?item wdt:P31 wd:Q16917 .  # Select items that are instances of a hospital
      ?item ?prop ?value .        # Retrieve all properties and their values for these items
      FILTER(STRSTARTS(STR(?prop), STR(wdt:))) .  # Ensure only direct properties (wdt:) are considered
    }
    GROUP BY ?prop  # Group results by property to aggregate counts
    ORDER BY DESC(?count)  # Order properties by count in descending order
  }
  
  # Retrieve human-readable labels for the properties
  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".  # Fetch labels in the user's language or English
  }
}
ORDER BY DESC(?count)  # Final ordering of the results by count
LIMIT 1000
Most Used Properties for Hospitals in Wikidata

Reference

Obsah reference pro konkrétní tvrzení

# See also the SPARQL manual
# https://en.wikibooks.org/wiki/SPARQL/WIKIDATA_Qualifiers,_References_and_Ranks
# In this example we look for statements which assign a specific value (Q51955019)
# to the property P1343 and then look for references of that property, specifically
# the string associated to P958 for the reference. May actually bring up references
# for other P1343 statements; uses the shortened expression syntax with brackets.
SELECT ?item ?reference
WHERE {
  ?item wdt:P1343 wd:Q51955019 .
  ?item p:P1343 [ prov:wasDerivedFrom [ pr:P958 ?reference ] ] .
}
Try it!

Subclasses

Some classes with both physical and non-physical super-classes

# This gives a list of classes whose super-classes include both "physical entity" and "non-physical entity".
# One of these is, presumably, in error.
# Due to timeouts, it is necessary to explicitly limit the depth.
SELECT DISTINCT ?item ?itemLabel WHERE {
  {
    SELECT ?item WHERE { ?item (wdt:P279/wdt:P279/(wdt:P279?)/(wdt:P279?)/(wdt:P279?)) wd:Q7048977, wd:Q112276019. }
    LIMIT 300
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,es,fr,de,mul". }
}
ORDER BY (?itemLabel)
Try it!

Projekty Wikimedia

Země, které mají odkazy na stránky en.wiki

SELECT ?country ?countryLabel ?article WHERE {

    ?country wdt:P31 wd:Q3624078 . # sovereign state
    ?article schema:about ?country .
    ?article schema:isPartOf <https://en.wikipedia.org/>.

    SERVICE wikibase:label {
       bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en"
    }
}
Try it!

Kanadské předměty bez anglického článku ve Wikipedii

#added before 2019-02

SELECT ?item ?itemLabel ?cnt WHERE {
{
  SELECT ?item (COUNT(?sitelink) AS ?cnt) WHERE {
  ?item wdt:P27|wdt:P205|wdt:P17 wd:Q16 . #Canadian subjects.
  MINUS {?item wdt:P106 wd:Q488111 .} #Minus occupations that would be inappropriate in most situations.
  MINUS {?item wdt:P106 wd:Q3286043 .}
  MINUS {?item wdt:P106 wd:Q4610556 .}
  ?sitelink schema:about ?item .
  FILTER NOT EXISTS {
    ?article schema:about ?item .
    ?article schema:isPartOf <https://en.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
  }
  } GROUP BY ?item ORDER BY DESC (?cnt) LIMIT 1000 #Sorted by amount of articles in other languages. Result limited to 1000 lines to not have a timeout error.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,fr,es,de" } #Service to resolve labels in (fallback) languages: automatic user language, default for all languages, English, French, Spanish, German.
} ORDER BY DESC (?cnt)
Try it!

Země, které mají označení doporučený článek na ruské Wikipedii

SELECT ?sitelink ?itemLabel WHERE {
  ?item wdt:P31 wd:Q6256.
  ?sitelink schema:isPartOf <https://ru.wikipedia.org/>;
     schema:about ?item;
     wikibase:badge wd:Q17437796 . # Sitelink is badged as a Featured Article
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" } .
} ORDER BY ?itemLabel
Try it!

Počty odkazů na stránky Wikipedie pro položky s Art UK artist ID (P1367) pro každý jazyk

SELECT ?lang (COUNT(DISTINCT ?article) AS ?count) WHERE {
  hint:Query hint:optimizer "None".
  ?item wdt:P1367 ?yp_id .
  ?article schema:about ?item . # find articles about things with an Art UK artist identifier
  ?article schema:isPartOf / wikibase:wikiGroup "wikipedia" . # only Wikipedia articles
  hint:Prior hint:gearing "forward" .
  # This hint says to search the property chain above from left to right ("forward"),
  # i.e. it is checked if each previously found value for ?article is linked to a Wikipedia.
  # The default ("reverse") would be to search it from right to left, i.e. find all Wikipedia
  # articles first, and then select the intersection with the previously found values of ?article.
  ?article schema:inLanguage ?lang .
} GROUP BY ?lang
ORDER BY DESC (?count)
Try it!

Názvy článků o ukrajinských vesnicích na rumunské Wikipedii

#Show titles of articles about Ukrainian villages on Romanian Wikipedia, plus English and Ukrainian labels in Wikidata items
#added in 2017-05
SELECT DISTINCT ?item ?LabelEN ?LabelUK ?page_titleRO WHERE {
  # item: is a - village
  ?item wdt:P31 wd:Q532 .
  # item: country - Ukraine
  ?item wdt:P17 wd:Q212 .
  # exists article in item that is ro.wiki
  ?article schema:about ?item ; schema:isPartOf <https://ro.wikipedia.org/> ; schema:name ?page_titleRO .
  # wd labels
  ?item rdfs:label ?LabelEN FILTER (lang(?LabelEN) = "en") .
  ?item rdfs:label ?LabelUK FILTER (lang(?LabelUK) = "uk") .
}
LIMIT 300
Try it!

Stránky Wikisource pro autory vědeckých článků

#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
Try it!

Položky s ID GTAA a jejich články na nizozemské a anglické Wikipedii

SELECT ?item ?itemLabel ?gtaa ?_articleEN ?_articleNL where {
  ?item wdt:P1741 ?gtaa. # GTAA id
  OPTIONAL {
    ?_articleEN schema:about ?item.
    ?_articleNL schema:about ?item.
    ?_articleEN schema:isPartOf <https://en.wikipedia.org/>.
    ?_articleNL schema:isPartOf <https://nl.wikipedia.org/>.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,nl". }
}
Try it!

Lidé zesnulí v roce 2018 seřazení podle počtu odkazů na stránky

SELECT ?person ?personLabel ?died ?sitelinks
WITH {
  SELECT *
  WHERE {
    ?person wdt:P31 wd:Q5;
      wdt:P570 ?died.
    FILTER (?died >= "2018-01-01T00:00:00Z"^^xsd:dateTime && ?died < "2019-01-01T00:00:00Z"^^xsd:dateTime)
    ?person wikibase:sitelinks ?sitelinks.
  }
  ORDER BY desc(?sitelinks)
  LIMIT 100
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY desc(?sitelinks)
Try it!
SELECT ?item ?comm ?p373 ?cat WHERE {
  ?item wdt:P131* wd:Q894107. # ... municipality ...

  OPTIONAL {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  BIND(replace(wikibase:decodeUri(SUBSTR(STR(?comm), 45)),"_"," ") AS ?comm_decode)
   OPTIONAL {?item wdt:P373 ?p373 .}

 bind(COALESCE(?comm_decode, ?p373) as ?cat) .
 VALUES ?trida { wd:Q1746392 wd:Q108325 wd:Q4989906 wd:Q10861631 wd:Q15077340 wd:Q1516537 wd:Q47008262} # chapel, small monument, memorial, belltower, memorial monument, technical monument, group of small monuments
 ?item wdt:P31/wdt:P279* ?trida. # small monument
  }
Try it!

Nejslavnější dítě knihovníka

#Children of librarians with the most number of sitelinks (as a proxy for fame)
SELECT ?person ?personLabel ?parentLabel ?linkcount WHERE {
    ?parent wdt:P106 wd:Q182436 .
    ?parent wdt:P40 ?person .
    ?person wikibase:sitelinks ?linkcount .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,de,es,ar,fr" }
}
GROUP BY ?linkcount ?person ?personLabel ?parent ?parentLabel
ORDER BY DESC(?linkcount)
Try it!

Všechny jazyky s kódem jazyka Wikimedia (P424)

#title: <span lang="en" dir="ltr" class="mw-content-ltr">All languages with a Wikimedia language code (P424)</span>
# Date: 2021-09-24
SELECT DISTINCT ?lang_code ?itemLabel ?item
WHERE
{
  # ?lang is one of these options
  VALUES ?lang {
    wd:Q34770   # language
    wd:Q436240  # ancient language
    wd:Q1288568 # modern language
    wd:Q33215   # constructed language
  }
  ?item wdt:P31 ?lang ;
    # get the language code
    wdt:P424 ?lang_code .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} ORDER BY ?lang_code
All languages with a Wikimedia language code (P424)

Všechny Wikipedie

# Get all Wikipedia sites
SELECT ?item ?itemLabel ?website
WHERE
{
  #?item wdt:P31 wd:Q10876391.
  ?item wdt:P856 ?website.
  ?website wikibase:wikiGroup "wikipedia".
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Doporučené články všech projektů Wikimedia

# Get all Featured Articles (Q17437796)
SELECT ?lang ?name ?itemLabel ?sitelink ?linkcount ?item WHERE {
  ?item wikibase:sitelinks ?linkcount.
  ?sitelink schema:name ?name;
    schema:inLanguage ?lang;
    schema:about ?item;
    # Sitelink is badged as a Featured Article
    wikibase:badge wd:Q17437796.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

People born in Lisbon without articles on ptwiki but with articles on other Wikipedias

# People born in Lisbon that don't have an article on Portuguese Wikipedia
# but do have an article on other Wikipedias.
SELECT DISTINCT ?person ?personLabel WHERE
{
  ?person wdt:P31 wd:Q5. # Instance of human
  ?person (wdt:P19|wdt:P20)/wdt:P131* wd:Q597. # Born or died in Lisbon (or anywhere within)
  MINUS { ?ptArticle schema:about ?person; schema:isPartOf <https://pt.wikipedia.org/>. } # No article on pt.wiki
  ?anyArticle schema:about ?person; schema:isPartOf/wikibase:wikiGroup "wikipedia". # Do have (some) Wikipedia article
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],pt,en,mul". }
}
Try it!


List of French communes in Finistère, formatter for Lingualibre.org list generator

# author: Yug 2024-12-11
# https://w.wiki/CNrc
SELECT ?id ?label
WHERE {
  ?id wdt:P31 wd:Q484170;  # item is `commune de france` (Q484170)
      wdt:P131 wd:Q3389.   # item is `located in administrative entity` (P131) of `finistere` (Q3389)
  ?id rdfs:label ?label.   # fetch labels
  FILTER(lang(?label) = "fr") # keep French ones
}
Try it!

Geografie

Státy

Seznam současných zemí a jejich hlavních měst

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 "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY ?countryLabel
Try it!

Členské státy OSN

SELECT DISTINCT ?state WHERE {
  ?state wdt:P31/wdt:P279* wd:Q3624078;
         p:P463 ?memberOfStatement.
  ?memberOfStatement a wikibase:BestRank;
                     ps:P463 wd:Q1065.
  MINUS { ?memberOfStatement pq:P582 ?endTime. }
  MINUS { ?state wdt:P576|wdt:P582 ?end. }
}
Try it!

Největší města v jednotlivých zemích

#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 "[AUTO_LANGUAGE],mul,en" .
  }
}
ORDER BY DESC(?population)
Try it!

Počet obyvatel na milion obyvatel pro všechny země EU

#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 {
      wd:Q458 wdt:P150 ?country . # European Union contains administrative territorial entity
      # 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 "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY DESC(?wikiPersonsPerM)
Try it!

Články o Wikidatech

#papers about Wikidata
SELECT ?item ?itemLabel
WHERE {
  ?item wdt:P921 wd:Q2013. hint:Prior hint:runFirst true.
  ?item wdt:P31/wdt:P279* wd:Q191067.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
LIMIT 100
Try it!

Země seřazené podle počtu obyvatel

# defaultView:BubbleChart
SELECT DISTINCT ?countryLabel ?population
{
  ?country wdt:P31 wd:Q6256 ;
           wdt:P1082 ?population .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
GROUP BY ?population ?countryLabel
ORDER BY DESC(?population)
Try it!

Počet obyvatel zemí spolu s celkovým počtem obyvatel měst

U každé země uvádí počet obyvatel a celkový počet obyvatel všech sídel této země. Pokud by údaje byly úplné a počet obyvatel by se měřil současně pro každou zemi a příslušná města, pak by poměr byl 1 ku 1.

SELECT ?country ?countryLabel ?population ?totalCityPopulation (?population / ?totalCityPopulation AS ?ratio) {
  ?country wdt:P1082 ?population .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,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
Try it!

Názvy afrických zemí ve všech jejich úředních jazycích a v angličtině

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_ol ?official_language
Try it!

Jazyky a dialekty používané v Nizozemsku a jejich možné edice na Wikipedii

SELECT DISTINCT ?language ?languageLabel ?wikipediaLabel where {
  ?language wdt:P31 ?instance;
            wdt:P17 wd:Q55.
  FILTER (?instance in (wd:Q34770, wd:Q33384)).
  OPTIONAL {
    ?wikipedia wdt:P31 wd:Q10876391;
               wdt:P407 ?language.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,nl,en". }
} GROUP BY ?language ?languageLabel ?wikipediaLabel
Try it!

Města

Počet obyvatel měst a obcí v Dánsku a jejich identifikátor relace OSM

# Population of cities and towns in Denmark and their OSM relation id
# This shows a simple OR using VALUES and a variable
SELECT ?city ?cityLabel ?population ?OSM_relation_ID WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  VALUES ?town_or_city {
    wd:Q3957
    wd:Q515
  }
  ?city (wdt:P31/(wdt:P279*)) ?town_or_city;
    wdt:P17 wd:Q35.
  OPTIONAL { ?city wdt:P1082 ?population. }
  OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. }
}
LIMIT 100
Try it!

Bývalá hlavní města

#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 "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Největší města světa

#defaultView:BubbleChart
SELECT ?cityLabel ?population ?gps
WITH {
  SELECT DISTINCT *
  WHERE {
    ?city wdt:P31/wdt:P279* wd:Q515 .
    ?city wdt:P1082 ?population .
    ?city wdt:P625 ?gps .
  }
  ORDER BY DESC(?population)
  LIMIT 100
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?population)
Try it!

Města velká jako Eindhoven plus minus 1000

#defaultView:Map
SELECT ?city ?cityLabel ?location ?populatie2 WHERE {
  { SELECT DISTINCT * 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 "[AUTO_LANGUAGE],mul,nl" }
}
Try it!

Kde na světě se nachází Antverpy

#defaultView:Map
SELECT DISTINCT ?settlement ?name ?coor
WHERE
{

   ?subclass_settlement wdt:P279+ wd:Q486972 .
   ?settlement wdt:P31 ?subclass_settlement ;
               wdt:P625 ?coor ;
                rdfs:label ?name .
   FILTER regex(?name, "Antwerp", "i")

}
Try it!

Cílové destinace z letiště Antverpy

#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 "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Města propojená evropskou silnicí E40

#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 "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Města spojená Transmongolskou a Transsibiřskou magistrálou

#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 "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Metro station of city with template

#TEMPLATE={"template":"metro station of ?city","variables":{"?city":{"query":"SELECT DISTINCT ?cityLabel where {?city wdt:P31/wdt:P279* wd:Q1637706. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],mul,en\"} }"} } }
#defaultView:Map{"hide":["?comm1Label","?coord1", "?comm2","coord2","?layer","?str","?line", "?rgb"],"layer":"?connectingLine1Label"}
SELECT ?comm1 ?comm1Label ?coord1 ?comm2 ?coord2 ?line ?connectingLine1 ?connectingLine1Label ?layer ?rgb WHERE {
  BIND(wd:Q8686 AS ?city)
  ?comm1 wdt:P31/wdt:P279* wd:Q928830 ;
         wdt:P131*/wdt:P279* ?city;
         wdt:P625 ?coord1 ;
         wdt:P81 ?connectingLine1;
         wdt:P197 ?comm2 .
  ?connectingLine1 wdt:P465 ?rgb.
  ?comm2 wdt:P81 ?connectingLine2;
         wdt:P625 ?coord2 .
  FILTER (?connectingLine1 = ?connectingLine2)

  ?comm1 p:P625 [# ps:P625 [];
                  psv:P625 [ wikibase:geoLongitude ?coord1lon; wikibase:geoLatitude ?coord1lat; ] ] .
  ?comm2 p:P625 [# ps:P625 [];
                  psv:P625 [ wikibase:geoLongitude ?coord2lon; wikibase:geoLatitude ?coord2lat; ] ] .

  BIND(CONCAT('LINESTRING (', STR(?coord1lon), ' ', STR(?coord1lat), ',', STR(?coord2lon), ' ', STR(?coord2lat), ')') AS ?str) .
  BIND(STRDT(?str, geo:wktLiteral) AS ?line) .
  BIND(?connectingLine1 AS ?layer)

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

ORDER BY (?connectingLine1Label)
Try it!

Města spojená s Paramaribo (Surinam) hlavními silnicemi

#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 "[AUTO_LANGUAGE],mul,en". }
  }
Try it!

Názvy 100 měst s více než 1000000 obyvateli v rodných jazycích jejich zemí

# 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 . hint:Prior hint:runFirst true.

  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
Try it!

Vzdálenosti mezi dvěma městy nebo obcemi v oblasti

seskupené podle vzdálenosti, barevně označené
#defaultView:BarChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
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],mul,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
Try it!
seskupené podle obcí na ose x, abecedně
#defaultView:ScatterChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
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],mul,en".
    ?mun rdfs:label ?from.
    ?mun2 rdfs:label ?to.
  }
}
ORDER BY ?from ?kilometers
Try it!
seskupené podle obcí na ose x, podle součtu vzdáleností
#defaultView:ScatterChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
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],mul,en".
    ?mun rdfs:label ?from.
    ?mun2 rdfs:label ?to.
  }
}
ORDER BY ?from ?kilometers
Try it!
seskupené podle obcí na ose x, animované podle obcí na ose x
#defaultView:ScatterChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
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],mul,en".
    ?mun rdfs:label ?from.
    ?mun2 rdfs:label ?to.
  }
}
ORDER BY ?from ?kilometers
Try it!
seskupené podle obcí na ose x, animované podle obcí na ose z
#defaultView:ScatterChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
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],mul,en".
    ?mun rdfs:label ?from.
    ?mun2 rdfs:label ?to.
  }
}
ORDER BY ?from ?kilometers
Try it!
seskupené podle obcí na ose x, animované podle skupin s pevným rozsahem vzdáleností.
#defaultView:ScatterChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
SELECT ?from (?distNum AS ?kilometers) ?to (?distGrp 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
    }
  }
  #FILTER (STR(?mun) <= STR(?mun2)).
  BIND(geof:distance(?loc, ?loc2) AS ?distNum).
  BIND(COALESCE(
    IF(?distNum >= 40, "40 km und mehr", 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).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en".
    ?mun rdfs:label ?from.
    ?mun2 rdfs:label ?to.
  }
}
ORDER BY ?animation ?from ?kilometers
Try it!
seskupené podle obcí na ose x, animované podle vzdálenosti (nejvzdálenější, 2. nejvzdálenější, ...)
#defaultView:ScatterChart
PREFIX var_muntype: <http://www.wikidata.org/entity/Q15284>
PREFIX var_area: <http://www.wikidata.org/entity/Q6308>
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],mul,en".
    ?mun rdfs:label ?from.
    ?mun2 rdfs:label ?to.
  }
}
ORDER BY ?rank_group ?kilometers ?from
Try it!

Zobrazit všechny nizozemské obce, které mají společnou hranici s Alphen aan den Rijn (Q213246), přičemž se ignoruje rank

SELECT ?muni ?muniLabel where {
  ?muni p:P31 [ps:P31 wd:Q2039348];
        wdt:P47 wd:Q213246.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". }
}
Try it!

Hraniční města světa

# To filter by country add FILTER (?country = wd:Qxx)
#defaultView:Map
# To show the cities of several countries use FILTER (?country IN (wd:Qxx, wd:Qyy))
# To obtain cities that are part of a particular continent or territory ?country
# should not be optional and add "?country wdt:P361 wd:Qxx ."

SELECT ?border_city ?border_cityLabel ?countryLabel ?coords
WHERE {
  ?border_city wdt:P31 wd:Q902814.
  OPTIONAL { ?border_city wdt:P17 ?country. }
  OPTIONAL { ?border_city wdt:P625 ?coords. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en".
                         ?border_city rdfs:label ?border_cityLabel.
                         ?country rdfs:label ?countryLabel.}
}
GROUP BY ?border_city ?border_cityLabel ?countryLabel ?coords
ORDER BY ?countryLabel ?border_cityLabel
Try it!

Municipalities of the Basque Country without former municipalities

# This query has two different features:
# First, it is able to search for municipalities which are part of two different states, looking to P527
# Second, it doesn't show former municipalities, filtering the old ones from the P582 statement.
SELECT DISTINCT ?udalerri ?udalerriLabel WHERE { 
  ?udalerri p:P31 ?status.
  ?udalerri wdt:P131*/^wdt:P527 wd:Q47588 .
  {?status ps:P31 wd:Q484170.} UNION {?status ps:P31 wd:Q2074737}
  MINUS {?status pq:P582 ?old .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "eu,es,fr,en". }
}
Try it!

Řeky

Nejdelší řeky

#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 "[AUTO_LANGUAGE],mul,en" . }
} ORDER BY DESC(?length) ?itemLabel
LIMIT 50
Try it!

Nejdelší řeka každého kontinentu

SELECT ?continent ?river ?continentLabel ?riverLabel ?maxlength
WHERE
{
  {
    SELECT ?continent (MAX(?length) AS ?maxlength)
    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 ?maxlength;
         wdt:P30 ?continent.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY ?continentLabel
Try it!

Řeky v Antarktidě

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 "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Vodní útvar, do kterého ústí nejvíce vodních toků

# 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
Try it!

Mosty přes řeky v bývalé vládní čtvrti Lipsko

#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],mul,en,de".
    ?bridge rdfs:label ?bridgeLabel.
    ?watercourse rdfs:label ?watercourseLabel.
    wd:P571 rdfs:label ?sKey.
    wd:P576 rdfs:label ?eKey.
  }
}
GROUP BY ?bridge ?watercourse
Try it!

Hory

Mons (hory), se souřadnicemi, které se nenachází na Zemi

SELECT DISTINCT ?item ?name ?coord ?lat ?lon ?globe
{
   ?item wdt:P31 wd:Q429088 ;
         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 "[AUTO_LANGUAGE],mul,en" .
    ?item rdfs:label ?name
   }
}
ORDER BY ASC (?name)
Try it!

Nejvyšší hory ve vesmíru

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Elevations over 8000 meter</span>
SELECT ?elevation ?item ?itemLabel ?itemDescription ?coord WHERE {
  hint:Query hint:optimizer "None".
  ?st psn:P2044 ?psn .
  ?psn wikibase:quantityAmount ?elevation . FILTER(?elevation > 8000) .
  ?psn wikibase:quantityUnit wd:Q11573 .
  ?st wikibase:rank ?rank . FILTER(?rank != wikibase:DeprecatedRank) .
  ?item p:P2044 ?st .
  ?item wdt:P625 ?coord .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY DESC(?elevation)
Elevations over 8000 meter

Nejvyšší hory ve vesmíru (s jednotkami)

#Elevations over 8000
#Displays units
#Last updated 2021-04-25

SELECT ?elevation ?unit ?unitLabel ?item ?itemLabel ?itemDescription ?coord
WHERE
{
  ?psv_triples wikibase:quantityAmount ?elevation .
  filter(?elevation > 8000)
  ?psv_triples wikibase:quantityUnit ?unit .

  ?p_triples psv:P2044 ?psv_triples .
  ?p_triples a wikibase:BestRank .

  ?item p:P2044 ?p_triples .

  ?item wdt:P625 ?coord .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY DESC(?elevation)
Try it!

Nejvyšší hory ve vesmíru (s jednotkami, kompaktní podoba)

#Elevations over 8000
#Displays units
#Last updated 2021-04-25

SELECT ?elevation ?unit ?unitLabel ?item ?itemLabel ?itemDescription ?coord
WHERE
{
  ?item wdt:P2044 ?elevation .
  # this could be dropped, but is included to speed it up
  filter(?elevation > 8000)

  ?item p:P2044 [ a wikibase:BestRank ; psv:P2044 [ wikibase:quantityAmount ?elevation ; wikibase:quantityUnit ?unit ] ] .

  ?item wdt:P625 ?coord .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY DESC(?elevation)
Try it!

Hory vysoké přes 8000 metrů

#Last updated 2021-04-25
#defaultView:Map
SELECT ?item ?itemLabel ?itemDescription ?coord ?elevation
WHERE
{
  ?item wdt:P31 wd:Q8502 .
  ?item p:P2044 [ a wikibase:BestRank; psn:P2044/wikibase:quantityAmount ?elevation ]
  FILTER(?elevation >= 8000 )
  ?item wdt:P625 ?coord.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Try it!

Italské hory vyšší než 4000 metrů

#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" }
}
Try it!

Místa v Antarktidě vzdálená více než 3000 km od jižního pólu

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Places in Antarctica over 3000km away from the South Pole</span>
#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 3000km away from south pole
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Places in Antarctica over 3000km away from the South Pole

Stanice metra Paris Métro Line 1 (Q13224) v Paříži

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:P5051 wd:Q585752;
                                       pq:P81 wd:Q13224] .
    ?adjacent rdfs:label ?adjacentL FILTER (lang(?adjacentL) = "en")
  }
?item wdt:P1619 ?founded_date. #needs existence
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
} ORDER BY ?itemLabel
Try it!

Mapa sportovišť na Broadwayi

#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" .
  }
}
Try it!

S kolika státy sousedí tento stát USA

SELECT ?state ?stateLabel ?borders
WHERE
{
  {
    SELECT ?state (COUNT(?otherState) as ?borders)
    WHERE
    {
    ?state wdt:P31 wd:Q35657 .
    ?otherState wdt:P47 ?state .
    ?otherState wdt:P31 wd:Q35657 .
    }
    GROUP BY ?state
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
  }
}
ORDER BY DESC(?borders)
Try it!

Místa, která se nacházejí v nadmořské výšce pod 10 metrů nad mořem

#defaultView:Map
SELECT ?place ?location ?elev ?image
WHERE
{
  ?place p:P2044/psv:P2044 ?placeElev.
  ?placeElev wikibase:quantityAmount ?elev.
  ?placeElev wikibase:quantityUnit ?unit.
  bind(0.01 as ?km).
  filter( (?elev < ?km*1000 && ?unit = wd:Q11573)
       || (?elev < ?km*3281 && ?unit = wd:Q3710)
       || (?elev < ?km      && ?unit = wd:Q828224) ).
  ?place wdt:P625 ?location.
  OPTIONAL { ?place wdt:P18 ?image }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Try it!

Globy používané pro znázornění souřadnic

SELECT (count(?v) as ?c) ?globe
WHERE
{
  ?v wikibase:geoGlobe ?globe
}
GROUP BY ?globe
ORDER BY DESC(?c)
Try it!

Místa v okruhu 1 km od Empire State Building

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
Try it!

Výběr francouzských obcí podle kódu INSEE (vyberte podle identifikátoru)

SELECT ?item ?itemLabel ?inseeCode {
  ?item wdt:P374 ?inseeCode .
  FILTER (?inseeCode in ("75056", "69123", "13055"))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Try it!

Mapa a seznam obcí v Nizozemsku

#Concise list & map of the 355 Dutch municipalities, their geo coordinates and their provinces, per 1-1-2019
#See also:
#https://almanak.overheid.nl/organisaties/Gemeenten/ - 355 in aantal
#https://nl.wikipedia.org/wiki/Lijst_van_Nederlandse_gemeenten - 355 in aantal

#defaultView:Map
SELECT ?muni ?muniLabel ?location where {
  ?muni p:P31 ?instanceOf; # Get statement because we need this later
        wdt:P625 ?location. # And location
  ?instanceOf ps:P31 wd:Q2039348. # P31 should be 'municipality of the Netherlands'
  MINUS { ?muni wdt:P31 wd:Q7265977. } # Don't show former municipalities
  MINUS { ?instanceOf pq:P582 ?endTime. } # And don't show municipalities that have an end time
  SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". } # Show names in Dutch
}
Try it!

Čísla tísňového volání podle počtu obyvatel, kteří je využívají

#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 "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY DESC(?population)
Try it!

Německé spolkové země seřazené podle počtu sídel firem na milion obyvatel

# 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)
Try it!

Oblíbená jména podle místa narození

#defaultView:BubbleChart
SELECT ?cid ?firstname (COUNT(*) AS ?count)
WHERE
{
  ?pid wdt:P19 wd:Q64.
  ?pid wdt:P735 ?cid.
  OPTIONAL {
    ?cid rdfs:label ?firstname
    FILTER((LANG(?firstname)) = "en")
  }
}
GROUP BY ?cid ?firstname
ORDER BY DESC(?count) ?firstname
LIMIT 50
Try it!

Mapa míst zmíněných v cestopisech s textem ve francouzštině přístupná online

#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
Try it!

Věci, které se nacházejí v místě, kde se rovník setkává s hlavním poledníkem.

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
Try it!

Francouzské obce s názvy končícími na ac

#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...
}
Try it!

Budovy ve více než jedné zemi

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
Try it!

Ulice pojmenované po osobě

SELECT ?street ?streetLabel ?cityLabel ?personLabel
WHERE
{
    ?street wdt:P31 wd:Q79007 .
    ?street wdt:P17 wd:Q142 .
    ?street wdt:P131 ?city .
    ?street wdt:P138 ?person .
    ?person wdt:P31 wd:Q5
    SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
}
ORDER BY ?city
Try it!

Ulice ve Francii bez města

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
Try it!

Bankomaty v okolí Mnichova patřící do mezibankovní sítě Bankcard-Servicenetz (sdružený dotaz)

#defaultView:Map{"hide":["?atm","?geometry"], "layer": "?bankLabel"}

PREFIX lgdo: <http://linkedgeodata.org/ontology/>
PREFIX geom: <http://geovocab.org/geometry#>
PREFIX bif: <bif:>

SELECT ?atm ?geometry ?bank ?bankLabel WHERE {
  hint:Query hint:optimizer "None".

  SERVICE <http://linkedgeodata.org/sparql> {
    { ?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. }
}
Try it!

Položky geograficky umístěné v okolí kanceláře Wikimedia Foundation, seřazené podle vzdálenosti

SELECT ?place ?location ?distance ?placeLabel WHERE {
    SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center "Point(-122.402251 37.789246)"^^geo:wktLiteral .
      bd:serviceParam wikibase:radius "1" .
      bd:serviceParam wikibase:distance ?distance .
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} ORDER BY ?distance LIMIT 100
Try it!

Deset největších ostrovů světa

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Ten largest islands in the world</span>
# Inspired by this infographic: https://redd.it/a6423t

#defaultView:ImageGrid
SELECT DISTINCT ?island ?islandLabel ?islandImage WHERE {
  ?island (wdt:P31/(wdt:P279*)) wd:Q23442.
  OPTIONAL { ?island wdt:P18 ?islandImage. }
  ?island (p:P2046/psn:P2046/wikibase:quantityAmount) ?islandArea.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY DESC (?islandArea)
LIMIT 10
Ten largest islands in the world

Městské brány v nizozemské provincii Zeeland

SELECT ?town ?townLabel ?gate ?gateLabel where {
  # Municipalities within the province
  ?muni wdt:P31 wd:Q2039348;
        wdt:P131 wd:Q705.
  # Instances of city gate located within any of the municipalities
  ?gate wdt:P31 wd:Q82117;
        wdt:P131 ?muni;
  # The Location (usually Town) that the gate is in
        wdt:P276 ?town.

  SERVICE wikibase:label { bd:serviceParam wikibase:language "nl". }
}
Try it!

Mapa ledovců

#by Jura1, 2021-05-21
#defaultView:Map{"hide":["?coor","?area_scale_km"], "layer": "?area_scale_km"}
SELECT ?item ?itemLabel ?itemDescription ?coor ?area_sqkm ?area_scale_km
{
  ?item wdt:P31/wdt:P279* wd:Q35666 .
  OPTIONAL { ?item wdt:P625 ?coor }
  OPTIONAL { ?item p:P2046 [ a wikibase:BestRank; psn:P2046/wikibase:quantityAmount ?area_sqm ] .
    BIND( ROUND(?area_sqm/10000)/100 as ?area_sqkm)
    BIND( strlen(str(ROUND(?area_sqm/1000000))) as ?area_scale_km)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Demografie

Rodiště lidí se jménem Antoine

# Coordinates of the birth places of people named Antoine
#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE
{
  ?item wdt:P31 wd:Q5 . # human
  ?item wdt:P735 wd:Q15235674.
  ?item wdt:P19 ?place.
  ?place wdt:P625 ?coord.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
}
Try it!

Průměrná délka života podle povolání

# 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)
Try it!

Položky s největším počtem dat narození

SELECT ?person (COUNT(?date) AS ?dateC) {
  ?person wdt:P569 ?date
}
GROUP BY ?person
HAVING (?dateC > 2)
ORDER BY DESC (?dateC)
LIMIT 100
Try it!

Věci/lidé s nejvíce dětmi

SELECT ?parent ?parentLabel ?count
WHERE
{
  {
    SELECT ?parent (COUNT(?child) AS ?count)
    WHERE
    {
      ?parent wdt:P40 ?child.
    }
    GROUP BY ?parent
    ORDER BY DESC(?count)
    LIMIT 10
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?count)
LIMIT 10
Try it!

Růst populace v Surinamu od roku 1960

#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
Try it!

Počet zemřelých podle měsíců od roku 2000

SELECT ?yearmonth (COUNT(?person) as ?count)
WHERE
{
  ?person wdt:P31 wd:Q5;
          p:P570/psv:P570 [
                wikibase:timePrecision ?precision ;
                wikibase:timeValue ?date ;
              ] .
  BIND(CONCAT(STR(YEAR(?date)),"-",STR(MONTH(?date))) as ?yearmonth).
  FILTER( ?date >= "2000-01-01T00:00:00"^^xsd:dateTime )
  FILTER( ?precision >= "10"^^xsd:integer ) # precision of at least month
}
GROUP BY ?yearmonth
Try it!

Politika

Nizozemské parlamentní volby 2017

Kandidáti pro nizozemské parlamentní volby v roce 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" }
}
Try it!

Rozložení pohlaví na kandidátkách pro nizozemské parlamentní volby 2017

#Kandidaten voor de Nederlandse tk verkiezingen van 2017
#defaultView:Dimensions
SELECT ?positie_op_lijst ?genderLabel ?politieke_partijLabel WHERE {
  ?item p:P3602 ?node.
  ?item wdt:P21 ?gender.
  ?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". }
}
Try it!

Kandidáti do nizozemských parlamentních voleb 2017 žijící v Antverpách, Belgie

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". }
}
Try it!

Kandidáti do nizozemských parlamentních voleb 2017 žijící v zahraničí

#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". }
}
Try it!

Povolání kandidátů do nizozemských parlamentních voleb 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". }
}
Try it!

Genderová vyváženost poslanců irského parlamentu

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
Try it!

Parlamentní shromáždění podle počtu křesel

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
Try it!

Seznam zemí podle věku hlavy vlády

#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)
Try it!

Počet ministrů, kteří jsou sami dětmi ministra, podle zemí

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|wdt:P25) [wdt:P39/wdt:P279* wd:Q83307] ;
         wdt:P27/wdt:P901 ?cc
}
GROUP BY ?cc
ORDER BY DESC(?number)
Try it!

Poslanci francouzského Národního shromáždění narození mimo Francii

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
Try it!

Seznam budov parlamentů s obrázky podle zemí

#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
Try it!

Počet jurisdikcí podle strany řízení

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
Try it!

Časová osa starostů města Amsterdam, Nizozemsko

#defaultView:Timeline
SELECT ?mayor ?mayorLabel ?start ?end where {
  ?mayor p:P39 ?position.
  ?position ps:P39 wd:Q13423495;
            pq:P580 ?start;
            pq:P582 ?end.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl,en". }
}
Try it!

Současní členové Senátu USA s uvedením obvodu, strany a data nástupu do funkce

SELECT ?senator ?senatorLabel ?districtLabel ?partyLabel ?assumedOffice (sample(?image) as ?image) where {
  # Get all senators
  ?senator p:P39 ?posheld; # With position held
           p:P102 ?partystatement. # And with a certain party

  # Get the party
  ?partystatement ps:P102 ?party.
  MINUS { ?partystatement pq:P582 ?partyEnd. } # but minus the ones the senator is no longer a member of
  MINUS { ?party wdt:P361 ?partOf. } # and the 'Minnesota Democratic–Farmer–Labor Party' and such

  # Check on the position in the senate
  ?posheld ps:P39 wd:Q4416090; # Position held is in the senate
           pq:P768 ?district;
           pq:P580 ?assumedOffice. # And should have a starttime

  MINUS { ?posheld pq:P582 ?endTime. } # But not an endtime

  # Add an image
  OPTIONAL { ?senator wdt:P18 ?image. }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?senator ?senatorLabel ?districtLabel ?partyLabel ?assumedOffice ORDER BY ?senatorLabel
Try it!

Ekonomika a podnikání

Mapa míst narození zemřelých ekonomů, barevně rozlišená podle období

#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
Try it!

Výrazní miliardáři

The following query uses these:

  • Properties: net worth (P2218)     , place of birth (P19)     
    #title: <span lang="en" dir="ltr" class="mw-content-ltr">Distinct billionaires</span>
    SELECT ?locationLabel ?item ?itemLabel (MAX(?billion) as ?billions)
    WHERE
    {
      ?item wdt:P2218 ?worth.
      ?item wdt:P19 ?location .
    
      FILTER(?worth>1000000000).
      BIND(?worth/1000000000 AS ?billion).
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de". }
    }
    GROUP BY ?locationLabel ?item ?itemLabel
    ORDER BY DESC(?billions)
    

Země, které přijaly kryptoměnu jako zákonné platidlo

The following query uses these:

  • Properties: instance of (P31)     , currency (P38)     , subclass of (P279)     
    # Countries that have adopted a cryptocurrency as legal tender
    SELECT ?country ?countryLabel ?currency ?currencyLabel
    WHERE
    {
      ?country wdt:P31 wd:Q6256.                # Instances of country
      ?country wdt:P38 ?currency.               # Country has currency
      ?currency wdt:P31/wdt:P279* wd:Q13479982. # Currency is instance or subclass of cryptocurrency
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
    }
    

Podniky kótované na NYSE a NASDAQ spolu s jejich ticker symbolem

The following query uses these:

  • Properties: stock exchange (P414)     , ticker symbol (P249)     
    # Business listed on NYSE and NASDAQ along with their ticker symbols
    SELECT DISTINCT ?id ?idLabel ?exchangesLabel ?ticker WHERE {
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
      ?id p:P414 ?exchange.
      VALUES ?exchanges { wd:Q13677 wd:Q82059 }
      ?exchange ps:P414 ?exchanges;
        pq:P249 ?ticker.
    }
    

Human Development Index of specified country(s)

The following query uses these:

  • Properties: Human Development Index (P1081)     , point in time (P585)     
    #title: <span lang="en" dir="ltr" class="mw-content-ltr">Human Development Index of specified country(s)</span>
    #defaultView:LineChart
    SELECT ?year ?hdi ?countryLabel WHERE {
      VALUES ?country {
        wd:Q148
        wd:Q39
        
        # to add another country
        # 1,uncomment the last commented line, 
        # 2,put cursor to the end of line, 
        # 3,and press CTRL+SPACE,or CTRL+ALT+SPACE, or ALT+ENTER. 
        # 4,and select first item, and press CTRL+ENTER.
        #wd:US
        
        }
      
      ?country p:P1081 ?statement.
      ?statement ps:P1081 ?hdi.
      ?statement pq:P585 ?date.
      
      BIND (STR(YEAR(?date)) as ?year)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
    }
    

Věda

Biologie a medicína

Nemoci

Počet existujících překladů nemocí na Wikidatech

Items used: disease (Q12136)

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)
Try it!
Síť interakcí mezi léky a nemocemi u infekčních onemocnění (zdroj: Disease Ontology, NDF-RT a ChEMBL)
#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).
}
Try it!
Počet položek Wikidata o nemocech a procento položek s odkazem na Disease Ontology.
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).
  }
}
Try it!
Infectious diseases with their human minimum and maximum incubation time (in days)
SELECT ?DiseaseLabel ((?min / 86400) AS ?Minimal_Incubation_Time) ((?max / 86400) AS ?Maximum_Incubation_Time)
WHERE {
  ?Disease wdt:P31/wdt:P279* wd:Q18123741 .
  ?Disease p:P3488/psn:P3488/wikibase:quantityAmount ?min .
  ?Disease p:P3487/psn:P3487/wikibase:quantityAmount ?max

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
ORDER BY ?DiseaseLabel
Try it!

Geny

Lidské geny aktualizované tento týden
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)
}
Try it!

Varianty

Počty typů genových variant z databáze CIViC
#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],mul,en" }
}
GROUP BY ?variant_typeLabel
ORDER BY ?counts
Try it!
Která varianta kterého genu předpovídá pozitivní prognózu u kolorektálního karcinomu
SELECT ?geneLabel ?variantLabel
WHERE
{
  VALUES ?disease {wd:Q188874}
    ?variant wdt:P3358 ?disease ; # P3358 Positive prognostic predictor
          wdt:P3433 ?gene . # P3433 biological variant of
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Try it!
Varianty spojené s karcinomem ledviny
# 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],mul,en" }
}
Try it!
Reference PubMed v CIViCdb
# 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],mul,en" }
}
Try it!
Počty variant podle typu prediktoru
#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],mul,en" }
}
GROUP BY ?propertyLabel ?prognostic_typeLabel
ORDER BY ?counts
Try it!

Proteiny

Wikidata - mapování UniprotId pro 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" }
}
Try it!

Metabolity

Metabolity a druhy, ve kterých se vyskytují
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX prov: <http://www.w3.org/ns/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 { ?source wdt:P2410 ?wpid. }
    OPTIONAL { ?source wdt:P356 ?doi. }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ASC(?compound)
Try it!
Interakce metabolit-metabolit (většinou konverze) a jejich změna pKa (sdružený dotaz)

Federated query using the WikiPathways SPARQL endpoint to retrieve interaction information. The dimensions plot show the pKa changes during metabolite-metabolite interaction. It must be noted here that many very basic or very acidic are reported in pathways as the uncharged structure, whereas in normal biological pathways these compounds are charged and then have quite different pKa charges.

#defaultView:Dimensions
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT ?wpid ?metaboliteLabel ?pKa ?pKa2 ?metabolite2Label ?wpid2
WITH {
  SELECT ?wpid ?source_pathway ?metabolite ?pKa ?pKa2 ?metabolite2 ?wpid2
  WHERE {
    # VALUES ?wpid { "WP550" }
    ?pathway wdt:P2410 ?wpid ;
             wdt:P527 ?metabolite ;
             wdt:P2888 ?source_pathway .
    ?metabolite wdt:P1117 ?pKa .

    SERVICE <http://sparql.wikipathways.org/sparql> {
      ?wp_mb1 wp:bdbWikidata ?metabolite .
      ?wp_mb1 dcterms:isPartOf ?interaction .
      ?interaction rdf:type wp:Interaction .
      ?wp_mb2 dcterms:isPartOf ?interaction .
      ?wp_mb2 wp:bdbWikidata ?metabolite2 .
      FILTER (?wp_mb1 != ?wp_mb2)
    }
  }
} AS %result
WHERE {
  INCLUDE %result
  ?metabolite2 wdt:P1117 ?pKa2 .
  ?pathway2 wdt:P2410 ?wpid2 ;
             wdt:P527 ?metabolite2 ;
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Taxon

Reverzní graf mateřského taxonu Asterophryinae
#defaultView:Graph
PREFIX gas: <http://www.bigdata.com/rdf/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" }
}
Try it!

Pathways

Všechny lidské pathways z Wikipathways
SELECT ?pathway ?pathwayLabel ?wpid WHERE {
   ?pathway wdt:P2410 ?wpid ;
            wdt:P703 wd:Q15978631 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!
Biomarkery ve Wikidatech, které interagují s proteiny v lidských pathways z Wikipathways
prefix void:  <http://rdfs.org/ns/void#>
prefix pav:   <http://purl.org/pav/>
prefix xsd:   <http://www.w3.org/2001/XMLSchema#>
prefix freq:  <http://purl.org/cld/freq/>
prefix biopax: <http://www.biopax.org/release/biopax-level3.owl#>
prefix skos:  <http://www.w3.org/2004/02/skos/core#>
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix gpml:  <http://vocabularies.wikipathways.org/gpml#>
prefix wp:    <http://vocabularies.wikipathways.org/wp#>
prefix dcterms: <http://purl.org/dc/terms/>
prefix wprdf: <http://rdf.wikipathways.org/>
prefix prov:  <http://www.w3.org/ns/prov#>
prefix foaf:  <http://xmlns.com/foaf/0.1/>
prefix dc:    <http://purl.org/dc/elements/1.1/>

SELECT DISTINCT ?biomarkerLabel ?proteinLabel ?geneID ?WP_gene ?PathwayID ?PathwayName #results that are displayed.
WHERE {
  VALUES ?biomarker {wd:Q420633 wd:Q27125809 wd:Q422462} #you can add more biomarkers here if needed, separated by a space.
  ?biomarker wdt:P31 wd:Q11173. #Stating that all biomarkers have to be "instance of" "chemical compound" (you could ommit this, but query will probably take longer).
  ?biomarker wdt:P638 ?pdbID . #Checking if a biomarker has a Protein Databank ID (PDB) -> meaning the metabolite can interact with a protein.
  ?protein wdt:P31 wd:Q8054 . #Stating that all proteins are "instance of" "protein"
  ?protein wdt:P638 ?pdbID . #Checking which proteins have a PDB ID, which we queried previously in relationship to the biomarkers.
  ?protein wdt:P702 ?gene . #Connecting the protein to a gene ("encoded by" relationship) -> to get an identifier we can use later in federated WikiPathways query.
  ?gene wdt:P703 wd:Q15978631 . #Now removing all genes that are not found in species "Homo sapiens". -> This info is not always available for proteins in WikiData.
  ?gene wdt:P2888 ?geneID . #Getting the "exact match" identifier for the gene, related to the protein, related to the biomarker.

  ##The IRI from Wikidata starts with http:// , where the one from WikiPathways starts with https:// , so we need to rewrite the IRI
    BIND(                      # Bind the created IRI into a new variable (called ?newIRI)
        IRI(                   # Convert the string back to an IRI
          CONCAT(              # Concatenate item 1 and 2 together as one string
               "https",        # First item to concat (more items can be added with a comma
              #Second item to concat:
               SUBSTR(         # Obtain a substring
                 STR(?geneID), # Convert the geneID IRI from Wikidata to a string,
                 5)            # removing the first 5 characters (<http)
        )) AS ?newIRI          # Name for the new variable
    )

  SERVICE <http://sparql.wikipathways.org/sparql> { #Connecting to the WikiPathways SPARQL endpoint.
     ?WP_pathway a wp:Pathway . #Stating a ?WP_pathway is indeed a pathway in the WikiPathways RDF .
     ?WP_pathway wp:organismName "Homo sapiens" . #Removing all PWs not for species Homo sapiens.
     ?WP_pathway dc:identifier ?PathwayID . #Query the identifier of the pathway in WPs.
     ?WP_pathway dc:title ?PathwayName . #Obtaining the name of the pathway.

     ?WP_gene a wp:Protein . #Stating that a ?WP_gene is a Protein DataNode (you could ommit this, to also get all DataNodes modeled as GeneProducts out, but query will take longer).
     ?WP_gene wp:bdbEntrezGene ?newIRI . #Connecting the previously queried "exact match" from WikiData to the NCBI/Entrez Gene ID in WPs.
     ?WP_gene dcterms:isPartOf ?WP_pathway . #Connecting the WP_gene to the WP_pathway.

   }
 OPTIONAL {?biomarker rdfs:label ?biomarkerLabel. #Create a label (aka name) for the biomarkers in WikiData, without using the service query.
FILTER(LANG(?biomarkerLabel) = "en").
}
   OPTIONAL {?protein rdfs:label ?proteinLabel. #Create a label(aka name) for the proteins in WikiData, without using the service query.
FILTER(LANG(?proteinLabel) = "en").
}

}
ORDER BY DESC (?biomarkerLabel) #Order results for biomarkers
Try it!
Žebříček nejcitovanějších prací ve 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
Try it!
Počty genů a metabolitů pro jednotlivé pathways
#Gene and metabolite counts per path
#defaultView:ScatterChart
SELECT ?path ?genes ?metabolites ?pathway WHERE {
  {SELECT DISTINCT ?path (COUNT(?pwPart) AS ?genes) WHERE {
      ?path wdt:P2410 ?WikipathsID.
      ?path wdt:P527 ?pwPart.
      ?pwPart wdt:P31 wd:Q7187.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    GROUP BY ?path ?genes
  }
  {SELECT DISTINCT ?path (COUNT(?pwPart) AS ?metabolites) WHERE {
      ?path wdt:P2410 ?WikipathsID.
      ?path wdt:P527 ?pwPart.
      ?pwPart wdt:P31 wd:Q11173.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    GROUP BY ?path ?metabolites
  }
  OPTIONAL { ?path rdfs:label ?pathway. }
}
ORDER BY DESC(?genes)
Try it!
Biologické pathways se strukturami proteinů v databázi PDB
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],mul,en". }
} GROUP BY ?pathway ?pathwayLabel ?WikiPathways ?Reactome
  ORDER BY DESC(?count)
Try it!
Získat známé varianty nahlášené v CIViC database (Q27612411) genů nahlášených v pathways Wikipathways: 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],mul,en". }
}
Try it!
Známé typy interakcí ve Wikipathways pro pathway s identifikátorem WP716 (sdružený dotaz)
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
SELECT DISTINCT ?interaction_type WHERE {
  VALUES ?wpid {"WP716"}
  ?item wdt:P2410 ?wpid ;
        wdt:P2888 ?source_pathway .

  SERVICE <http://sparql.wikipathways.org/sparql> {
     ?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 .
  }
}
Try it!
Místní anotace z WikiPathways pomocí sdruženého dotazu na dráhu s identifikátorem WP716 (sdružený dotaz)
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
SELECT DISTINCT ?item ?pw_annotation WHERE {
  VALUES ?wpid {"WP716"}
  ?item wdt:P2410 ?wpid ;
        wdt:P2888 ?source_pathway .

  SERVICE <http://sparql.wikipathways.org/sparql> {
     ?wp_pathway dc:identifier ?source_pathway .
     ?wp_pathway wp:ontologyTag ?pw_annotation .
     # ?pw_annotation rdfs:label ?annotation_label .
   }
}
Try it!

Zjištění léků na rakovinu, které cílí na geny související s proliferací buněk

#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

   ?biological_process (wdt:P361|wdt:P279)* wd:Q189101 . # chain down subclass/part-of
   #Change the last statement (wd:Q14818032) to limit to genes related to certain biological processes (and their sub-processes):
      #cell proliferation wd:Q14818032 (Current example)
                #apoptosis wd:Q14599311

    #uncomment the next line to find a subset of the known true positives (there are not a lot of them in here yet; will lead to 4 drugs if biological process is cell proliferation 2018-12-17)
  #?disease wdt:P2176 ?drug . # disease is treated by a drug
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en" .
  }
}
LIMIT 1000
Try it!

Rodičovské taxony modré velryby

#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" }
}
Try it!

Druhy komárů

# 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 .
}
Try it!

Taxony a jejich pojmenování

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
Try it!

Biologové s účty na Twitteru

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"
   }
}
Try it!

Buněčné linie s názvy, které by mohly být také URL (Internet of Cell Lines).

SELECT * WHERE {
  {
    SELECT ?cell_line ?cell_line_name WHERE {
      ?cell_line wdt:P31 wd:Q21014462;
                 rdfs:label ?cell_line_name.
          FILTER(LANG(?cell_line_name) = "en").
          Filter REGEX(STR(?cell_line_name), "^[\\w\\-\\.]+\\.[A-z]+$")
    }
  }
  ?tld wdt:P31/wdt:P279* wd:Q14296;
       rdfs:label ?tld_name.
  FILTER(LANG(?tld_name) = "en").
  FILTER REGEX(STR(?cell_line_name), CONCAT(REPLACE(?tld_name, "\\.", "\\\\."), "$"), "i")
  BIND(URI(CONCAT("http://", ?cell_line_name)) as ?url)
}
Try it!

Seznam léků s obrázkem

SELECT ?moleculeLabel ?formule ?picture ?molecule
WHERE
{
  ?molecule wdt:P31 wd:Q12140 ;
            wdt:P274 ?formule ;
            wdt:P117 ?picture
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en, de" . }
}
ORDER BY ?moleculeLabel
Try it!

Organismy, které se nacházejí v ženském urogenitálním traktu a které mají gen který produkuje indol.

SELECT ?organism_name
WHERE
{
  ?organism_item wdt:P2974 wd:Q5880 ;
                 rdfs:label ?organism_name .
  ?gene wdt:P703 ?organism_item ;
        wdt:P1056 wd:Q319541 .
  FILTER (LANG(?organism_name) = "en") .
}
Try it!

Ohrožené druhy zvířat podle klasifikace IUCN

#title: <span lang="en" dir="ltr" class="mw-content-ltr">Animals which are Threatened as per IUCN Red List</span>
# https://en.wikipedia.org/wiki/Conservation_status
# Common names are in English only

SELECT ?animal ?scientific_names ?common_names ?statusLabel where
{
  # hint:Prior hint:runLast true
   {
      SELECT DISTINCT ?animal (GROUP_CONCAT(DISTINCT ?scientific_name; separator=", ") as ?scientific_names) (GROUP_CONCAT(DISTINCT ?common_name; separator=", ") as ?common_names) WHERE
      {

        ?animal wdt:P141 ?status;
                wdt:P225 ?scientific_name;
                wdt:P1843 ?common_name.
        filter( ?status
           IN (
               wd:Q11394,  #Endangered
               wd:Q219127, #critcally endangered
               wd:Q278113  #vulnurable
              )
          ).

        # Only return common names in English
        FILTER(LANGMATCHES(LANG(?common_name), "en"))
      }
      GROUP BY ?animal
   }.
   ?animal wdt:P141 ?status.
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Animals which are Threatened as per IUCN Red List

Počítačová věda a technologie

Seznam formátů počítačových souborů

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
Try it!

Seznam standardů W3C

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
Try it!

Nejstarší 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
Try it!

Software napsaný v programovacím jazyce Go

SELECT DISTINCT ?instance_of ?instance_ofDescription ?instance_ofLabel ?official_website WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  ?instance_of (wdt:P31/(wdt:P279*)) wd:Q341.
  OPTIONAL { ?instance_of wdt:P856 ?official_website. }
  ?instance_of wdt:P277 wd:Q37227.
}
Try it!

Svobodný software s otevřeným zdrojovým kódem napsaný v programovacím jazyce Go

SELECT DISTINCT ?instance_of ?instance_ofDescription ?instance_ofLabel ?official_website WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  ?instance_of wdt:P31/wdt:P279* wd:Q341
  OPTIONAL { ?instance_of wdt:P856 ?official_website. }
  ?instance_of wdt:P277 wd:Q37227.
}
Try it!

Freeware games for Windows, ordered from recent date

SELECT DISTINCT
    ?game
    ?gameLabel
    (MIN(?publication_date) as ?publicationDateMin)
    (GROUP_CONCAT(?genre_label; SEPARATOR=", ") as ?genres) 
    ?gameDescription
    ?steamLink
    ?official_website
WHERE {
    ?game wdt:P31 wd:Q7889.
    ?game wdt:P400 wd:Q1406.
    ?game wdt:P275 wd:Q178285.
    OPTIONAL { ?game wdt:P577 ?publication_date }
    OPTIONAL {
        ?game wdt:P136 ?genre .
        ?genre rdfs:label ?genre_label FILTER (lang(?genre_label) = "en").
    }
    OPTIONAL { ?game wdt:P1733 ?steam }
    BIND(URI(CONCAT("https://store.steampowered.com/app/", ?steam)) as ?steamLink)
    OPTIONAL { ?game wdt:P856 ?official_website }
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en".
    }
}
GROUP BY ?game ?gameLabel ?publicationDateMin ?genres ?gameDescription ?steamLink ?official_website
ORDER BY DESC(?publicationDateMin)
Try it!

Univerzity hlavních autorů programovacích jazyků

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
Try it!

Webové stránky s koncovými body OpenAPI

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)
Try it!

Elektronické čtečky podporující formát souborů mobipocket

SELECT ?ereader ?ereaderLabel

WHERE {
  ?ereader wdt:P31 wd:Q726235 .
  ?ereader wdt:P1072 wd:Q1941622 .

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .

}
  }
Try it!

Softwarové aplikace seřazené sestupně podle počtu zapisovatelných formátů souborů

#defaultView:BubbleChart
#title:<span lang="en" dir="ltr" class="mw-content-ltr">Software applications ranked in descending order by the number of writable file formats</span>
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)
Software applications ranked in descending order by the number of writable file formats

Bublinový graf mediatypů podle počtu formátů souborů

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)
Try it!

Erdos Numbers a obrázky lidí, kteří mají ve sbírce Muzea počítačové historie ústní vzpomínky

#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" .

}
  }
Try it!

Chemie

Chemické prvky a jejich vlastnosti

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
Try it!

Chemické prvky a jejich izotopy podle počtu neutronů (min/max)

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
Try it!

Barvy chemických sloučenin

#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
Try it!

Všechny údaje o pKa ve Wikidatech a názvy zdrojů

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
}
Try it!

Všechna registrační čísla CAS ve Wikidatech

SELECT DISTINCT ?compound ?compoundLabel ?cas
WHERE
{
  ?compound wdt:P231 ?cas .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Try it!

Chemické sloučeniny ve Wikidatech se stejným registračním číslem CAS

#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". }
}
Try it!

Počet chemických sloučenin ve Wikidatech se stejným registračním číslem CAS

#The number of times a cas registry number is shared by distinct Wikidata items
SELECT ?cas ?items
WHERE
{
  {SELECT DISTINCT ?cas (count(?compound) as ?items) WHERE {
      ?compound wdt:P231 ?cas .
  }
    GROUP BY ?cas }
    FILTER (?items >1)
}
ORDER BY desc(?items)
Try it!

Udělené Nobelovy ceny za chemii

#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 (Q44585)
  ?awardStat pq:P585 ?when . # when did they receive the Nobel prize

SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
OPTIONAL { ?item wdt:P18 ?pic }
}
Try it!

Obrázky organických kyselin

#defaultView:ImageGrid
SELECT ?compound ?compoundLabel ?image WHERE {
  ?compound wdt:P279+|wdt:P31+ wd:Q421948 ;
            wdt:P18|wdt:P117 ?image .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Body varu alkanů

SELECT DISTINCT ?comp ?compLabel ?formula ?bp ?bpUnit ?bpUnitLabel WHERE {
  ?comp wdt:P31/wdt:P279* wd:Q41581 ;
        wdt:P274 ?formula ;
        p:P2102 [
          ps:P2102 ?bp ;
          psv:P2102/wikibase:quantityUnit ?bpUnit
        ] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} ORDER BY DESC(?bpUnit) ASC(?bp)
Try it!

Rozpustnost chemických látek

SELECT DISTINCT ?chemical ?chemicalLabel ?value ?units ?unitsLabel ?solvent ?solventLabel ?temperature ?temperatureUnit ?temperatureUnitLabel ?source ?sourceLabel ?doi
WITH {
  SELECT DISTINCT ?chemical ?value ?units ?source ?doi ?solvent ?temperature ?temperatureUnit WHERE {
    ?chemical ?propp ?statement .
    ?statement a wikibase:BestRank ;
      ?proppsv [
        wikibase:quantityAmount ?value ;
        wikibase:quantityUnit ?units
      ] .
    OPTIONAL {
      ?statement prov:wasDerivedFrom/pr:P248 ?source .
      OPTIONAL { ?source wdt:P356 ?doi . }
    }
    ?property wikibase:claim ?propp ;
            wikibase:statementValue ?proppsv ;
            wdt:P1629 wd:Q170731 ;
            wdt:P31 wd:Q21077852 .
    OPTIONAL {
      ?statement pqv:P2076 ?temperatureNode .
      ?temperatureNode wikibase:quantityAmount ?temperature ;
                       wikibase:quantityUnit ?temperatureUnit .
    }
    OPTIONAL {
      wd:P2178 wikibase:qualifier ?qualifierS .
      ?qualifierS a owl:ObjectProperty .
      ?statement ?qualifierS ?solvent .
    }
  } GROUP BY ?chemical ?value ?units ?temperature ?temperatureUnit ?solvent ?source ?doi
} AS %result
WHERE {
  INCLUDE %result
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY ASC(?propEntityLabel)
Try it!

Vesmír

Kdo objevil nejvíce asteroidů?

SELECT ?discoverer ?discovererLabel ?count
WITH {
  SELECT ?discoverer (COUNT(?asteroid) AS ?count)
  WHERE {
    ?asteroid wdt:P31 wd:Q3863;
      wdt:P61 ?discoverer .
  }
  GROUP BY ?discoverer
  ORDER BY DESC(?count)
  LIMIT 20
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?count)
Try it!

Kdo objevil nejvíce planet? (se seznamem)

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)
Try it!

Seznam vesmírných sond s obrázky

#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
Try it!

Místa narození astronautů

# 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)
Try it!

(Umělecké) Obrázky exoplanet

#defaultView:ImageGrid
SELECT ?exoplanet ?exoplanetLabel ?image WHERE {
  ?exoplanet wdt:P31 wd:Q44559 ;
             wdt:P18 ?image .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Vědci

Počet vědců podle pohlaví

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
Try it!

Nejvíce stejnojmenných matematiků

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)
Try it!

Autoři vědeckých článků podle povolání

#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)
Try it!

Autoři vědeckých článků, kteří obdrželi Nobelovu cenu

#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:P31/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
}
Try it!

Použití VALUES pro výběr vědeckých článků konkrétních autorů

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],mul,en". }
}
Try it!

Vědkyně s největším počtem odkazů na stránky (ale ne na anglické Wikipedii)

#Female scientists with most number of sitelinks (but not English Wikipedia)
#PREFIX schema: <http://schema.org/>

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 <https://en.wikipedia.org/>
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,es,ar,fr" }
}
GROUP BY ?item ?itemLabel ?linkcount
ORDER BY DESC(?linkcount)
Try it!

Vynálezci zabití vlastním vynálezem

SELECT ?inventor ?inventorLabel ?gadget ?gadgetLabel WHERE {
  ?inventor wdt:P157 ?gadget.
  ?gadget wdt:P61 ?inventor.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Nejcitovanější autorky

#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)
Try it!

Vědci, kteří spolupracovali, ale jejichž Erdos čísla to nereflektují

# 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
Try it!

Mapa institucí, kde kanadští občané získali doktorát

 
Mapa institucí, kde kanadští občané získali doktorát - snímek obrazovky s výsledky dotazu ze dne 2018-08-01.
#defaultView:Map
SELECT DISTINCT ?institution ?institutionLabel ?academics ?academicsLabel ?degree ?degreeLabel ?geoloc ?image WHERE {
  ?academics wdt:P31 wd:Q5 ; # instances (P31) of humans (Q5)
             wdt:P27 wd:Q16 ; # country of citizenship
             p:P69 ?statement . # check for an "educated at" (P69) statement
  OPTIONAL { ?academics wdt:P18 ?image }. #image

  ?statement ps:P69 ?institution . # get value of the "educated at" statement, i.e. the institution
  ?institution wdt:P625 ?geoloc . # get the geolocation of the institution

  ?statement pq:P512 ?degree . # get qualifier "academic degree" (P512)
  ?degree wdt:P31/wdt:P279* wd:Q849697 . # filter for doctoral degrees

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

}
Try it!

Vědecká literatura

Mapování PMID-DOI

SELECT DISTINCT ?pmid ?doi
WHERE
{
  ?item wdt:P698 ?pmid ;
              wdt:P356 ?doi .
}
Try it!

Počet tvrzení podle 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)
Try it!

počet tvrzení podložených referencí s DOI

SELECT (COUNT (?statement) as ?statements)
WHERE
{
  ?entry ?p ?statement .
  ?statement prov:wasDerivedFrom/
       <http://www.wikidata.org/prop/reference/P248>/
       wdt:P356 ?doi .
}
Try it!

Tvrzení pocházející z konkrétního DOI

SELECT ?entryRes ?entry ?statement
WHERE
{
  ?entryRes ?p ?statement ;
    rdfs:label ?entry .
  ?statement prov:wasDerivedFrom/
       <http://www.wikidata.org/prop/reference/P248>/
       wdt:P356 "10.1021/JA01577A030" .
   FILTER(lang(?entry) = "en")
}
Try it!

Překlady termínu DOID:399 (Tuberkulóza) z Disease Ontology

SELECT ?English ?language ?label WHERE {
  ?disease wdt:P699 "DOID:399";
             rdfs:label ?English;
             rdfs:label ?label .
  BIND(LANG(?label) as ?languageCode)
  ?wdLanguage wdt:P424 ?languageCode;
              rdfs:label ?language .
    FILTER EXISTS {?wdLanguage wdt:P31?/wdt:P279+ wd:Q17376908}
  FILTER (LANG(?English)="en")
  FILTER (LANG(?language)="en")
} ORDER BY ?language
Try it!

Časopisy z oblasti knihovnictví a informační vědy

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 .
    }
}
Try it!

Nejpopulárnější témata vědeckých článků

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Most popular subjects of scientific articles</span>
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
Most popular subjects of scientific articles

Galaxie seřazené podle těch, na které je nejvíce odkazů z vědeckých článků

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Galaxies ordered by the ones that are most linked from scientific articles</span>
#author: So9q
#date:2021-10-27
#note:I deliberately choose a smaller subgraph (galaxies) to prevent a timeout on WDQS
SELECT ?main_subject ?main_subjectLabel (count(?item) as ?c)
WHERE
{
  ?item wdt:P31 wd:Q13442814;
        wdt:P921 ?main_subject.
  ?main_subject wdt:P31/wdt:P279* wd:Q318.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
GROUP BY ?main_subject ?main_subjectLabel
ORDER BY DESC(?c)
Galaxies ordered by the ones that are most linked from scientific articles

Vědecké časopisy s editory na Twitteru

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],mul,en". }
} ORDER BY ?journalLabel
Try it!

Matematika

Matematické důkazy

SELECT ?proof ?proofLabel
WHERE
{
  ?proof wdt:P31 wd:Q11538.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Try it!

Časová osa úmrtí matematiků a jejich teorémů

#defaultView:Timeline
SELECT
  ?genderLabel
  ?theorem
  ?theoremLabel
  ?nameLabel
  ?death
  ?formula
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,de,pl". }
  ?theorem wdt:P31 wd:Q65943;
           wdt:P138 ?name.
  ?name    wdt:P570 ?death;
           wdt:P21 ?gender .
  # OPTIONAL{
  ?theorem wdt:P2534 ?formula.
  # }
}
ORDER BY DESC(?death)
LIMIT 100
Try it!

Databáze uvedené ve Wikidatech a příslušné licence, pokud jsou k dispozici

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")
}
Try it!

Fiktivní vesmíry s nejvíce fiktivními planetami

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)
Try it!

Objekty s největší hmotností

SELECT ?object ?objectLabel ?mass WHERE {
  {
    SELECT ?object (MAX(?mass) AS ?mass) WHERE {
      ?object p:P2067/psn:P2067/wikibase:quantityAmount ?mass.
      MINUS { ?object wdt:P31 wd:Q3647172. }
    }
    GROUP BY ?object
    ORDER BY DESC(?mass)
    LIMIT 100
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?mass)
Try it!

Biologické databáze uvedené ve Wikidatech a příslušné licence, pokud jsou k dispozici

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],mul,en" }
} ORDER BY ?itemLabel
Try it!

Americké univerzity založené před vznikem států, v nichž sídlí

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],mul,en".
  }
}
LIMIT 10
Try it!

Univerzity seřazené podle PageRanku na anglické Wikipedii (sdružený dotaz)

PREFIX vrank:<http://purl.org/voc/vrank#>

SELECT DISTINCT ?uni ?uniLabel ?pr WHERE {
  ?uni wdt:P31/wdt:P279* wd:Q3918.
  SERVICE <http://dbpedia.org/sparql> {
    ?uni vrank:hasRank/vrank:rankValue ?pr
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en".
  }
} ORDER BY DESC(?pr) LIMIT 50
Try it!

Education

Ranking(s) of university(es)

#ranking(s) of university(es)
#defaultView:LineChart
SELECT ?year ?ranking ?universityLabel ?deternimationMethodLabel ?university WHERE {
  VALUES ?university {
    wd:Q832355
    wd:Q1108197
    wd:Q16952
    wd:Q16955
    
    # to add another university
    # 1,uncomment the last commented line, 
    # 2,put cursor to the end of line, 
    # 3,and press CTRL+SPACE,or CTRL+ALT+SPACE, or ALT+ENTER. 
    # 4,and select first item, and press CTRL+ENTER.
    #wd:Zhejiang_University
    
    }
  
  VALUES ?deternimationMethod {
    wd:Q478743
    
    # to add another deternimationMethod
    # 1,uncomment the last commented line, 
    # 2,put cursor to the end of line, 
    # 3,and press CTRL+SPACE,or CTRL+ALT+SPACE, or ALT+ENTER. 
    # 4,and select first item, and press CTRL+ENTER.
    #wd:Shanghai_Academic_Ranking_of_World_Universities
    
    }
                              
  
  ?university p:P1352 ?statement.
  ?statement ps:P1352 ?ranking.
  ?statement pq:P459 ?deternimationMethod.
  ?statement pq:P585 ?date.
  
  BIND (STR(YEAR(?date)) as ?year)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Historie

Prezidenti a jejich manželky

#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],mul,en". }
}

Try it!

Američtí prezidenti a příčiny smrti

Seznam prezidentů s příčinami úmrtí

SELECT ?h ?hLabel ?cause ?causeLabel (YEAR(?date) AS ?year) WHERE {
?h wdt:P39 wd:Q11696;
   wdt:P509 ?cause;
   wdt:P570 ?date
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} ORDER BY ?year
Try it!

Pořadí prezidentů a příčin jejich úmrtí

#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)
Try it!

Politici, kteří zemřeli na rakovinu (jakéhokoli typu)

SELECT ?politician ?cause ?politician_label ?cause_of_death_label
WHERE
{
  ?politician wdt:P106 wd:Q82955 .    # find items that have "occupation (P106): politician (Q82955)"
  ?politician wdt:P509 ?cause .       # with a P509 (cause of death) claim
  ?cause wdt:P279* wd:Q12078 .        # ... where the cause is a subclass of (P279*) cancer (Q12078)
  # ?politician wdt:P39 wd:Q11696 .   # Uncomment this line to include only U.S. Presidents

  OPTIONAL {?politician rdfs:label ?politician_label FILTER (lang(?politician_label) = "en") .}
  OPTIONAL {?cause rdfs:label ?cause_of_death_label FILTER (lang(?cause_of_death_label) = "en").}
}
ORDER BY ASC (?politician)
Try it!

Seznam papežů

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)
Try it!

Roky se 3 papeži

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],mul,en". }
}
ORDER BY ?year
Try it!

Papežové s dětmi

# 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],mul,en" }
}
GROUP BY ?fatherLabel
ORDER BY DESC(?children)
LIMIT 50
Try it!

Francouzští předsedové vlád podle délky funkčního období

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:P31|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],mul,en" . }
}
ORDER BY DESC(?days) ?itemLabel
Try it!

Seznam států v roce 1754

#updated 2020-12-06
SELECT DISTINCT ?h ?hLabel ?inception ?dissolved ?coor
WHERE
{
  VALUES ?countryclass { wd:Q3024240 wd:Q6256 wd:Q3624078 }
  ?h p:P31/ps: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],mul,en" }
  OPTIONAL { ?h wdt:P625 ?coor } .
}
ORDER BY ?inception
Try it!

Obyvatelstvo v Evropě po roce 1960

SELECT ?objectLabel (YEAR(?date) as ?year)
       ?population (?objectLabel as ?Location)
WHERE
{
        wd:Q458 wdt:P150 ?object . # European Union contains administrative territorial entity
        ?object p:P1082 ?populationStatement .
        ?populationStatement ps:P1082 ?population ;
                             pq:P585 ?date .
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
  FILTER (YEAR(?date) >= 1960)
}
ORDER BY ?objectLabel ?year
Try it!

Místa leteckých nehod

SELECT ?label ?coord ?place
WHERE
{
   ?subj wdt:P31 wd:Q744913 .
   ?subj wdt:P625 ?coord .
   ?subj rdfs:label ?label FILTER (lang(?label) = "en")
}
Try it!

Nejplodnější otcové

SELECT ?father ?fatherLabel (SAMPLE(?picture_) AS ?picture) ?children
WITH
{
  SELECT ?father (COUNT(?father) AS ?children)
  WHERE
  {
    ?subj wdt:P22 ?father .
  }
  GROUP BY ?father
  ORDER BY DESC(?children)
  LIMIT 50
}
AS %get_fathers
WHERE
{
  INCLUDE %get_fathers
  OPTIONAL { ?father wdt:P18 ?picture_ . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
GROUP BY ?father ?fatherLabel ?children
ORDER BY DESC(?children)
Try it!

Seznam sebevražedných útoků

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],mul,en" }
}
Try it!

Lidé, kteří se upálili - na časové ose

#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],mul,en". }
}
ORDER BY ?date
Try it!

Lidé, kteří žili ve stejném období jako jiná osoba

SELECT ?person ?personLabel ?personDescription ?birth ?death ?age
{
  ?person wdt:P31 wd:Q5. # instance of human
  ?person wdt:P569 ?birth . # birth date
  ?person wdt:P570 ?death . # death date
  hint:Prior hint:rangeSafe true . # tell the optimizer that fields doesn’t mix dates, strings, integers or other data types, which simplifies the range comparison
  FILTER (?birth > "1452-04-15"^^xsd:dateTime && ?death < "1519-05-02"^^xsd:dateTime) # And between these two dates
  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
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". } # used to display a label
}
Try it!

Lidé, jejichž autorská díla se stala public domain v roce 2020 "život+50 let"

#added before 2019-02

#Shows people raised in the public domain "life + 50 years".
SELECT ?item ?itemLabel ?genderLabel (GROUP_CONCAT(DISTINCT ?occupationLabel; SEPARATOR=", ") AS ?occupations) (GROUP_CONCAT(DISTINCT ?countryLabel; SEPARATOR=", ") AS ?countries) ?death ?articles {
  VALUES ?target_country { wd:Q16 wd:Q142 wd:Q39 wd:Q31 wd:Q30 } . #countries: Canada, France, Switzerland, Belgium, USA. Removing this line to get worldwide may cause a query timeout.
  VALUES ?occ { wd:Q2500638 wd:Q20826540 wd:Q215627 } . #occupation: creator, erudite, person. These 3 occupations will also look for subclasses. Example: Alan Turing is a cryptographer, a subclass of cryptologist, a subclass of mathematician, a subclass of scientist, a subclass of erudite.
   ?item wdt:P31 wd:Q5;
               wdt:P21 ?gender;
               wdt:P27 ?target_country;
               wdt:P27 ?country;
               wdt:P106/wdt:P279* ?occ ;
               wdt:P106 ?occupation;
               wikibase:sitelinks ?articles . #Service to count the number of articles in Wikipedia language versions. The higher the number, the greater the chances that the person is very notorious.
   ?item wdt:P570 ?death . hint:Prior hint:rangeSafe true .
   FILTER( ?death >= "1969-01-01T00:00:00"^^xsd:dateTime && ?death < "1970-01-01T00:00:00"^^xsd:dateTime ) #death: public domain "life+50 years". Change both years to get a list in different legislation. Example for USA: life+70 years
   SERVICE wikibase:label {
       bd:serviceParam wikibase:language "fr,en" . #Service to retrieve the labels of items, in order of language. Example: if the label does not exist in French, the service will take the English label
       ?item rdfs:label ?itemLabel .
       ?gender rdfs:label ?genderLabel .
       ?occupation rdfs:label ?occupationLabel .
       ?country rdfs:label ?countryLabel .
   } .
} GROUP BY ?item ?itemLabel ?genderLabel ?death ?articles ORDER BY DESC (?articles) #Order by the number of articles in Wikipedia language versions. The most notorious people will be at the top of the list.
Try it!

Seznam mučicích nástrojů

SELECT ?thing ?thingLabel ?image
WHERE
{
  ?thing wdt:P366 wd:Q132781 .
  ?thing wdt:P18 ?image .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Try it!

Popravená zvířata

SELECT ?animal ?animalLabel ?died ?mannerOfDeathLabel ?image
WHERE
{
  ?animal wdt:P31/wdt:P31 wd:Q16521; # instance of some taxon (does not include human)
          wdt:P509 ?mannerOfDeath.
  ?mannerOfDeath wdt:P279* wd:Q8454. # some subclass of capital punishment
  OPTIONAL { ?animal wdt:P570 ?died. }
  OPTIONAL { ?animal wdt:P18 ?image. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY ?died
Try it!

Lidé, kteří byli nějakou dobu bez státní příslušnosti

# 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],mul,en". }
}
ORDER BY DESC(?end - ?start)
Try it!

Básníci, kteří prošli povstáním An Lushan

# 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).
}
Try it!

Období japonské historie a jejich názvy

SELECT ?era ?eraLabel (YEAR(?start_time) AS ?start) (YEAR(?end_time) AS ?end) ?namedLabel ?namedDescription WHERE {
?era wdt:P31 wd:Q11514315; wdt:P361 wd:Q130436; # eras of the history of Japan
  wdt:P580 ?start_time.
MINUS { ?era wdt:P2348/wdt:P361 wd:Q130436 } # exclude sub-eras
OPTIONAL { ?era wdt:P582 ?end_time } # optional end-time to make sure we include the current era
OPTIONAL { ?era wdt:P138 ?named }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
} ORDER BY ?start DESC(?end)
Try it!

Předkové Willema-Alexandra Nizozemského

SELECT DISTINCT ?item ?itemLabel ?dateofbirth WHERE {
  wd:Q154952 (wdt:P22|wdt:P25)* ?item .
  OPTIONAL { ?item wdt:P569 ?dateofbirth } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
} ORDER BY ?itemLabel
Try it!

Všechny události, ke kterým došlo dne 11. 9. 2001

SELECT ?item ?itemLabel
WHERE
{
  ?item p:P585/ps:P585 "2001-09-11T00:00:00Z"^^xsd:dateTime
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Everything with a time property on a given date

SELECT (GROUP_CONCAT(?classLabel; SEPARATOR = "; ") AS ?classes) ?propLabel ?i ?iLabel ?iDescription WHERE {
  {
    SELECT ?i ?prop ?class WHERE {
      {
        SELECT ?prop ?p WHERE {
          ?prop wikibase:directClaim ?p;
            (wdt:P31/(wdt:P279*)) wd:Q18636219.
        }
      }
      ?i ?p "2001-5-11"^^xsd:dateTime.
      OPTIONAL { ?i wdt:P31 ?class }
    }
    LIMIT 1000
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en".
    ?class rdfs:label ?classLabel.
    ?prop rdfs:label ?propLabel.
    ?i rdfs:label ?iLabel;
      schema:description ?iDescription.
  }
}
GROUP BY ?propLabel ?i ?iLabel ?iDescription
Try it!

Kultura

Kostely

Katedrály v Paříži

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
Try it!

Kostely v církevním okrese Wittenberg

#defaultView:Map{"layer": "?pbLabel"}
SELECT ?item ?itemLabel ?pbLabel (SAMPLE(?cat) AS ?cat) (SAMPLE(?coord) AS ?coord) (SAMPLE(?img) AS ?img)
WHERE {
  wd:Q75849591 wdt:P527 [ wdt:P527 ?item; wdt:P361 ?pb ].
  ?pb wdt:P31 wd:Q76598130.
  ?item wdt:P625 ?coord.
  OPTIONAL { ?item wdt:P373 ?cat. }
  OPTIONAL { ?item wdt:P18 ?img. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }
} GROUP BY ?item ?itemLabel ?pbLabel
Try it!

Special church type "Spitalkirche" in Germany

#defaultView:Map
SELECT ?pid ?name ?coord ?ort ?ortLabel
WHERE
{
  ?pid wdt:P31 wd:Q16970.
  ?pid rdfs:label ?name
  FILTER((LANG(?name)) = "de")
  FILTER(REGEX(STR(?name), "[Ss]pitalkirche")).
  ?pid wdt:P131 ?ort.
  ?pid wdt:P17 wd:Q183.
  ?pid wdt:P625 ?coord.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
}
Try it!

Muzea

Muzea v Bretani

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
Try it!

Všechna muzea v Barceloně se souřadnicemi

#All museums (including subclass of museum) in Barcelona with coordinates
SELECT DISTINCT ?item ?name ?coord ?lat ?lon
WHERE
{
 hint:Query hint:optimizer "None" .
 ?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)
Try it!

Muzea v Antverpách

#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" }
  }
Try it!

Umělecká díla v Louvru ve vitrínách

#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],mul,en,fr" }
}
Try it!

Divadelní umění

Postavy ztvárněné nejvíce herci

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 "[AUTO_LANGUAGE],mul,en". }
}
GROUP BY ?character ?characterLabel
ORDER BY DESC(?count)
LIMIT 25
Try it!

Seznam herců s obrázky a rokem narození a/nebo úmrtí

#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
Try it!

Herci, kteří hráli stejnou roli s odstupem více než 40 let

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 "themselves"
  FILTER(?movie1Publication + "P40Y"^^xsd:duration < ?movie2Publication) # 40 years between them
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Filmy režisérů podle jejich názvu na anglické Wikipedii

SELECT ?film ?filmLabel ?genere ?d WHERE {
  {
    SELECT ?film (GROUP_CONCAT(DISTINCT ?gL; SEPARATOR = ", ") AS ?genere) (MIN(YEAR(?date)) AS ?d) WHERE {
      ?sitelink schema:about ?director;
        schema:isPartOf <https://en.wikipedia.org/>;
        schema:name "Steven Spielberg"@en. # Edit this with different director's name to see their films. Use the English Wikipedia title only.
      ?film wdt:P31 wd:Q11424;
        wdt:P136 ?g, ?g.
      ?g rdfs:label ?gL.
      ?film wdt:P57 ?director;
        wdt:P577 ?date.
      FILTER((LANG(?gL)) = "en")
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    GROUP BY ?film
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC (?d)
Try it!

Vítězové Oscarů podle ocenění a času

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],mul,en"
    }
}
ORDER BY DESC(?time)
Try it!

Údaje o Oskarovi

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],mul,en" .
  }
}
ORDER BY DESC(?time)
Try it!

Lidé, kteří obdrželi Oscara i Nobelovu cenu

SELECT DISTINCT ?Person ?PersonLabel ?NobelPrizeLabel ?AcademyAwardLabel WHERE {
  ?NobelPrize wdt:P279?/wdt:P31? wd:Q7191 .    # <- subtypes of nobel prize
  ?AcademyAward wdt:P279?/wdt:P31? wd:Q19020 . # <- subtypes of academy award
  ?Person wdt:P166? ?NobelPrize .              # <- people awarded a nobel prize
  ?Person wdt:P166? ?AcademyAward .            # <- people awarded an academy award
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
  }
}
Try it!

Počet udělených cen akademie podle typu ocenění

SELECT ?awardCount ?award ?awardLabel WHERE {
  {
    SELECT (COUNT(?award) AS ?awardCount) ?award
    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)
      }
    } GROUP BY ?award
    ORDER BY ASC(?awardCount)
  }
  SERVICE wikibase:label { # ... include the labels
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
  }
}
Try it!

Filmoví režiséři seřazení podle počtu odkazů na stránky Wikipedie vynásobeného počtem jejich filmů

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],mul,en". # Get label if it exists
?director rdfs:label ?director_label }
} ORDER BY DESC(?rank)
LIMIT 100
Try it!

Seznam epizod televizního seriálu Simpsonovi podle sezóny

SELECT ?show ?showLabel ?seasonNumber ?episode ?episodeLabel
WHERE {
  BIND(wd:Q886 as ?show) .
  ?season wdt:P179 ?show;
          wdt:P527 ?episode;
          p:P179 [pq:P1545 ?seasonNumber] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY xsd:integer(?seasonNumber)
Try it!

Epizody seriálu Zákon a pořádek

# 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
Try it!

Hlavní témata epizod Západního křídla

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],mul,en". }
} ORDER BY xsd:integer(?ordinal)
Try it!

Filmy s Budem Spencerem

SELECT ?item ?itemLabel (MIN(?date) AS ?firstReleased) ?_image
WHERE {
  ?item wdt:P161 wd:Q221074;
        wdt:P577 ?date
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  OPTIONAL { ?item wdt:P18 ?_image. }
} GROUP BY ?item ?itemLabel ?_image
ORDER BY (?date)
Try it!

Současné indické herečky

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],mul,en"}
} GROUP BY ?item ?itemLabel ?itemDescription ?sl
ORDER BY DESC(?sl)
Try it!

Články na paňdžábské (gurmukhi) Wikipedii o pákistánských herečkách

#added 2017-03-25 (46 results)
SELECT ?sitelink
WHERE
{
  # gender = female
    ?item wdt:P21 wd:Q6581072 .

    # country = Pakistan (Q25)
    { ?item wdt:P27 wd:Q843 }

        # occupation = actress (Q33999)
    { ?item wdt:P106 wd:Q33999 }

  # look for articles (sitelinks) in Punjabi ("pa")
    { ?sitelink schema:about ?item . ?sitelink schema:inLanguage "pa" }

  # humans only
    ?item wdt:P31 wd:Q5 .
}
#Listeria can only handle up to 5000
LIMIT 5000
Try it!

Všichni účinkující seriálu Dr. Who

#added 2017-07-16, updated 2020-07-08
SELECT ?doctor ?doctorLabel ?ordinal ?performer ?performerLabel
WHERE {
  ?doctor wdt:P31 wd:Q47543030 .
  OPTIONAL { ?doctor wdt:P1545 ?ordinal }
  OPTIONAL { ?doctor p:P175 / ps:P175 ?performer }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY ASC(xsd:integer(?ordinal) )
Try it!

Filmy a jejich lokace na mapě

#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],mul,en". }
}
Try it!

Filmy vydané v roce 2017

SELECT DISTINCT ?item ?itemLabel WHERE {
  ?item wdt:P31 wd:Q11424.
  ?item wdt:P577 ?pubdate.
  FILTER((?pubdate >= "2017-01-01T00:00:00Z"^^xsd:dateTime) && (?pubdate <= "2017-12-31T00:00:00Z"^^xsd:dateTime))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Literatura

Autoři, spisovatelé a básníci seřazení podle odkazu na stránku a také podle "země občanství"

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)
Try it!

Rodiště německých básníků

#defaultView:Map{"hide": ["?coord"]}
SELECT ?subj ?subjLabel ?place ?placeLabel ?coord ?birthyear
WHERE {
   ?subj wdt:P106 wd:Q49757 .
   ?subj wdt:P19 ?place .
   ?place wdt:P17 wd:Q183 .
   ?place wdt:P625 ?coord .
   OPTIONAL { ?subj wdt:P569 ?dob }
   BIND(YEAR(?dob) as ?birthyear)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Try it!

Knihy nebo literární díla vydaná před rokem 1830 se souřadnicemi místa vydání nebo místa vyprávění

SELECT ?item ?label ?coord ?place
WHERE
{
  VALUES ?type {wd:Q571 wd:Q7725634} # book or literary work
  ?item wdt:P31 ?type .
  ?item wdt:P577 ?date FILTER (?date < "1830-01-01T00:00:00Z"^^xsd:dateTime) .
  ?item rdfs:label ?label FILTER (lang(?label) = "en")

  OPTIONAL {
    ?item (wdt:P291|wdt:P840) ?place . # publication or narration place is ?place
    ?place wdt:P625 ?coord
  }
}
Try it!

Knihy daného autora včetně žánrů a roku prvního vydání

SELECT DISTINCT ?book ?bookLabel ?authorLabel (GROUP_CONCAT(?genre_label) as ?genres) (MIN(?publicationDate) as ?firstPublication)
WHERE
{
  ?author rdfs:label "Ernest Hemingway"@en .
  ?book wdt:P50 ?author .
  OPTIONAL {
    ?book wdt:P136 ?genre .
    ?genre rdfs:label ?genre_label FILTER (lang(?genre_label) = "en").
  }

  OPTIONAL {
    ?book wdt:P577 ?publicationDate .
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
} GROUP BY ?book ?bookLabel ?authorLabel
Try it!

Text od autora obsahující název rozlišující velká a malá písmena s volitelným obrázkem obálky

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
Try it!

Literární díla podle počtu štítků

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)
Try it!

Všechny podtřídy "Literární dílo"

SELECT ?s ?desc
WHERE
{
  ?s wdt:P279 wd:Q7725634 .
  OPTIONAL {
     ?s rdfs:label ?desc FILTER (lang(?desc) = "en").
   }
 }
Try it!

Epické básně podle počtu štítků

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)
Try it!

Epické básně podle počtu sitelinků

#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)
Try it!

Instance Kniha podle počtu sitelinků

#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)
Try it!

Básníci a panovníci

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)
Try it!

Seznam digitálních knihoven na světě

SELECT DISTINCT ?item ?itemLabel ?website
WHERE {
?item wdt:P31/wdt:P279* wd:Q212805 # digital libraries or subtypes
OPTIONAL { ?item wdt:P856 ?website } # Official URL if known
MINUS { ?item wdt:P576 [] } # Exclude those that have shut down
SERVICE wikibase:label { bd:serviceParam wikibase:language "en, es, ca, fr, de, pl, uk, ru, he" }
}
ORDER BY ?itemLabel
Try it!

Mapa knihoven v Kanadě

# Canadian libraries on a map (must have coordinates!)
#defaultView:Map
SELECT ?library ?libraryLabel ?coords WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,fr". }
  ?library (wdt:P31/wdt:P279*) wd:Q7075.
  ?library wdt:P17 wd:Q16.
  ?library wdt:P625 ?coords.
}
Try it!

Seznam autorů neúspěšně nominovaných na Nobelovu cenu za literaturu

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
Try it!

Autoři, jejichž díla se stala public domain v roce 2017 (zemřeli v roce 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))
}
Try it!

Autoři s občanstvím Spojených států bez identifikátoru Goodreads

#authors with country of citizenship United States who do not have a Goodreads identifier
SELECT ?item ?itemLabel
WHERE
{
  ?item wdt:P31 wd:Q5. #instance of (P31) human (Q5)
  ?item wdt:P27 wd:Q30. #country of citizenship (P27) is United States (Q30)
  ?item wdt:P106 wd:Q36180. #occupation (P106) is writer (Q36180)
  MINUS { ?item wdt:P2963 [] } .

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

Díla žen, které se narodily mezi lety 1800 a 1900, jsou v databázi WomenWriters a jsou přeložena

SELECT ?translator ?translatorLabel ?work ?workLabel ?author ?authorLabel {
    ?work wdt:P655 ?translator;
          wdt:P50 ?author.

    ?author wdt:P2533 ?wid;
            wdt:P21 wd:Q6581072;
            wdt:P569 ?birth;

    FILTER (?birth > "1800-01-01"^^xsd:dateTime && ?birth < "1900-01-01"^^xsd:dateTime)

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,nl,fr". }
}
Try it!

Zábava

Pokémon!

# Updated 2020-06-17

# Gotta catch 'em all
SELECT DISTINCT ?pokemon ?pokemonLabel ?pokedexNumber
WHERE
{
    ?pokemon wdt:P31/wdt:P279* wd:Q3966183 .
    ?pokemon p:P1685 ?statement.
    ?statement ps:P1685 ?pokedexNumber;
              pq:P972 wd:Q20005020.
    FILTER (! wikibase:isSomeValue(?pokedexNumber) )
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
ORDER BY (?pokedexNumber)
Try it!

Fiktivní subjekty marvelovského universa

SELECT ?char ?charName (GROUP_CONCAT(DISTINCT ?typeLabel;separator=", ") AS ?types) (GROUP_CONCAT(DISTINCT ?universeLabel;separator=", ") AS ?universes)
WHERE {
  ?char wdt:P1080 wd:Q931597;
          wdt:P31 ?type ;
          wdt:P1080 ?universe .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en".
                         ?char rdfs:label ?charName .
                         ?universe rdfs:label ?universeLabel .
                         ?type rdfs:label ?typeLabel .}
} GROUP BY ?char ?charName
Try it!

Fiktivní postavy, jejichž datum narození/smrti spadá do aktuální dekády

SELECT DISTINCT ?character ?characterLabel ?birth ?death WITH {
  # Fictional character subclasses as a named subquery
  SELECT ?fictiontype WHERE {
    ?fictiontype wdt:P279* wd:Q95074. hint:Prior hint:gearing "forward".
  }
} AS %i
WHERE
{
  INCLUDE %i
  ?character wdt:P31 ?fictiontype.
  # Date of birth
  { ?character wdt:P569 ?birth . }
  # Date of death
  UNION { ?character wdt:P570 ?death . }
  # Get actual decade to compare with dates
  BIND(xsd:integer(YEAR(NOW())/10) as ?actual_decade).
  # Only show characters born or deceased in the current decade
  FILTER(xsd:integer(YEAR(?birth)/10) = ?actual_decade || xsd:integer(YEAR(?death)/10) = ?actual_decade)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
  }
} ORDER BY ?birth ?death
Try it!

Hudba

SELECT ?order ?item ?itemLabel ?yandex ?apple
(URI(CONCAT("https://open.spotify.com/track/", ?spotify_id)) AS ?spotify)
(URI(CONCAT("https://www.amazon.com/dp/", ?amazon_id)) AS ?amazon)
{
  wd:Q105834355 p:P658 ?st . ?st ps:P658 ?item .

  OPTIONAL { ?st pq:P1545 ?order } .
  OPTIONAL {?item p:P750 [ps:P750 wd:Q4537983 ; pq:P2699 ?yandex ] .}
  OPTIONAL {?item p:P750 [ps:P750 wd:Q20056642 ; pq:P2699 ?apple ] .}
  OPTIONAL {?item wdt:P5749 ?amazon_id .}
  OPTIONAL {?item wdt:P2207 ?spotify_id .}

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ru,en" }
} ORDER BY xsd:integer(?order)
Try it!
SELECT ?order ?item ?itemLabel
(STR(?_yandex) AS ?yandex)
(STR(?_apple) AS ?apple)
(CONCAT("https://open.spotify.com/track/", ?spotify_id) AS ?spotify)
(CONCAT("https://www.amazon.com/dp/", ?amazon_id) AS ?amazon)
{
  wd:Q105834355 p:P658 ?st . ?st ps:P658 ?item .

  OPTIONAL { ?st pq:P1545 ?order } . 
  OPTIONAL {?item p:P750 [ps:P750 wd:Q4537983 ; pq:P2699 ?_yandex ] .}
  OPTIONAL {?item p:P750 [ps:P750 wd:Q20056642 ; pq:P2699 ?_apple ] .}
  OPTIONAL {?item wdt:P5749 ?amazon_id .}
  OPTIONAL {?item wdt:P2207 ?spotify_id .}

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ru,en" }
} ORDER BY xsd:integer(?order)
Try it!

Časová osa alb Manu Chao a 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". }
}
Try it!

Nejoblíbenější tonalita

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)
Try it!

Hudební skladatelé podle místa narození

#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
}
Try it!

Skladatelé a jejich nejpoužívanější tonalita

# 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).
Try it!

Písně s nejdelší melodií

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
Try it!

Kolik hudebníků umírá v určitém věku

# 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)<month(?birth_date) || (month(?death_date)=month(?birth_date) && day(?death_date)<day(?birth_date)),1,0) as ?age )
        # calculate the age, precisely to the day (times and timezones ignored)
    }
  GROUP BY ?age
    ORDER BY ?age
Try it!

Hudebníci narození v Rotterdamu (Nizozemsko)

SELECT DISTINCT ?item ?itemLabel ?itemDescription where {
    ?item wdt:P106/wdt:P279* wd:Q639669 .
    ?item wdt:P19/wdt:P131* wd:Q34370 .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl" }
}
Try it!

Obrazy zobrazující dřevěné dechové nástroje

 
Obrazy zobrazující dřevěné dechové nástroje
#title:<span lang="en" dir="ltr" class="mw-content-ltr">Paintings depicting woodwind instruments</span>
#defaultView:ImageGrid
SELECT ?item ?itemLabel ?object ?objectLabel ?artistLabel ?image
WHERE
{
  ?item wdt:P31/wdt:P279* wd:Q3305213 . # Painting or sub-type of painting
  ?item wdt:P180 ?object .
  ?object wdt:P279* wd:Q181247 .
  OPTIONAL {?item wdt:P170 ?artistitem}
  BIND (IF(wikibase:isSomeValue(?artistitem), "Artist unknown", ?artistitem) AS ?artist).
  ?item wdt:P18 ?image .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
}
Paintings depicting woodwind instruments

Obrazy zobrazující hudební nástroje s určitou vazbou na Hamburk

#defaultView:ImageGrid
SELECT DISTINCT ?item ?image {
  hint:Query hint:optimizer "None" .
  ?object wdt:P279* wd:Q34379 .
  ?item wdt:P180 ?object .
  ?item wdt:P31/wdt:P279* wd:Q3305213 .
  ?item wdt:P18 ?image .
  ?item ?prop ?hhlink .
  ?hhlink ?prop2 wd:Q1055 .
}
Try it!

Rockové kapely začínající na "M"

SELECT ?band ?bandLabel
WHERE
{
  ?band wdt:P31 wd:Q5741069 .
        ?band rdfs:label ?bandLabel .
  FILTER(LANG(?bandLabel) = "en") .
  FILTER(STRSTARTS(?bandLabel, 'M')) .
} ORDER BY LCASE(?bandLabel)
Try it!

Hudebníci nebo zpěváci, jejichž žánr obsahuje slovo "rock".

SELECT DISTINCT ?human ?humanLabel
WHERE
{
    VALUES ?professions {wd:Q177220 wd:Q639669}
    ?human wdt:P31 wd:Q5 .
    ?human wdt:P106 ?professions .
    ?human wdt:P136 ?genre .
    ?human wikibase:statements ?statementcount .
    ?genre rdfs:label ?genreLabel .
    FILTER CONTAINS(?genreLabel, "rock") .
    FILTER (?statementcount > 50 ) .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?humanLabel
LIMIT 50
Try it!

'27 club' - musicians who died at age 27

SELECT ?person ?personLabel ?dob ?dod (xsd:integer(?age_) as ?age)
where {
  # We do a subquery here, because otherwise we'll get a timeout because of the labels
  {
    SELECT DISTINCT ?person ?dob ?dod ?age_
    where {
      ?person wdt:P31 wd:Q5; # Get all humans
        wdt:P106/wdt:P279* wd:Q639669; # That have a musician or a subclass thereof as their occupation
        p:P569 ?dob_st; # death of birth
        p:P570 ?dod_st. # death of death

      ?dob_st psv:P569 [ wikibase:timeValue ?dob; wikibase:timePrecision ?dob_prec ];
        a wikibase:BestRank.
      ?dod_st psv:P570 [ wikibase:timeValue ?dod; wikibase:timePrecision ?dod_prec ];
        a wikibase:BestRank.

      # Only accept date precisions of a day or better, so it doesn't cause problems when we calculate age
      FILTER(?dob_prec >= 11 && ?dod_prec >= 11)

      # Time differences in Blazegraph are counted as days and is xsd:double
      # We then calculate the age by dividing this by the orbital period of Earth
      # This is a shortcut, but it is accurate enough for our purposes
      bind((?dod - ?dob) / 365.2564 as ?age_)

      # And filter by age
      filter(?age_ >= 27.0 && ?age_ < 28.0)
    }
    #LIMIT 1000
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY desc(?dod) # Order by most recent
Try it!

Výtvarné umění

Veřejné sochy v Paříži

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)
}
Try it!

Umístění děl Pabla Picassa

#defaultView:Map
SELECT ?label ?coord ?subj
WHERE
{
   ?subj wdt:P170 wd:Q5593 .
  OPTIONAL {?subj wdt:P276 ?loc .
    ?loc wdt:P625 ?coord } .
   ?subj rdfs:label ?label FILTER (lang(?label) = "en")
}
Try it!

Eiffelova věž v umění

SELECT DISTINCT ?item ?itemLabel ?instanceLabel ?creatorLabel (YEAR(?date) as ?year) ?image
WHERE
{
  ?item wdt:P180 wd:Q243 .
  ?item wdt:P31 ?instance .
  OPTIONAL { ?item wdt:P170 ?creator }
  OPTIONAL { ?item wdt:P571 ?date }
  OPTIONAL { ?item wdt:P18 ?image }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,en" . }
}
ORDER BY ?itemLabel
Try it!

Obrazy Gustava Klimta

#defaultView:ImageGrid
SELECT *
WHERE
{
  ?item wdt:P31 wd:Q3305213 .
  ?item wdt:P170 wd:Q34661 .
  ?item wdt:P18 ?pic .
}
Try it!

Mapa všech obrazů, u kterých známe umístění, s počtem pro jednotlivá umístění

#Map of all the paintings for which we know a location with the count per location
#defaultView:Map
SELECT ?locationLabel ?coord (count(*) as ?count)
WHERE
{
    ?painting wdt:P31 wd:Q3305213 .
    ?painting wdt:P276 ?location .
  ?location wdt:P625 ?coord
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?locationLabel ?coord
Try it!

Verze obrazu The Scream

SELECT
  ?item
  (SAMPLE (?itemL) AS ?title)
  (SAMPLE (?y) AS ?year)
  (SAMPLE (?typeL) AS ?type)
  (group_concat(DISTINCT ?materialL ; separator = ", ") as ?materials)
  (SAMPLE (?collectionL) AS ?collection)
  (SAMPLE (?img) AS ?image)
{
  SELECT ?item ?itemL (YEAR(?date) AS ?y) ?typeL ?collectionL ?img ?materialL
  WHERE {
    ?item wdt:P179 wd:Q471379 .
    ?item wdt:P18 ?img .
    ?item wdt:P571 ?date .
    ?item wdt:P31 ?instance .
    ?item rdfs:label ?itemL FILTER (lang(?itemL) = "en").
    ?instance rdfs:label ?typeL FILTER (lang(?typeL) = "en").
    OPTIONAL {
      ?item wdt:P195 ?collection .
      ?collection rdfs:label ?collectionL FILTER (lang(?collectionL) = "en").
    }
    OPTIONAL {
      ?item wdt:P186 ?material .
      ?material rdfs:label ?materialL FILTER (lang(?materialL) = "en").
    }
  }
}
GROUP BY ?item
ORDER BY ?year ?item ?itemLabel
Try it!

Zobrazené předměty v uměleckém díle

SELECT DISTINCT ?depicts (SAMPLE(?dL) AS ?depictsLabel) (COUNT(DISTINCT ?item) AS ?count)
WHERE
{
  ?item wdt:P180 ?depicts .
  OPTIONAL { ?depicts rdfs:label ?dL FILTER (lang(?dL) = "en") }
}
GROUP BY ?depicts
ORDER BY DESC(?count) ?depictsLabel
Try it!

Historické budovy v Loire-Atlantique

SELECT DISTINCT
  ?item
  ?itemLabel
  ?communeLabel
  (group_concat(DISTINCT ?merimee ; separator = ", ") as ?merimee)
  ?coords
  ?image
WHERE
{
  {
    SELECT DISTINCT ?item ?merimee WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q916475 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
      ?item wdt:P380 ?merimee.
    }
    ORDER BY ?merimee
  }
  ?item wdt:P131/wdt:P131* wd:Q3068 .
  ?item wdt:P131 ?commune .
  OPTIONAL { ?item wdt:P625 ?coords . }
  OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr" . }
}
GROUP BY ?item ?itemLabel ?communeLabel ?coords ?image
ORDER BY ?communeLabel ?itemLabel
Try it!

Sochy Maxe Billa

SELECT DISTINCT ?item ?itemLabel ?countryLabel ?placeLabel (YEAR(?date) as ?year) ?coords ?image
WHERE
{
  ?item wdt:P31/wdt:P279* wd:Q860861 .
  ?item wdt:P170 wd:Q123454 .
  OPTIONAL { ?item wdt:P17 ?country . }
  OPTIONAL { ?item wdt:P131 ?place . }
  OPTIONAL { ?item wdt:P571 ?date . }
  OPTIONAL { ?item wdt:P625 ?coords . }
  OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY ?itemLabel ?placeLabel
Try it!

Rembrandtovy obrazy v Louvru nebo v Rijkmuseu

#defaultView:ImageGrid

SELECT DISTINCT ?item ?itemLabel ?itemDescription ?image ?collection WHERE {
    ?item wdt:P31 wd:Q3305213 ; # Get items that are instances of painting
          wdt:P170 wd:Q5598 ; # By creator Rembrandt
          wdt:P195/wdt:P361* ?collection . # That are in some collection

    # Only return results where 'collection' is either Rijkmuseum or Louvre
    FILTER ( ?collection = wd:Q190804 || ?collection = wd:Q19675 )

    OPTIONAL { ?item wdt:P18 ?image } # Optionally with an image

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]" }
}
Try it!

Použití vlastností pro autority pro obrazy

# Make a list of the most used authority control properties for works for paintings
SELECT ?propertyLabel ?propertyDescription (COUNT(?propertyclaim) AS ?count) WHERE {
  ?item wdt:P31 wd:Q3305213 .

  ?property wikibase:propertyType wikibase:ExternalId .
  ?property wdt:P31 wd:Q44847669 .
  ?property wikibase:claim ?propertyclaim .

  ?item ?propertyclaim [] .
  SERVICE wikibase:label { # ... include the labels
    bd:serviceParam wikibase:language "en" .
  }
} GROUP BY ?propertyLabel ?propertyDescription ORDER BY DESC (?count)
LIMIT 100
Try it!

Použití autoritních vlastností pro malíře

# Make a list of the most used authority control properties for people for painters
SELECT ?propertyLabel ?propertyDescription ?count WHERE {
  {
    SELECT ?propertyclaim (COUNT(*) AS ?count) where {
      ?item wdt:P106 wd:Q1028181 .
      ?item wdt:P31 wd:Q5 .
      ?item ?propertyclaim [] .
    } GROUP BY ?propertyclaim
  }
  ?property wikibase:propertyType wikibase:ExternalId .
  ?property wdt:P31 wd:Q19595382 .
  ?property wikibase:claim ?propertyclaim .
  SERVICE wikibase:label { # ... include the labels
    bd:serviceParam wikibase:language "en" .
  }
} ORDER BY DESC (?count)
LIMIT 100
Try it!

Deset náhodných obrazů

# This returns 10 random painting images
# RAND() returns one random number (cached like every query).
# The string representation of the item and the random number are hashed.
# This will give a complete different ordering every time you have a different random number.
# You can change the LIMIT or OFFSET if you want to trigger a new random number
#defaultView:ImageGrid
SELECT ?item ?itemLabel ?image (MD5(CONCAT(str(?item),str(RAND()))) as ?random) WHERE {
  ?item wdt:P31 wd:Q3305213.
  ?item wdt:P18 ?image.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
} ORDER BY ?random
LIMIT 10
OFFSET 0
Try it!

In cases where you want to re-run the query without getting a cached result, see the following blog post:

Malíři související s anonymními díly

#Paintings by anonymous painters, but are related to some other painter
#defaultView:BubbleChart
SELECT ?creatorqualifierLabel (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 ?creatorqualifierLabel
HAVING (?count > 2)
LIMIT 20000
Try it!

Typ vztahu malířů k anonymním dílům

#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
Try it!

Použití formátovacího url ke konstrukci odkazů v jazyce SPARQL

# Get 10 paintings that have a link to RKDimages (P350)
# Use the formatter URL (P1630) to construct the links to RKDimages
#defaultView:ImageGrid
SELECT ?item ?image ?rkdurl WHERE {
  wd:P350 wdt:P1630 ?formatterurl .
  ?item wdt:P31 wd:Q3305213 .
  ?item wdt:P18 ?image .
  ?item wdt:P350 ?rkdid .
  BIND(IRI(REPLACE(?rkdid, '^(.+)$', ?formatterurl)) AS ?rkdurl).
  } LIMIT 10
Try it!

Mapa umístění všech obrazů Johannese Vermeera s obrázkem

#defaultView:Map
SELECT ?painting ?paintingLabel ?location ?image where {
  ?painting wdt:P276 ?collection;
            wdt:P170 wd:Q41264;
            wdt:P18 ?image.
  ?collection wdt:P625 ?location.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Všichni impresionističtí malíři, kteří vystavovali, spolu s počtem výstav, kterých se zúčastnili

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Impressionist painters by number of exhibitions</span>
SELECT DISTINCT ?painter ?painterLabel (count (DISTINCT ?exhibition) as ?exhibition_count)
(group_concat(DISTINCT ?exhibitionLabel; separator=", ") as ?exhibitions)
WHERE {
  ?painter wdt:P106 wd:Q1028181 . #give me all people with occupation (P106) painter (Q1028181)
  ?painter wdt:P135 wd:Q40415 . #who belonged to the impressionist (Q40415) movement (P135)
  ?painting wdt:P170 ?painter . #the paintings created by (P170) the painter
  ?painting wdt:P608 ?exhibition . #have an exhibition history (P608) at an exhibition
  ?exhibition rdfs:label ?exhibitionLabel . #give me the english Labels of these exhibitions, if possible
  FILTER (lang(?exhibitionLabel) = "en")

  SERVICE wikibase:label {bd:serviceParam wikibase:language "en".}
} GROUP BY ?painter ?painterLabel
Impressionist painters by number of exhibitions

Seznam divadelních her

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
Try it!

Veřejné umění v Paříži

SELECT
  ?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) {

    {
      SELECT DISTINCT ?item { {
        ?item wdt:P136 wd:Q557141 ;     # genre: public art
              wdt:P131 wd:Q90           # located in: Paris
      } UNION { # or
        ?item wdt:P136 wd:Q557141 ;     # genre: public art
              wdt:P131/wdt:P131* wd:Q90 # located in an arrondissement of Paris
      } }
    }

    # title
    OPTIONAL { ?item rdfs:label ?titleL FILTER (lang(?titleL) = "fr") }

    # creators
    OPTIONAL { ?item wdt:P170 [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 [rdfs:label ?placeL] FILTER (lang(?placeL) = "fr") .
    }

    # arrondissement
    OPTIONAL {
      ?item wdt:P131 [wdt:P131 wd:Q90 ; rdfs:label ?arrL] FILTER (lang(?arrL) = "fr").
      BIND(REPLACE(?arrL, '^([0-9]+).*$', "$1", "si") AS ?arr)
    }

    # image
    OPTIONAL { ?item wdt:P18 ?img }

    # coordinates
    OPTIONAL { ?item wdt:P625 ?coord }

} GROUP BY ?item
Try it!

Umělecká díla, jejichž název může být rýmem

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)
Try it!

Umělecká díla, jejichž název je aliterací

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)
Try it!

Rozdělení veřejného umění podle místa

SELECT ?place ?placeLabel (COUNT(*) AS ?count) WHERE {
  ?item wdt:P136 wd:Q557141 .
  ?item wdt:P131 ?place .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
GROUP BY ?place ?placeLabel
ORDER BY DESC(?count) ?placeLabel
Try it!

Rodiště umělců Europeany280

#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" .
    }
}
Try it!

Umělkyně

SELECT DISTINCT ?women ?women_label ?women_description
WHERE
{
       ?women wdt:P31 wd:Q5 .
       ?women wdt:P21 wd:Q6581072 .
       ?women wdt:P106/wdt:P279* wd:Q483501 . # artists
       OPTIONAL {?women rdfs:label ?women_label FILTER (LANG(?women_label) = "en")}.
	   OPTIONAL {?women schema:description ?women_description FILTER (LANG(?women_description) = "en")}.
}
LIMIT 500
Try it!

Běžné dotazy

SELECT ?q ?qLabel
WHERE
{
  ?q wdt:P31 wd:Q15841920.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Try it!

Rektoři Padovské univerzity podle data

SELECT ?rettore ?rettoreLabel ?starttime ?endtime WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
  ?rettore p:P106 [
    ps:P106 wd:Q212071; # is a Rector
    pq:P642 wd:Q193510; # of Padua Univerity
    pq:P580 ?starttime;
    pq:P582 ?endtime
  ].
}
ORDER BY ?starttime
Try it!

Top 100 podcasts by number of statements

# Top 100 podcasts by number of statements
SELECT ?item ?itemLabel ?statements WHERE
{
  ?item wdt:P31 wd:Q24634210. # Instance of: podcast
  ?item wikibase:statements ?statements. # Number of statements
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY desc(?statements) # Sort by number of statements
LIMIT 100 # Only the top 100 items
Try it!

Jídlo a pití

Německé pivovary

#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" .
  }
}
Try it!

Sendviče

#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
Try it!

Složení sendvičů

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))
Try it!

Sport

Musheři, kteří se v závodě neumístili ani ho nedokončili

SELECT DISTINCT ?race ?raceLabel ?musherLabel
WHERE
{
  { ?race wdt:P31/wdt:P279* wd:Q1968664 . }
  UNION { ?race wdt:P31/wdt:P641* wd:Q1968664 . }
  ?race p:P710 ?musherS . #here we have a full statement, not a value
  ?musherS ps:P710 ?musher . #here we get the value
  FILTER NOT EXISTS { ?musherS pq:P1352 ?rank }
  FILTER NOT EXISTS { ?musherS pq:P793 ?event }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" }
}
ORDER BY ?raceLabel
Try it!

Jaký je vztah mezi Terrellem Buckleym a Miami Dolphins?

SELECT ?l
WHERE {
  wd:Q5571382 ?p wd:Q223243 .
  ?property ?ref ?p .
  ?property rdf:type wikibase:Property .
  ?property rdfs:label ?l FILTER (lang(?l) = "en")
}
Try it!

Ocenění, která Cristiano Ronaldo získal v jednotlivých letech

Shows only the year instead of the default format (i.e. show all of the date information).

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
Try it!

Dotazy na bibliografické citace (Wikicite)

Citace Figshare

Tvrzení Wikidat s odkazem na data ve službě Figshare

SELECT ?doi (count(?doi) as ?counts) WHERE {
   ?statement prov:wasDerivedFrom ?ref .
   ?ref pr:P356 ?doi .
   FILTER (CONTAINS(lcase(?doi), "figshare"))
}
GROUP BY ?doi
ORDER BY DESC(?counts)
Try it!

Tvrzení Wikidat s odkazem na data ve Figshare, ke kterým existuje položka Wikicitátů

SELECT DISTINCT ?wikiciteLabel ?doi WHERE {
   ?wikicite p:P356/ps:P356 ?doi .
   ?statement prov:wasDerivedFrom ?ref .
   ?ref pr:P356 ?doi .
   FILTER (CONTAINS(lcase(?doi), "figshare"))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Tvrzení Wikidat s odkazem na DOI služby Figshare (Q28061352)

SELECT DISTiNCT ?item ?itemLabel WHERE {
   ?item ?p ?statement.
   ?statement prov:wasDerivedFrom ?ref .
   ?ref ?prop wd:Q28061352 .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
Try it!

Zika corpus

Odborné články s "Zika" v popisku položky

SELECT ?item ?itemLabel ?DOI ?PMID
WITH {
  SELECT * WHERE {
    BIND ("zika" AS ?searchfor)
  }
} AS %p
WITH {
  SELECT ?item
  WHERE {
    INCLUDE %p
    BIND (CONCAT("haswbstatement:P31=Q13442814 ", ?searchfor) AS ?searchstr)
    SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:endpoint "www.wikidata.org" .
      bd:serviceParam wikibase:api "Generator" .
      bd:serviceParam mwapi:generator "search" .
      bd:serviceParam mwapi:gsrsearch ?searchstr .
      bd:serviceParam mwapi:gsrlimit "max" .
      bd:serviceParam mwapi:gsrnamespace "0" .
      bd:serviceParam mwapi:gsrprop "" .
      ?item wikibase:apiOutputItem mwapi:title .
    }
  }
} AS %i
WHERE {
  INCLUDE %i
  INCLUDE %p
  ?item rdfs:label ?itemLabel .
  FILTER (LANG(?itemLabel)="en")
  FILTER(CONTAINS(LCASE(?itemLabel), ?searchfor))
  OPTIONAL { ?item wdt:P698 ?PMID. }
  OPTIONAL { ?item wdt:P356 ?DOI. }
}
Try it!

Vědecké články, které se týkají viru Zika nebo horečky a které jsou použity jako odkaz v jiné položce

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" }
}
Try it!

CIViC Corpus

Zobrazit citační korpus CIViC

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" }
}
Try it!

Korpusy citací biologických pathways

Zobrazit citační korpus Pathways

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" }
}
Try it!

Zobrazit citační korpus Wikipathways

SELECT ?wpid ?item ?itemLabel ?referenceLabel
WHERE
{
  ?item wdt:P2410 ?wpid ;
          wdt:P2860 ?reference ;

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Try it!

Zobrazit citační korpus Reactome

SELECT ?reactome_id ?item ?itemLabel ?referenceLabel
WHERE
{
  ?item wdt:P3937 ?reactome_id ;
        wdt:P2860 ?reference ;

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Try it!

Surinamské citační korpusy

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. }
}
Try it!

Anglické obecné názvy a informace o zvířatech podle jejich vědeckých názvů

# Given the scientific name for a list of animals, it will return all the
# English common names, their length, life expectency, height, wing span and mass
# Note: There is more information on these specific animals. Unfortunately, a lot of animals on WikiData have missing information (e.g. no life expectancy or mass)
SELECT DISTINCT ?item ?scientific_name ?common_name ?length ?life_expectency ?height ?wing_span ?mass WHERE {
  ?item wdt:P225 ?scientific_name;
    wdt:P1843 ?common_name.
  OPTIONAL { ?item wdt:P2043 ?length. }
  OPTIONAL { ?item wdt:P2250 ?life_expectency. }
  OPTIONAL { ?item wdt:P2048 ?height. }
  OPTIONAL { ?item wdt:P2050 ?wing_span. }

  # Adult mass only. Excludes birth mass
  OPTIONAL {
    ?item p:P2067 ?mass_statement_node.
    ?mass_statement_node pq:P642 wd:Q78101716;
      ps:P2067 ?mass.
  }

  # Only return common names in English
  FILTER(LANGMATCHES(LANG(?common_name), "en"))

  # List of animals. All lowercase to avoid capitalisation issues
  FILTER(lcase(str(?scientific_name)) IN (
   "mustela erminea",
   "aquila adalberti",
   "vespula germanica",
   "accipiter nisus",
   "buteo buteo"
  ))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Try it!

Externí identifikátory

Švédské obce, které v určitém okamžiku změnily svůj identifikátor obce

Jedná se o příklad identifikátoru, který je v čase nestabilní, a proto není vhodný k použití jako identifikátor např. v IT systému.

#title:<span lang="en" dir="ltr" class="mw-content-ltr">Swedish municipalities which changed their municipality identifier at some point</span>
#author:Salgo60 2021-09-11
SELECT DISTINCT ?item ?itemLabel ?kkod1 ?kkod2 ?svwp_artikel WHERE
{
  ?item wdt:P525 ?kkod1 .
  ?item wdt:P525 ?kkod2 .
  FILTER ( ?kkod1<?kkod2 )
  SERVICE wikibase:label { bd:serviceParam wikibase:language "sv". }
  OPTIONAL { ?svwp_artikel schema:about ?item; schema:isPartOf <https://sv.wikipedia.org/> }
}
ORDER BY ?itemLabel
Swedish municipalities which changed their municipality identifier at some point