Question: Which distinct items are subclasses of execution methods or the subclasses of those, and so on?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?class WHERE { ?class wdt:P279 + wd:Q15169167 . }

Execution methods


Question: Which humans who were born in Australia or in any administrative territorial entity within Australia do not have a specified sex or gender?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { ?item wdt:P19 / wdt:P131 * wd:Q408 . ?item wdt:P31 wd:Q5 . FILTER ( NOT EXISTS { ?item wdt:P21 _:b1 . } ) }

results containing english sitelink


Question: What are the different types of awards received by individuals listed in the GEPRIS Historisch database, along with their labels and the count of each award? The awards should be filtered to include only specific types such as general awards, science awards, cultural prizes, chemistry awards, literary awards, physics awards, national academies, and journalism prizes.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?preis ?preisLabel ( count ( * ) as ?count ) WHERE { ?person wdt:P31 wd:Q5 . ?person wdt:P9044 ?gepris . ?person wdt:P166 ?preis . ?preis wdt:P31 ?preistype . filter ( ?preistype = wd:Q618779 || ?preistype = wd:Q11448906 || ?preistype = wd:Q15383322 || ?preistype = wd:Q107471279 || ?preistype = wd:Q378427 || ?preistype = wd:Q107494520 || ?preistype = wd:Q5257307 || ?preistype = wd:Q1792571 || ?preistype = wd:Q55190113 || ?preistype = wd:Q1966910 || ?preistype = wd:Q1709894 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } GROUP BY ?preis ?preisLabel ORDER BY DESC ( ?count )

Number of prices for GEPRIS Historisch scientists with subclass


Question: What are the names, average latitudes, average longitudes, and average populations of municipalities in Austria that are still in existence, with labels in German?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?itemLabel ( AVG ( ?item_lat ) AS ?lat ) ( AVG ( ?item_long ) AS ?long ) ( AVG ( ?Einwohnerzahl ) AS ?pop ) WHERE { ?item p:P31 ?statement . ?statement ps:P31 wd:Q667509 . filter not exists { ?statement pq:P582 [] . } ?item rdfs:label ?itemLabel . ?item ( p:P625 / psv:P625 ) ?item_node . ?item_node wikibase:geoLatitude ?item_lat . ?item_node wikibase:geoLongitude ?item_long . ?item wdt:P1082 ?Einwohnerzahl . FILTER ( ( LANG ( ?itemLabel ) ) = "de" ) } GROUP BY ?itemLabel ORDER BY ?itemLabel

Finding all municipalities of Austria.


Question: Which distinct movies were directed by Steven Spielberg, along with their titles and the earliest year of publication, sorted by year?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?movie ?movieLabel ( min ( ?year ) as ?myear ) WHERE { ?movie wdt:P31 / wdt:P279 * wd:Q11424 . ?movie wdt:P57 wd:Q8877 . ?movie wdt:P577 ?date . BIND ( year ( ?date ) as ?year ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } group by ?movie ?movieLabel ORDER BY ?year

Selecting the first of several equally ranked statements


Question: What are the architectural structures within a 5 km radius of the coordinates (13.5812565, 52.5153623), along with their latitude and longitude?

PREFIX geo: <http://www.opengis.net/ont/geosparql#> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?place ( sample ( ?latitude ) as ?latitude ) ( sample ( ?longitude ) as ?longitude ) WHERE { ?place_sub wdt:P279 * wd:Q811979 . ?place wdt:P31 ?place_sub . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center "Point(13.5812565 52.5153623)" ^^ geo:wktLiteral . bd:serviceParam wikibase:radius "5" . } ?place p:P625 ?statement . ?statement ps:P625 ?value . filter ( ?value = ?location ) ?statement psv:P625 ?coordinate_node . ?coordinate_node wikibase:geoLatitude ?latitude . ?coordinate_node wikibase:geoLongitude ?longitude . } group by ?place

Nested Query with georeference


Question: Who are the distinct candidates for the Mayor of Germasogeia Municipality Elections?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { ?election wdt:P31 wd:Q93306595 . ?election wdt:P726 ?item . }

candidates


Question: What are the distinct audiovisual works that are based on, inspired by, or were written by Jane Austen?

SELECT DISTINCT ?item
with { select ?item where
{
    hint:Query hint:optimizer "None".
    VALUES ?author {wd:Q36322}
    { ?item wdt:P144*/wdt:P50 ?author }
    union { ?item wdt:P1877 ?author  }
    UNION { ?item wdt:P58 ?author }
} } as %i
where
{
  include %i
  ?item wdt:P31/wdt:P279* wd:Q2431196 .
  }

Movie after a work by OR based on work from Jane Austen


Question: Which properties are used in claims related to items that are public elections? Include a count of the number of times it was used.

SELECT ?property ?count
WITH
{
  SELECT DISTINCT ?item
  WHERE
  {
    ?item wdt:P31/wdt:P279* wd:Q40231 .
  }
} AS %get_items
WITH
{
  SELECT ?property (COUNT(*) as ?count)
  WHERE
  {
    INCLUDE %get_items
    ?item ?claim [] .
    ?property wikibase:claim ?claim .
  }
  GROUP BY ?property
} AS %get_properties
WHERE
{
  INCLUDE %get_properties
}
ORDER BY DESC(?count)

which properties are used in a subclass


Question: What are the distinct occupations related to the musical profession, along with their subclasses (if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?occupation ?subclassOf WHERE { ?occupation wdt:P279 * / wdt:P31 / wdt:P279 * wd:Q66715801 OPTIONAL { ?occupation wdt:P279 ?subclassOf . } }

Occupations and Subclasses


Question: What are the distinct lithostratigraphic units located in Arizona? Please include any parts they have (if available, the larger units they are part of (if available), and their Geolex IDs (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?unit ?haspart ?partof ?GeolexID WHERE { ?unit ( wdt:P31 / ( wdt:P279 * ) ) wd:Q3550897 . OPTIONAL { ?unit wdt:P527 ?haspart . } OPTIONAL { ?unit wdt:P361 ?partof . } OPTIONAL { ?unit wdt:P6202 ?GeolexID . } ?unit wdt:P131 wd:Q816 . }

Which default view to use


Question: What are the items that are subclasses of scholarly articles, ordered by their labels?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel WHERE { ?item wdt:P279 * wd:Q13442814 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by ?itemLabel

Retraction, Retraction Notice or Retracted Article


Question: What are the municipalities of Catalonia, Spain, with an IDESCAT territorial code starting with "25"? Include their most recent population using their preferred rank (if available), area (if available), and coat of arms image (if available).

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?poblacio ?superficie ?imatge_de_l_escut_d_armes ?pointInTime WHERE { ?item wdt:P31 wd:Q33146843 ; wdt:P4335 ?p4335 . FILTER ( STRSTARTS ( ?p4335 , "25" ) ) OPTIONAL { ?item p:P1082 [ ps:P1082 ?poblacio ; pq:P585 ?pointInTime ; wikibase:rank wikibase:PreferredRank ] . } OPTIONAL { ?item wdt:P2046 ?superficie . } OPTIONAL { ?item wdt:P94 ?imatge_de_l_escut_d_armes . } }

Get a qualifier


Question: Which countries are sovereign states, along with their capitals, currencies, populations, flag images, and the determination methods of their capitals, if available? Exclude historical countries and ancient civilizations.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?country ?capital ?currency ?population ?flag_image ?determination_method WHERE { ?country wdt:P31 wd:Q3624078 . FILTER NOT EXISTS { ?country wdt:P31 wd:Q3024240 } FILTER NOT EXISTS { ?country wdt:P31 wd:Q28171280 } OPTIONAL { ?country wdt:P36 ?capital } . OPTIONAL { ?country p:P36 [ ps:P36 ?capital ; pq:P459 ?determination_method ] . } . OPTIONAL { ?country wdt:P38 ?currency } . OPTIONAL { ?country wdt:P1082 ?population } . OPTIONAL { ?country p:P41 ?flagStatement . ?flagStatement wikibase:rank wikibase:PreferredRank . ?flagStatement ps:P41 ?flag_image . } . } ORDER BY ?population

List of countries and their respective capitals, currencies, populations, and flags


Question: What are the mountains with an elevation above sea level greater than 8000 meters, excluding those located on any astronomical body?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?m { ?item wdt:P31 wd:Q8502 . ?item p:P2044 / psn:P2044 / wikibase:quantityAmount ?m . FILTER ( ?m > 8000 ) MINUS { ?item wdt:P376 [] } }

Mountains over 8000 meters


Question: What is the most recent publication date of "Minecraft"?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> SELECT ?item ?itemLabel ?date WHERE { VALUES ?itemLabel { "Minecraft" @en } . ?item rdfs:label ?itemLabel . ?item p:P577 ?P577_stat . ?P577_stat psv:P577 [] . ?P577_stat a wikibase:BestRank . ?P577_stat ps:P577 ?date . }

Get the release year (publication date) of a game


Question: What are the items in the collection of the Musée d'art et d'histoire de Saint-Brieuc, along with the items of their creators, the items of the creators' places of birth in Brittany, their inventory numbers, and images (if available)?

PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item ?auteur ?lieunaissance ?inventaire ?image WHERE { ?item wdt:P217 ?inventaire . ?item p:P217 ?statement . ?statement pq:P195 wd:Q3329624 . ?item wdt:P170 ?auteur . ?auteur wdt:P19 ?lieunaissance . ?lieunaissance wdt:P131 * wd:Q12130 . OPTIONAL { ?item wdt:P18 ?image . } }

Obtenir le lien vers la base Joconde (musées) sur une liste d'oeuvres


Question: What are the distinct places where the official language is Swedish, along with their labels, the unique instances they belong to (if available), and the unique entities they are part of (if available)? Order results alphabetically by place label.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?place ?placeLabel ?instance_of ?part_of WHERE { ?place wdt:P37 wd:Q9027 . OPTIONAL { ?place wdt:P31 ?instance_of . } OPTIONAL { ?place wdt:P361 ?part_of . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?place ?placeLabel ?instance_of ?part_of ORDER BY STR ( ?placeLabel )

How to show only unique values when using several GROUP_CONCAT?


Question: What are the distinct countries and country parts (like Western Russia) in the continent Europe, their labels, and their area in square kilometers (rounded and calculated from either the country's area or the part's area if available)? Also include the part of the country (if applicable), and exclude countries that have been dissolved, abolished, or demolished. Order results by the area in descending order.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?country ?countryLabel ( ROUND ( COALESCE ( ?area3 , ?area2 ) / 1000000 ) as ?area_km2 ) ?part { ?country p:P31 / ps:P31 wd:Q6256 . ?country wdt:P30 wd:Q46 . ?country p:P2046 / psn:P2046 [ wikibase:quantityAmount ?area2 ] . OPTIONAL { ?country p:P30 [ pq:P518 ?part ; ps:P30 wd:Q46 ] . ?part p:P2046 / psn:P2046 [ wikibase:quantityAmount ?area3 ] . } MINUS { ?country wdt:P576 [] } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER by desc ( ?area_km2 )

Countries of Europe by area


Question: What are the countries along with images of their flags and their populations, ordered by descending population?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?country ?flagImage ?population WHERE { ?country wdt:P31 wd:Q6256 ; wdt:P1082 ?population ; wdt:P163 [ wdt:P18 ?flagImage ] . } ORDER BY DESC ( ?population )

National flags ordered by population


Question: What is the current number of operational airports and the population for each country, excluding airports that have an end time or a dissolved, abolished, or demolished date, if available?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?country ?no_of_airports ?population WHERE { { SELECT ?country ( COUNT ( ?airport ) AS ?no_of_airports ) WHERE { ?airport wdt:P17 ?country . ?airport wdt:P31 / wdt:P279 * wd:Q1248784 . OPTIONAL { ?airport ( wdt:P582 | wdt:P576 ) ?endtime . } FILTER ( ! BOUND ( ?endtime ) ) } GROUP BY ?country } ?country wdt:P1082 ?population . }

Countings airports


Question: What are the items cataloged under the EHRI authority control?

PREFIX wd: <http://www.wikidata.org/entity/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item WHERE { ?item p:P528 ?statement . ?statement pq:P972 wd:Q51278630 . }

EHRI authority control (`EHRI authority control (Q51278630)`)


Question: What are the provinces and their corresponding countries?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?province ?state WHERE { ?province wdt:P31 / wdt:P279 * wd:Q34876 . ?province wdt:P17 ?state . }

The list of all provinces and their countries


Question: What are the official languages of countries that use a writing system which is either a subclass of the Latin script or an instance of a Latin-script alphabet? Include a count of each language, and order by the count in descending order.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?language ( COUNT ( ?language ) AS ?count ) WHERE { ?country wdt:P31 wd:Q6256 . ?country wdt:P37 ?language . ?language wdt:P282 ?script . { ?script wdt:P279 * wd:Q8229 . } UNION { ?script wdt:P31 wd:Q29575627 } } GROUP BY ?language ORDER BY DESC ( ?count )

How many official languages are there in the world ?


Question: What are the different types of items that have a U.S. National Archives Identifier, along with the total count of how many items of each type exist, ordered by the total count in descending order?

#NARA P1225
SELECT ?nature ?total WITH {
  SELECT ?nature (COUNT(?item) as ?total)
  WHERE
  {
    ?item wdt:P1225 ?ID;
          wdt:P31 ?nature.
  } GROUP BY ?nature }  as %i
where
{
  include %i
} ORDER BY DESC(?total)

Time out


Question: What are the items located in Ille-et-Vilaine, along with their coordinates and the century of their inception (rounded to the nearest century)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?coord ( round ( YEAR ( ?date ) / 100 ) as ?layer ) WHERE { ?item wdt:P131 + wd:Q12549 ; wdt:P625 ?coord ; wdt:P571 ?date . }

Query by century


Question: Which Italian citizens died before June 18, 1946 and were born within the start and end time of their country of birth's existence? Please include their date of birth and date of death, place of birth and place of death, and the start and end time of their country of birth. Use the MAX function to get only one date of birth and date of death.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?human ( MAX ( ?nato ) as ?DoB ) ( MAX ( ?morte ) as ?DoD ) ?natoC ?morteC ?paese ?inizioPaese ?finePaese WHERE { ?human wdt:P31 wd:Q5 ; wdt:P27 wd:Q38 ; wdt:P569 ?nato ; wdt:P19 ?natoC ; wdt:P570 ?morte ; wdt:P20 ?morteC . ?natoC p:P17 ?statmt . ?statmt ps:P17 ?paese . ?statmt pq:P580 ?inizioPaese . ?statmt pq:P582 ?finePaese FILTER ( "1946-06-18" ^^ xsd:dateTime > ?morte ) FILTER ( year ( ?inizioPaese ) < year ( ?nato ) && year ( ?nato ) < year ( ?finePaese ) ) } group by ?human ?natoC ?morteC ?paese ?inizioPaese ?finePaese

query for humans with `country of citizenship (P27)` inconsistent with date of birth


Question: Which books were authored by Arthur Conan Doyle?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?book WHERE { ?book wdt:P50 wd:Q35610 . }

Example with horses/optionals


Question: Which communes of Italy have their northernmost point at a latitude greater than the southernmost point of Trieste? Please include their names, northernmost latitude, and northernmost longitude, and order by from northernmost to southernmost.

PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?northernmostLat ?northernmostLong WHERE { wd:Q546 p:P1333 / psv:P1333 / wikibase:geoLatitude ?threshold . ?item wdt:P31 wd:Q747074 ; p:P1332 / psv:P1332 [ wikibase:geoLatitude ?northernmostLat ; wikibase:geoLongitude ?northernmostLong ] . FILTER ( ?northernmostLat > ?threshold ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,it" } . } ORDER BY DESC ( ?northernmostLat )

Italian cities above `Trieste (Q546)`


Question: Which items have the official name "Коломия" in Ukrainian?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item WHERE { ?item wdt:P1448 "Коломия" @uk . }

all items with name in some language


Question: Who are the current members of the Tunisian parliament (Assembly of the Representatives of the People) without an end time specified, along with their start time, electoral district, and the election in which they were elected, if available?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?P580 ?P768 ?P2715 WHERE { ?item p:P39 ?stat . ?stat ps:P39 wd:Q29169698 . filter not exists { ?stat pq:P582 [] . } OPTIONAL { ?stat pq:P580 ?P580 . } OPTIONAL { ?stat pq:P768 ?P768 . } OPTIONAL { ?stat pq:P2715 ?P2715 . } }

Members of the Assembly of the Representatives of the People


Question: Which items are role-playing video games? Include their developers, publishers, and publication dates, if available.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?game ?dev ?publisher ?date WHERE { ?game wdt:P31 wd:Q7889 ; wdt:P136 wd:Q744038 . OPTIONAL { ?game wdt:P178 ?dev . ?game wdt:P123 ?publisher . ?game wdt:P577 ?date . } }

Role-playing game


Question: Which French audiovisual works have a URL starting with "https://www.artfilm.ch"? Include their directors, and the family names of the directors, ordered by the family names.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?réal ?famLabel WHERE { ?item wdt:P31 / wdt:P279 * wd:Q2431196 ; wdt:P57 ?réal . ?item p:P973 ?describestmt . ?describestmt ps:P973 ?decrit . ?describestmt pq:P407 wd:Q150 . FILTER STRSTARTS ( STR ( ?decrit ) , "https://www.artfilm.ch" ) . ?réal wdt:P734 ?fam . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it,de" . } } ORDER BY STR ( ?famLabel )

Query on qualifier and display it on results


Question: Which distinct destroyers have an operator not listed in the vessel class's list of operators? For each row, include the vessel class and operator.

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?class ?operator WHERE { ?item wdt:P31 wd:Q174736 . ?item wdt:P137 ?operator . ?item wdt:P289 ?class . MINUS { ?class p:P137 / ps:P137 ?operator . } }

Populating the operators of ship classes from the operators of individual ships


Question: Which distinct items are subclasses, at any level, of a manuscript (a document written by hand)?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { ?item p:P279 ?statement0 . ?statement0 ( ps:P279 / ( wdt:P279 * ) ) wd:Q87167 . }

Hierarchical list of subclasses


Question: What are the 20 most common properties, excluding external IDs, for television series on Moroccan Arabic Wikipedia (https://ary.wikipedia.org/), and what percentage of television series have each property?

#title:Most common properties (excluding external ids) for a type of item on a given Wikipedia
SELECT ?id (COUNT(DISTINCT ?item)*100/?total AS ?percent)
WITH { SELECT $WIKIPEDIA $TYPE WHERE {
  VALUES $WIKIPEDIA  { <https://ary.wikipedia.org/> }
  VALUES $TYPE { wd:Q5398426 }
  } } AS %constants
WITH {
 SELECT ?item WHERE {
  INCLUDE %constants
  ?item wdt:P31/wdt:P279? $TYPE .
   ?arwp schema:about ?item ; schema:isPartOf $WIKIPEDIA
 } } AS %list
WITH { SELECT (COUNT(?item) AS ?total) WHERE {
  INCLUDE %constants
  ?item wdt:P31/wdt:P279? $TYPE .
   ?arwp schema:about ?item ; schema:isPartOf $WIKIPEDIA
 } } AS %total
WHERE {
  include %list .
  include %total .
  ?item ?p [] .
  ?id wikibase:claim ?p FILTER(?id != wd:P31).
  MINUS { ?id wikibase:propertyType wikibase:ExternalId }
} GROUP BY ?id ?total
ORDER BY DESC(?percent)
LIMIT 20

Reducing duplication


Question: Who has received an honorary doctorate from Bordeaux Montaigne University? Please also include the year they received the doctorate and order results by year

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?person ( YEAR ( ?date ) as ?year ) WHERE { ?person p:P166 ?distinction . ?distinction ps:P166 wd:Q55455135 . ?distinction pq:P585 ?date . } group by ?person ?date order by ?year

ImageGrid with a default picture?


Question: What is the second-level parent organization of AdMob, the mobile advertising company?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?PO2ndlevel WHERE { ?PO1stlevel wdt:P355 wd:Q1318441 . ?PO2ndlevel wdt:P355 ?PO1stlevel . }

Getting a company's hierarchy


Question: What are the religious buildings located in the region of Molise, Italy?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT * WHERE { ?q wdt:P31 / wdt:P279 * wd:Q24398318 . ?q wdt:P131 * / wdt:P276 * wd:Q1443 . }

Find any kind of religious building in a region


Question: Which distinct items are instances of video game genres, or subclasses of either video game genres or electronic games? Please return the genre, the OLAC video game genre vocabulary ID (if available), and any subclasses (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?genre ?OLAC ?_subclass_of WHERE { ?genre wdt:P31 wd:Q659563 . VALUES ?gametype { wd:Q659563 wd:Q2249149 } OPTIONAL { ?genre wdt:P279 ?_subclass_of . { ?_subclass_of wdt:P31 wd:Q659563 . } UNION { ?_subclass_of wdt:P279 wd:Q2249149 . } } OPTIONAL { ?genre wdt:P6352 ?OLAC . } }

Video game genres and OLAC catalogue


Question: What are the details of all tennis tournaments that were part of the 2018 ATP World Tour? Please include the tournament item, country (if available), end time (if available), location (if available), edition number (if available), point in time (if available), and surface played on (if available), sorted in ascending order by end time.

PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?country ?endValue ?location ?edition ?timeValue ?surface WHERE { ?item wdt:P361 wd:Q23039138 ; wdt:P31 / wdt:P279 * wd:Q13219666 . OPTIONAL { ?item wdt:P17 ?country } OPTIONAL { ?item p:P582 / psv:P582 ?endNode . ?endNode wikibase:timeValue ?endValue . } OPTIONAL { ?item wdt:P276 ?location } OPTIONAL { ?item wdt:P393 ?edition } OPTIONAL { ?item p:P585 / psv:P585 ?timeNode . ?timeNode wikibase:timeValue ?timeValue . } OPTIONAL { ?item wdt:P765 ?surface } } ORDER BY ASC ( ?endValue )

2018 ATP World Tour


Question: Which objects have two statements of elevation above sea level with a difference of more than 500 meters between the two statements? For each object, please include the specific part to which the elevation applies (if available) and the elevation (in meters) for both elevation statements.

PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wikibase: <http://wikiba.se/ontology#> SELECT ?item ?p518_1 ?h1 ?p518_2 ?h2 { ?item p:P2044 ?h1stm . ?h1stm psn:P2044 [ wikibase:quantityAmount ?h1 ] . OPTIONAL { ?h1stm pq:P518 ?p518_1 } ?item p:P2044 ?h2stm . ?h2stm psn:P2044 [ wikibase:quantityAmount ?h2 ] . OPTIONAL { ?h2stm pq:P518 ?p518_2 } FILTER ( ?h1 - ?h2 > 500 ) }

Geographical Objects


Question: What are the nearest cultural heritage sites within a 25 km radius of the coordinates (52.241980731490386, -3.564224203100305)? Include archaeological sites, historical monuments, historical city centres, historic sites, heritage sites, historic districts, battlefields, former settlements, historic buildings, historic houses, ancient cities, and heritage properties. Provide their item IDs, geocoordinates, and distances, and order outputs by ascending distance, limited to 100 results.

PREFIX geo: <http://www.opengis.net/ont/geosparql#> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?site ?geo ?distance WHERE { { ?site wdt:P31 / wdt:P279 * wd:Q839954 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q916475 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q676050 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q1081138 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q358 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q15243209 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q4895508 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q22674925 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q35112127 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q5773747 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q15661340 . } UNION { ?site wdt:P31 / wdt:P279 * wd:Q2434238 . } ?site wdt:P31 ?class . SERVICE wikibase:around { ?site wdt:P625 ?geo . bd:serviceParam wikibase:center "Point(-3.564224203100305 52.241980731490386)" ^^ geo:wktLiteral . bd:serviceParam wikibase:radius "25" . bd:serviceParam wikibase:distance ?distance . } } GROUP BY ?site ?geo ?distance ORDER BY ASC ( ?distance ) LIMIT 100

Aggregation q


Question: Get a list of roller coasters and their respective countries, if available.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?country WHERE { ?item wdt:P31 wd:Q204832 . optional { ?item wdt:P17 ?country . } }

Rollercoasters in country?


Question: What are the dimensions, items, SI conversions, and units for items that have a conversion to SI unit and a measured physical quantity?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> SELECT ?dimension ?item ?siconv ?unit WHERE { ?item p:P2370 / psv:P2370 ?var . ?var wikibase:quantityAmount ?siconv . ?var wikibase:quantityUnit ?unit . ?item wdt:P111 ?dimension . }

Unit conversion


Question: What was the total revenue (and revenue unit) of the German nature conservation organization Naturschutzbund Deutschland on January 1, 2019?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?amount ?unit WHERE { wd:Q516755 p:P2139 ?statement . ?statement psv:P2139 ?full_value . ?statement pq:P585 "2019-01-01" ^^ xsd:dateTime . ?full_value wikibase:quantityAmount ?amount . ?full_value wikibase:quantityUnit ?unit . }

Value of a property at a point in time


Question: What are the shortest wars on Wikidata? Please include their start times, end times, and duration in days (calculated either from the duration in seconds or from the difference between the start and end times, if available). Order results by duration and start time, and limit to 15 rows.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?start ?end ?days { ?item wdt:P31 / wdt:P279 * wd:Q198 . OPTIONAL { ?item p:P2047 / psn:P2047 / wikibase:quantityAmount ?duration_seconds . BIND ( ?duration_seconds / 86400 AS ?days1 ) } OPTIONAL { ?item p:P580 / psv:P580 [ wikibase:timeValue ?start ; wikibase:timePrecision 11 ] . ?item p:P582 / psv:P582 [ wikibase:timeValue ?end ; wikibase:timePrecision 11 ] . BIND ( xsd:integer ( ?end - ?start ) AS ?days2 ) } BIND ( COALESCE ( ?days1 , ?days2 ) AS ?days ) FILTER BOUND ( ?days ) } ORDER BY ?days ?start LIMIT 15

Shortest and longest wars


Question: What is the total number of Nobel Prizes received by individuals from each country for each year, grouped by year and country?

SELECT  ?year ?country (COUNT(?human) AS ?TotalYearlyPrizeNumberByCountry)
WITH
{
  SELECT * WHERE {
    ?human (p:P166) ?awardStatement.
    ?awardStatement ps:P166/wdt:P279* wd:Q7191.
          ?awardStatement pq:P585 ?date.
    ?human  wdt:P27 ?country.
          bind(str(YEAR(?date)) AS ?year)
    }
} AS %results
WHERE
{
    INCLUDE %results.
}
GROUP BY ?year ?country

get accumulated sum of nobel prize by country


Question: What are the items referenced in the publication "Echinoderms from Australia, an account of collections made in 1929 and 1932," along with their best-ranked synonym (if any), roles of the references (if available), and page numbers (if available)?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX pr: <http://www.wikidata.org/prop/reference/> PREFIX prov: <http://www.w3.org/ns/prov#> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?synOf ?refHasRole ?Pages WHERE { ?reference pr:P248 ?publication . FILTER ( ?publication IN ( wd:Q56025286 ) ) ?reference ^ prov:wasDerivedFrom ?st . ?st ^ p:P225 ?item . OPTIONAL { ?item p:P2868 ?syn_st . ?syn_st a wikibase:BestRank . ?syn_st ps:P2868 wd:Q1040689 . ?syn_st pq:P642 ?synOf . } OPTIONAL { ?reference pr:P6184 ?refHasRole . } OPTIONAL { ?reference pr:P304 ?Pages . } OPTIONAL { ?reference pr:P1992 ?PlaziID . } OPTIONAL { ?reference pr:P687 ?BHLpageID . } }

Expansion of an existing query


Question: What are the cultural heritage items located in Helsinki? Please provide their year of creation (if available), commemorated entities (if available), images (if available), and coordinates (if available), and order by item ID.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?år_skapad ?tillminnetav ?image ?coords WHERE { ?item wdt:P31 / wdt:P279 * wd:Q210272 . ?item wdt:P131 wd:Q1757 . OPTIONAL { ?item wdt:P571 ?p571 . BIND ( YEAR ( ?p571 ) AS ?år_skapad ) } OPTIONAL { ?item wdt:P547 ?tillminnetav } OPTIONAL { ?item wdt:P18 ?image } OPTIONAL { ?item wdt:P625 ?coords } } ORDER BY ?item

Map in defined language


Question: What are the details of nuclear weapons tests, excluding those that are part of a nuclear test series? For each test, include the date (if available), operator (if available), explosive energy equivalent (if available), and their energy equivalent in kilotons (if available).

PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?essai_nucl_aire ?date ?op_rateur ?tnt ?equivalent_nergie_kT WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?essai_nucl_aire ( wdt:P31 / wdt:P279 * ) wd:Q210112 . MINUS { ?essai_nucl_aire ( wdt:P31 / wdt:P279 * ) wd:Q98391050 . } OPTIONAL { ?essai_nucl_aire wdt:P585 ?date . } OPTIONAL { ?essai_nucl_aire wdt:P137 ?op_rateur . } OPTIONAL { ?essai_nucl_aire wdt:P2145 ?tnt . } OPTIONAL { ?essai_nucl_aire p:P2145 ?yield_statement . ?yield_statement a wikibase:BestRank . ?yield_statement psv:P2145 ?yield_value . ?yield_value wikibase:quantityAmount ?yield . ?yield_value wikibase:quantityUnit ?unit . ?unit wdt:P2370 ?conversion_to_SI . BIND ( ?yield * ?conversion_to_SI / 4184000000000.0 AS ?equivalent_nergie_kT ) } }

`nuclear weapons test (Q210112)` and their `explosive energy equivalent (P2145)`


Question: Who are the humans that are double first cousins, where their fathers are brothers and their mothers are sisters? Please avoid instances where the people were half siblings (i.e. shared a parent) or where they were more related in another way (i.e. shared a grandparent). Provide the item IDs of these individuals and their respective fathers and mothers.

# Double cousins: children of 2 brothers marrying 2 sisters
SELECT
  ?person
  ?relative
  ?f1
  ?m1
  ?f2
  ?m2
WITH
{
  SELECT   ?person   ?f1   ?m1   ?relative ?f2 ?m2 ?gf1 ?gf2 ?gm1 ?gm2
  {
    ?person wdt:P22 ?f1 ; wdt:P25 ?m1 .
    ?relative wdt:P22 ?f2 ;wdt:P25 ?m2 .
    { ?f1 wdt:P3373 ?f2 . ?m1 wdt:P3373 ?m2 .
    # checks to avoid half-siblings:
    ?f1 wdt:P22 ?gf1 ; wdt:P25 ?gm1 .
    ?f2 wdt:P22 ?gf1 ; wdt:P25 ?gm1 .
    ?m1 wdt:P22 ?gf2 ; wdt:P25 ?gm2 .
    ?m2 wdt:P22 ?gf2 ; wdt:P25 ?gm2 .
    }
    FILTER ( ?person != ?relative && ?f1 != ?f2 && ?m1 != ?m2 && ?gf1 != ?gf2  && ?gm1 != ?gm2 )  #avoid more closely related
  }
} as %basic
WHERE
{
    INCLUDE %basic
    ?person wdt:P31 wd:Q5 .
    ?relative wdt:P31 wd:Q5 .
}

Double first cousins


Question: Which items are part of the Camino de Santiago (also known as the Way of Saint James), including their coordinates, and the routes they are part of (where those routes are instances of a pilgrims' way)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?Donejakue_bidea ?koordenatuak ?bidea WHERE { ?Donejakue_bidea ( wdt:P361 * ) wd:Q41150 ; wdt:P625 ?koordenatuak . ?Donejakue_bidea wdt:P361 ?bidea . ?bidea wdt:P31 wd:Q337912 . }

Map of Camino de Santiago not showing all the coordinates


Question: What are the items where the property "properties for this type" is used, along with the associated properties and their characteristics?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item ?properties_for_this_type ?has_quality WHERE { ?item p:P1963 ?stm . ?stm ps:P1963 ?properties_for_this_type . ?stm pq:P1552 ?has_quality . }

List all items where `has characteristic (P1552)` is used as a qualifier on `properties for this type (P1963)`


Question: Which international airports have exactly one runway? Please provide their labels and the number of runways, and order by the airport label.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ( count ( ?runway ) as ?runways ) WHERE { ?item wdt:P31 wd:Q644371 . optional { ?item wdt:P529 ?runway . } SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' } } group by ?item ?itemLabel having ( ?runways = 1 ) order by ?itemLabel

List of (international) airports having only one runway


Question: Who are the 100 oldest living tennis players? Include their dates of birth, genders, and ages, and order by age in descending order. Exclude those who are 110 years old or older.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?birth ?gender ?age WHERE { ?item wdt:P106 wd:Q10833314 ; wdt:P569 ?birth ; wdt:P21 ?gender . MINUS { ?item wdt:P570 [] } . BIND ( YEAR ( now () ) - YEAR ( ?birth ) as ?age ) . FILTER ( ?age < 110 ) } ORDER BY DESC ( ?age ) LIMIT 100

Oldest living tennis players


Question: Who are the distinct individuals who were born in Almería Province and died in a Nazi concentration camp?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?person WHERE { ?person wdt:P20 [ wdt:P31 wd:Q328468 ] ; wdt:P19 [ wdt:P131 wd:Q81802 ] . }

List people born in a region and dead in nazi camps


Question: Which items are manga chapters that are part of the "Detective Conan" series? Provide each chapter's Japanese title (if available), volume (if available), series ordinal (if available), publication date (if available), and place of publication (if available).

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?manga_chapter ?japanese_title ?volume ?series ?pub_date ?pub_place WHERE { ?manga_chapter wdt:P31 wd:Q53460949 . ?manga_chapter p:P179 ?qual . ?qual ps:P179 wd:Q185143 . OPTIONAL { ?qual pq:P478 ?volume . } OPTIONAL { ?qual pq:P1545 ?series . } OPTIONAL { ?manga_chapter p:P577 ?pub . ?pub ps:P577 ?pub_date . OPTIONAL { ?pub pq:P291 ?pub_place . } } OPTIONAL { ?manga_chapter wdt:P1476 ?japanese_title . } } ORDER BY ?series ?pub_date

Help on showing `place of publication (P291)` qualifier


Question: Which publishers have worked in Amsterdam? For each publisher, include their date of birth (if available), date of death (if available), image (if available), work location, and coordinates of both the publishers (if available) and their work locations (if available)?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?date_of_birth ?date_of_death ?image ?worklocation ?coordinate_person ?coordinate_location WHERE { ?item wdt:P106 wd:Q2516866 ; wdt:P937 ?worklocation . ?worklocation wdt:P131 * wd:Q727 OPTIONAL { ?worklocation wdt:P625 ?coordinate_location } OPTIONAL { ?item p:P937 / pq:P625 ?coordinate_person } OPTIONAL { ?item wdt:P569 ?date_of_birth } OPTIONAL { ?item wdt:P570 ?date_of_death } OPTIONAL { ?item wdt:P18 ?image } }

Amsterdam-based publishers


Question: What are the individual branches (P527 parts), as well as the overarching libraries, for libraries that are part of the Georgia Public Library Service?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?part ?library WHERE { ?library wdt:P749 wd:Q30268112 ; wdt:P527 ?part . }

Public library branches in Georgia


Question: What are the properties and their values associated with John F. Kennedy?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?property ?value WHERE { wd:Q9696 ?predicate ?value . ?property wikibase:directClaim ?predicate . }

John Kennedy


Question: Get the country, the number of cumulative deaths, and the dates of those deaths related to the COVID-19 pandemic in Italy.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?country ?deaths ?date WHERE { wd:Q84104992 wdt:P17 ?country . wd:Q84104992 p:P1120 ?deaths_statement . ?deaths_statement a wikibase:BestRank . ?deaths_statement ps:P1120 ?deaths . ?deaths_statement pq:P585 ?date . } order by ?date

Coronavirus deaths per date


Question: How many women were born in India?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ( COUNT ( * ) AS ?count ) WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P21 wd:Q6581072 . ?item wdt:P19 / wdt:P17 wd:Q668 . }

Count womans from specific places


Question: Which deceased Canadian individuals have a FamilySearch person ID and have a father who does not have a FamilySearch person ID? For each person, include their date of death, FamilySearch person ID, and their father.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?person ?dod ?fsID ?father WHERE { ?person wdt:P31 wd:Q5 . ?person wdt:P27 wd:Q16 . ?person wdt:P570 ?dod . ?person wdt:P2889 ?fsID . ?person wdt:P22 ?father . FILTER NOT EXISTS { ?father wdt:P2889 ?father_fsID } }

Dead Canadians, with a father listed, without a FamilySearch entry


Question: Which human settlements have changed their official name more than three times? For each result, please include the settlement's name, language tag, start time (if available), point in time (if available), and end time (if available).

SELECT ?item ?name ?language_tag ?start ?point_of_time ?end
WITH
{
  # Select items with more than 3 official names, i.e. it has changed at least 3 times.
  SELECT ?item
  WHERE
  {
    ?item p:P1448 []. # Official name
  }
  GROUP BY ?item
  HAVING (COUNT(?item) > 3)
} AS %multiple_names
WITH
{
  SELECT ?item
  WHERE
  {
    INCLUDE %multiple_names
    ?item p:P1448 / ps:P1448 ?name.
  }
  GROUP BY ?item
  HAVING (COUNT(?item) > 3)
} AS %multiple_French_names
WHERE
{
  INCLUDE %multiple_French_names
  ?item wdt:P31 / wdt:P279 wd:Q486972. # ?item is a settelement
  ?item p:P1448 ?name_statement.
  ?name_statement ps:P1448 ?name.
  BIND (LANG(?name) AS ?language_tag).
  OPTIONAL { ?name_statement pq:P580 ?start. }
  OPTIONAL { ?name_statement pq:P585 ?point_of_time. }
  OPTIONAL { ?name_statement pq:P582 ?end. }
}
ORDER By ?item ?start ?point_of_time ?end

Town that have changed of name in the past


Question: Which chess players have a FIDE player ID but do not have an Elo rating recorded for January 2012?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item where { ?item wdt:P106 wd:Q10873124 . ?item wdt:P1440 ?fide . minus { ?item p:P1087 [ pq:P585 ?date ] . FILTER ( month ( ?date ) = 1 && year ( ?date ) = 2012 ) . } }

Chess players without specific Elo rating


Question: Which items have a heritage designation from a country different from the country they are located in, and have more than one such designation? Please include their labels, the labels of their countries, the labels of the countries of their heritage designations, and their coordinates if available. Order results by item label, country label, and heritage designation country label.

SELECT distinct ?item ?itemLabel ?countryLabel ?designation_countryLabel ?coords
with {
Select ?item  (count(?item) as ?count)          # this select gets us items with more than one country / heritage designation
               where {
  ?item wdt:P1435 ?designation.                 # item has a heritage designation
  ?item wdt:P17 ?country.                       # item has a country
  ?designation wdt:P17 ?designation_country.    # the heritage designation has a country
  filter (?country!=?designation_country)       # the country of the heritage designation is not the listing country

} group by ?item  having (?count>1) } as %candidates
 where {
include %candidates                             # this select finds properties of the items found in the last select
  ?item wdt:P1435 ?designation.                 # item has a heritage designation
  ?item wdt:P17 ?country.                       # item has a country
  ?designation wdt:P17 ?designation_country.    # the heritage designation has a country
  OPTIONAL {?item wdt:P625 ?coords.}            # item may have coordinates
  filter (?country!=?designation_country)       # the country of the heritage designation is not the listing country
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
 } order by ?itemLabel ?countryLabel ?designationLabel

Foreign heritage in France


Question: What are the church buildings located in Normandy, along with the item of the places they are located in and their images?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?lieu ?image WHERE { ?item ( wdt:P31 / ( wdt:P279 * ) ) wd:Q16970 ; wdt:P131 ?lieu . ?lieu ( wdt:P131 * ) wd:Q18677875 . ?item wdt:P18 ?image . }

Query church buildings in a certain administrative unit, output with image?


Question: Which items are labeled "Madonna and Child" in English but do not have a label in French?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?item { BIND ( STRLANG ( "Madonna and Child" , "en" ) AS ?enlabel ) . ?item rdfs:label ?enlabel . FILTER NOT EXISTS { ?item rdfs:label ?frlabel . FILTER ( LANG ( ?frlabel ) = "fr" ) . } . }

Item with the name "Madonna and Child" in English


Question: Who were the top 100 people with the highest Elo ratings in January 2023? Please include their Elo rating, and order by their Elo rating in descending order.

SELECT ?item ?time ?elo WHERE
{
  ?item wdt:P31 wd:Q5;
        p:P1087 [ ps:P1087 ?elo; pqv:P585/wikibase:timeValue ?time ] .
  FILTER (YEAR(?time) = 2023 && MONTH(?time) = 1) .
} ORDER BY DESC(?elo) LIMIT 100

Chess Elo


Question: Which items have an official website URL that contains the string "twitter"?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item { ?item wdt:P856 ?url . filter ( contains ( str ( ?url ) , "twitter" ) ) . }

Finding an organisation by its website


Question: Which items have exactly the string "Fred Smith" listed under its author name string?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item { ?item wdt:P2093 "Fred Smith" . }

Searching author name strings


Question: What are the cemeteries in Norway that have either a Commonwealth War Graves Commission burial ground ID or a Foreign war churchyards in Norway ID? Please provide their coordinates (if available), the relevant ID (if available), and an image (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?cem ?cwgc_id ?fwcn_id ?coor ?img WHERE { { ?cem wdt:P17 wd:Q20 . ?cem wdt:P1920 ?cwgc_id . } UNION { ?cem wdt:P8387 ?fwcn_id . } OPTIONAL { ?cem wdt:P625 ?coor } OPTIONAL { ?cem wdt:P18 ?img } }

Union


Question: Who has received the World Chess Championship award, including start times (if available) and end times of the award (if available)?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?start_time ?end_time WHERE { ?item p:P166 ?statement . ?statement ps:P166 wd:Q190042 . OPTIONAL { ?statement pq:P580 ?start_time . } OPTIONAL { ?statement pq:P582 ?end_time . } }

Chess champions


Question: What are the countries, ordered by their names in English?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel WHERE { ?item p:P31 / ps:P31 wd:Q6256 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER by ?itemLabel

Countries missing when queried


Question: Which items have a formatter URL that includes "web.archive.org"?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?fURL WHERE { ?item wdt:P1630 ?fURL . filter ( contains ( ?fURL , "web.archive.org" ) ) }

Discontinued properties


Question: What are the stars in the Hydra constellation with an apparent magnitude less than 6? Include their apparent magnitudes if available, and order the results by ascending apparent magnitude, and limit to 10 results.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?magaparent WHERE { ?item wdt:P59 wd:Q10578 ; wdt:P31 wd:Q523 . OPTIONAL { ?item wdt:P1215 ?magaparent } . FILTER ( ?magaparent < 6 ) } ORDER BY ASC ( ?magaparent ) LIMIT 10

Stars belonging to Hydra constellation


Question: What are the institutions located in municipalities or cantons of Switzerland that are described in Memobase? Include their types (if available), street addresses (if available), municipalities (if available), and cantons (if available). Exclude any institutions where the municipality is within the canton, as well as institutions that no longer exist. Order results by item ID.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?type ?adress ?muni ?canton WHERE { ?item wdt:P1343 wd:Q96192978 . OPTIONAL { ?item wdt:P31 ?type } . OPTIONAL { ?item wdt:P6375 ?adress . } OPTIONAL { ?item wdt:P131 ?muni . ?muni wdt:P31 wd:Q70208 . ?muni p:P131 ?decl_loc2 . ?decl_loc2 ps:P131 ?canton . ?canton wdt:P31 wd:Q23058 . FILTER NOT EXISTS { ?decl_loc2 ps:P131 ?canton ; pq:P582 ?datefin . } } } GROUP BY ?item ?type ?adress ?muni ?canton ORDER BY ?item

FILTER NOT EXISTS on qualifier


Question: What are the software version identifiers for the wiki software named "MediaWiki," and their publication dates if available? Order by publication date.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?software_version_identifier ?date WHERE { ?wiki_software wdt:P31 wd:Q6686945 . ?wiki_software rdfs:label ?wiki_softwareLabel . filter ( lang ( ?wiki_softwareLabel ) = "en" ) filter ( str ( ?wiki_softwareLabel ) = "MediaWiki" ) OPTIONAL { ?wiki_software p:P348 ?stat . ?stat ps:P348 ?software_version_identifier . OPTIONAL { ?stat pq:P577 ?date . } } } order by ?date

Query for all versions added to MediaWiki


Question: What are the distinct museums located in Buenos Aires or any of its subdivisions, along with the administrative territorial entities they are located in?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?museo ?p131 WHERE { ?museo p:P31 / ps:P31 / wdt:P279 * wd:Q33506 . ?museo wdt:P131 ?p131 . wd:Q1486 wdt:P150 * ?p131 . }

Museums under a administrative territorial entity and its subdivisions


Question: How many musical ensembles were formed each year, grouped by the year of their inception and sorted by year?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?year ( count ( ?item ) as ?cnt ) WHERE { ?item wdt:P31 / wdt:P279 * wd:Q2088357 . ?item wdt:P571 ?publicationdate . BIND ( str ( year ( ?publicationdate ) ) as ?year ) FILTER ( bound ( ?year ) ) } GROUP BY ?year ORDER BY ?year

Sorting in histogram


Question: Who are the individuals with a specified voice type (such as soprano, mezzo-soprano, contralto, countertenor, tenor, baritone, bass, and their derivatives) but do not have a defined occupation? For each individual,  include their voice type.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?voicetype WHERE { ?item wdt:P412 ?voicetype . FILTER NOT EXISTS { ?item wdt:P106 [] } ?item wdt:P31 wd:Q5 . }

Human being having `voice type (P412)` but without a defined occupation


Question: What are the European Union member states, their populations, and their population ranks? Order by population rank.

SELECT ?EU_member ?population (COUNT(?found_larger_population) + 1 AS ?population_rank)
WITH
{
  SELECT ?EU_member ?population
  WHERE
  {
    wd:Q458 wdt:P150 ?EU_member .
    ?EU_member wdt:P1082 ?population .
  }
}
AS %get_members_and_population
WHERE
{
  INCLUDE %get_members_and_population
  {
    SELECT (?population AS ?population2)
    WHERE
    {
      INCLUDE %get_members_and_population
    }
  }
  BIND (IF(?population2 > ?population, true, 1/0) AS ?found_larger_population)
}
GROUP BY ?EU_member ?population
ORDER BY DESC(?population)

Row numbering


Question: Who are the guests who have appeared on the German political TV talk show "Anne Will," and how many distinct episodes has each guest appeared in, ordered by the number of appearances in descending order?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> select ?person ( count ( distinct ?episode ) as ?count ) where { ?episode wdt:P179 wd:Q565894 . ?episode wdt:P5030 ?person . } group by ?person order by desc ( ?count )

Counting appearances as talk show guests


Question: Who are the individuals who were born in Venezuela, died in Venezuela, or had Venezuelan citizenship in the years 1833, 1834, 1838, 1839, 1841, 1843, 1844-47, 1849-53, 1855-57, 1865-72, 1874, 1876-80, or 1882? Include their dates of birth, places of birth, dates of death, and places of death (all only if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?y ?item ?dob ?birth ?dod ?death { { ?item wdt:P569 ?b . BIND ( YEAR ( ?b ) as ?y ) . ?item wdt:P31 wd:Q5 . ?item wdt:P19 [ wdt:P131 * wd:Q717 ] . } UNION { ?item wdt:P570 ?d . BIND ( YEAR ( ?d ) as ?y ) . ?item wdt:P31 wd:Q5 . ?item wdt:P20 [ wdt:P131 * wd:Q717 ] . } UNION { ?item wdt:P569 ?b . BIND ( YEAR ( ?b ) as ?y ) . ?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q717 . } UNION { ?item wdt:P570 ?d . BIND ( YEAR ( ?d ) as ?y ) . ?item wdt:P31 wd:Q5 . ?item wdt:P27 wd:Q717 . } FILTER ( ?y IN ( 1833 , 1834 , 1838 , 1839 , 1841 , 1843 , 1844 , 1845 , 1846 , 1847 , 1849 , 1850 , 1851 , 1852 , 1853 , 1855 , 1856 , 1857 , 1865 , 1866 , 1867 , 1868 , 1869 , 1870 , 1871 , 1872 , 1874 , 1876 , 1877 , 1878 , 1879 , 1880 , 1882 ) ) OPTIONAL { ?item wdt:P569 ?dob } OPTIONAL { ?item wdt:P19 ?birth } OPTIONAL { ?item wdt:P570 ?dod } OPTIONAL { ?item wdt:P20 ?death } } ORDER BY ?y

Venezuelan people


Question: What are the names and dates of death of humans who died between January 1, 2021, and January 31, 2021, ordered by their date of death and name and limited to 500 results?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?dateOfDeath WHERE { ?item wdt:P31 wd:Q5 ; wdt:P570 ?dateOfDeath . FILTER ( "2020-12-31" ^^ xsd:dateTime < ?dateOfDeath && ?dateOfDeath < "2021-02-01" ^^ xsd:dateTime ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by ?dateOfDeath ?itemLabel LIMIT 500

People that died on January 2021


Question: What are the items that are instances or subclasses of artificial intelligence, along with the objects they are part of?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?object { ?item wdt:P31 / wdt:P279 * wd:Q11660 . ?item wdt:P361 ?object . }

Facts from specific domain


Question: What are the types of organizations located in the Balearic Islands, along with the count of distinct organizations for each type, ordered by the count in descending order?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?name ( COUNT ( DISTINCT ?org ) as ?count ) WHERE { ?org wdt:P31 ?name ; wdt:P131 + wd:Q5765 . ?name wdt:P279 * wd:Q43229 . } GROUP BY ?name ORDER BY DESC ( ?count )

Duplicated items


Question: What are the distinct items that are instances of either a Wikidata property with datatype 'time' or a Wikidata property related to time and duration?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { VALUES ?instanceof { wd:Q18636219 wd:Q51077473 } ?item wdt:P31 ?instanceof . }

Union of two instances of (`instance of (P31)`)


Question: What are the languages, other than English, that have a Wikipedia language edition and more than 3,000,000 speakers?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?lang { ?wp wdt:P31 wd:Q10876391 ; wdt:P407 ?lang . ?lang p:P1098 [ ps:P1098 ?speakers ] . FILTER ( ?speakers > 3000000 ) FILTER ( ?lang != wd:Q1860 ) }

20 criteria for 2 or 3 focus languages


Question: What are the Indian National Highways that are part of the national highways of India transport network? Return also their English labels and highway numbers (extracted from the labels), only include highways with numbers less than 100, and order by highway number.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?id ?label ?number WHERE { ?id wdt:P16 wd:Q1967342 . ?id rdfs:label ?label . FILTER ( lang ( ?label ) = 'en' ) BIND ( xsd:integer ( REPLACE ( ?label , '\\D' , '' ) ) AS ?number ) FILTER ( ?number < 100 ) } ORDER BY ?number

Indian National Highways below 100


Question: What are the urban municipalities in Germany? For each result, return also its official website, coordinates (if available), and parent federated state.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?website ?coordinates ?Bundesland WHERE { ?item wdt:P31 wd:Q42744322 . ?item wdt:P856 ?website . OPTIONAL { ?item wdt:P625 ?coordinates . } ?item wdt:P131 + ?Bundesland . ?Bundesland wdt:P31 wd:Q1221156 . }

List of the websites of all cities in Germany


Question: Who are the members of the Clubture Network, including the administrative territorial entities they are located in (if available) and the coordinates of these administrative areas (if available)?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?admin_area ?coord WHERE { ?item p:P463 ?stat . ?stat ps:P463 wd:Q96376996 . OPTIONAL { ?item wdt:P131 ?admin_area . OPTIONAL { ?admin_area wdt:P625 ?coord . } } }

Query members orgs by time and location


Question: Which distinct female individuals were either born or died in Bouches-du-Rhône, and who died before January 1, 1948? Please include their date of death and the institution holding their archives (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?personne ?mort ?archives WHERE { ?personne wdt:P19 / wdt:P131 * | wdt:P20 / wdt:P131 * wd:Q3240 . ?personne wdt:P21 wd:Q6581072 . ?personne wdt:P570 ?mort FILTER ( ?mort < "1948-01-01T00:00:00Z" ^^ xsd:dateTime ) . OPTIONAL { ?personne wdt:P485 ?archives . } } ORDER BY ?mort

Place of birth OR place of death


Question: What are the distinct items that have an Encyclopedia of Life ID, but are not taxons or subclasses of taxons? Include item labels and labels of what the items are instances of.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?p31Label WHERE { { SELECT ?item ?p31 WHERE { ?item wdt:P830 [] ; wdt:P31 ?p31 FILTER ( ?p31 != wd:Q16521 ) } } MINUS { ?item wdt:P31 / wdt:P279 * wd:Q16521 } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?item ?itemLabel ?p31Label ORDER BY ?itemLabel

Optimization?


Question: What are the tunnels in the Faroe Islands? For each tunnel, include also: what it is an instance or subclass of; the year it started, its year of inception, or its year of official opening (if available); its height (if available), its length (if available), and the islands it is associated with (if available)?

SELECT ?item ?instance ?year ?height ?length ?isle
with { select ?item ?isle WHERE {
  ?item wdt:P31/wdt:P279* wd:Q44377.
  ?item wdt:P17 wd:Q4628.
  OPTIONAL { ?item wdt:P5130 ?isle. }
  } group by ?item ?isle } as %i
where
{ include %i
  OPTIONAL { ?item wdt:P31 ?instance. }
  OPTIONAL { ?item wdt:P580 ?annee_debut_0. }
  OPTIONAL { ?item wdt:P571 ?annee_debut_1. }
  OPTIONAL { ?item wdt:P1619 ?annee_debut_2. }
  BIND(COALESCE(STR(YEAR(?annee_debut_2)), STR(YEAR(?annee_debut_1)), STR(YEAR(?annee_debut_0))) AS ?year)
  OPTIONAL { ?item wdt:P2048 ?height. }
  OPTIONAL { ?item wdt:P2043 ?length. }
}

Tunnels in Faroe islands


Question: What are the public artworks located in London created by female artists? For each artwork, include also the artwork's creator.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?creator WHERE { ?item wdt:P136 wd:Q557141 . ?item wdt:P131 ?sub0 . ?sub0 ( wdt:P131 ) * wd:Q23939248 . ?item wdt:P170 ?creator . ?creator wdt:P21 wd:Q6581072 . }

Public artworks in London by female artists


Question: What are the distinct super-classes of July, the seventh month in the Julian and Gregorian calendars, considering any level of subclass hierarchy?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?c WHERE { wd:Q121 wdt:P31 ? / wdt:P279 * ?c . }

Finding all super-classes


Question: Which production companies have produced more than 100 items, ordered by the number of items produced in descending order?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?prodco ( count ( ?item ) as ?count ) WHERE { ?item wdt:P272 ?prodco . } group by ?prodco having ( ?count > 100 ) order by desc ( ?count )

Querying wikidata about movies


Question: Who are the individuals from France who have more than one recorded date of death with at least day precision, where the first date of death is earlier than the second? Please provide the first date of death and the second date of death, ordered by the most recent first date of death and then by item ID.

PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?a ?b { ?item wdt:P27 wd:Q142 . ?item wdt:P31 wd:Q5 ; p:P570 [ a wikibase:BestRank ; psv:P570 [ wikibase:timeValue ?a ; wikibase:timePrecision ?tpa ] ] ; p:P570 [ a wikibase:BestRank ; psv:P570 [ wikibase:timeValue ?b ; wikibase:timePrecision ?tpb ] ] . FILTER ( ?a < ?b ) FILTER ( ?tpa >= 11 ) FILTER ( ?tpb >= 11 ) } ORDER BY DESC ( ?a ) ?item

Instances of people with more than one value for death date


Question: What are the main subjects of the scientific paper titled "Neue Cyclocephalen (Col. Dyn.)" published in 1923?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?value WHERE { VALUES ?item { wd:Q116738730 } ?item p:P921 / ps:P921 ?value . }

All values for a property, on a single item


Question: How many unmarried partners do male and female creative and performing artists have, respectively? Outputs rows should be of the form `<number of unmarried partners>, <number of female artists with that many unmarried partners>, <number of male artists with that many unmarried partners>`

SELECT ?partner_count (SAMPLE(?female_) AS ?female) (SAMPLE(?male_) AS ?male)

WITH {
  SELECT ?item ?p
WHERE
{
 ?item wdt:P451 ?p.
 ?item wdt:P106/wdt:P279* wd:Q108289408 .
} } as %t

WITH {
SELECT ?partner_count  (count(?partner_count) as ?female_) WHERE {
  SELECT ?item ?g (count(?p) as ?partner_count) WHERE
  {
    VALUES ?g {wd:Q6581072}
    INCLUDE %t
    ?item wdt:P21 ?g.
  } group by ?item ?g } group by ?partner_count ?g } as %i

WITH {
SELECT ?partner_count  (count(?partner_count) as ?male_) WHERE {
  SELECT ?item ?g (count(?p) as ?partner_count)
  WHERE
  {
    VALUES ?g {wd:Q6581097}
    INCLUDE %t
    ?item wdt:P21 ?g.
  } group by ?item ?g } group by ?partner_count ?g } as %j

WHERE
{
  { INCLUDE %i }
  UNION
  { INCLUDE %j }
} group by ?partner_count order by desc (?partner_count)

Timeout


Question: Who are the individual goats that have served as the mascot "Billygoat Hennes" for 1. FC Cologne, including their labels, images (if available), start times, and end times (if available, otherwise use the current date)?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?goat ?img ?start ?end WHERE { ?goat p:P2868 ?position . ?position ps:P2868 wd:Q151345 OPTIONAL { ?goat wdt:P18 ?img } ?position pq:P580 ?start . OPTIONAL { ?position pq:P582 ?end } BIND ( IF ( BOUND ( ?end ) , ?end , NOW () ) AS ?end ) . }

Fun with goats


Question: What are the yearly patronage statistics for Orly Airport, including the year, number of passengers, reference type, and reference? Exclude deprecated statements in your results.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX prov: <http://www.w3.org/ns/prov#> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?year ?number ?reftype ?ref WHERE { values ?item { wd:Q223416 } . ?item p:P3872 ?statement . ?statement pq:P585 ?time . ?statement ps:P3872 ?number . ?statement prov:wasDerivedFrom ?statement2 . ?statement2 ?reftype ?ref . bind ( YEAR ( ?time ) AS ?year ) MINUS { ?statement wikibase:rank wikibase:DeprecatedRank } } order by desc ( ?year )

Add reference for the number


Question: What are the different types of works, excluding written works, authored by individuals who have exactly one sitelink to Wikisource, and how many of each type are there? Order by the count of each type descending.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX schema: <http://schema.org/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?type_of_work ?count WHERE { { SELECT ?type_of_work ( COUNT ( * ) as ?count ) WHERE { ?work wdt:P50 ?p . ?p wikibase:sitelinks 1 . [] schema:about ?p ; schema:isPartOf / wikibase:wikiGroup "wikisource" . ?work wdt:P31 ?type_of_work . MINUS { ?type_of_work wdt:P279 * wd:Q47461344 . } } GROUP BY ?type_of_work } } ORDER BY DESC ( ?count )

List of authors with links to Wikisource but not any other project


Question: Who are the YouTubers who are also science communicators and do not have an image? Include their YouTube channel ID and number of social media followers if available, and order by the number of social media followers in descending order.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?channel ?number WHERE { ?item wdt:P106 wd:Q17125263 . ?item ?ppp wd:Q15143191 . FILTER NOT EXISTS { ?item wdt:P18 [] . } OPTIONAL { ?item p:P8687 ?stat . ?stat pq:P2397 ?channel . ?stat ps:P8687 ?number . } } order by desc ( ?number )

YouTubers who don't have an image


Question: What are the constituencies for elected members of the 32nd Parliament of the United Kingdom, along with the expected number of seats (if available) and the actual number of seats? Only include constituencies where the actual number of seats is greater than 1.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?constituency ?expectedNumberOfSeats ( COUNT ( ?startMP ) as ?actualNumberOfEntries ) { wd:Q41582584 wdt:P2715 ?election . ?startMP p:P39 ?positionStatement2 . ?positionStatement2 ps:P39 wd:Q41582584 . ?positionStatement2 pq:P768 ?constituency . ?positionStatement2 pq:P2715 ?election . OPTIONAL { ?constituency wdt:P1410 ?expectedNumberOfSeats . } } GROUP BY ?constituency ?constituencyLabel ?expectedNumberOfSeats HAVING ( ?actualNumberOfEntries > 1 )

Counting results


Question: What are the national wildlife areas in Canada that are located in the province of Quebec, along with their coordinates?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?location WHERE { ?item wdt:P31 wd:Q337807 ; wdt:P131 * wd:Q176 ; wdt:P625 ?location . }

All national wildlife areas of Canada in Quebec


Question: What are the items with GND IDs, along with their subject names, and shared identifiers, where the GND ID statement includes both a subject named as qualifier and an identifier shared with qualifier?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT DISTINCT ?item ?id ?named ?shared WHERE { ?item p:P227 ?statement . ?item wdt:P227 ?id . ?statement pq:P1810 ?named . ?statement pq:P4070 ?shared . }

Identifier shared with


Question: What is the geographic point that represents the midpoint of the coordinates of Paris (the capital of France) and Montigny-le-Bretonneux (a commune in Yvelines, France)? Return one column for the latitude and one column for the longitude

PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ( SUM ( ?lat ) / 2 as ?latitude ) ( SUM ( ?lon ) / 2 as ?longitude ) WHERE { values ?lieu { wd:Q90 wd:Q240798 } ?lieu wdt:P625 ?coord . ?lieu p:P625 ?coordinate . ?coordinate psv:P625 ?coordinate_node . ?coordinate_node wikibase:geoLatitude ?lat . ?coordinate_node wikibase:geoLongitude ?lon . }

fabrication d'un point geographique - make a cordomate


Question: What are the taxa authored by Edmond Perrier?

PREFIX wd: <http://www.wikidata.org/entity/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item { ?item p:P225 / pq:P405 wd:Q927667 . }

List of taxa whom taxon author is Edmond Perrier


Question: Which works were tranlated by Gabriele Sprigath? For each work, return the author (if available), title (if available), subtitle (if available), publication venue, publisher, place of publication, and publication year.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?Autor ?Titel ?Untertitel ?veroeffentlicht_in ?Verlag ?ErscheinungsortLabel ( year ( ?Erscheinungsdatum ) as ?Erscheinungsjahr ) WHERE { { ?werk wdt:P655 wd:Q92759384 . ?werk ( wdt:P361 ? ) / ( wdt:P361 | wdt:P1433 ) ?published_in . ?published_in wdt:P1476 ?veroeffentlicht_in . ?published_in wdt:P123 ?Verlag . ?published_in wdt:P291 ?ErscheinungsortLabel . ?published_in wdt:P577 ?Erscheinungsdatum . } OPTIONAL { ?werk wdt:P50 ?Autor . } OPTIONAL { ?werk wdt:P1476 ?Titel . } OPTIONAL { ?werk wdt:P1680 ?Untertitel . } }

Listeria bot


Question: Which Norwegian ships entered operational service between 1939 and 1946, along with their service entry dates?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?skip ?service_entry WHERE { ?skip wdt:P31 wd:Q11446 . ?skip wdt:P17 wd:Q20 . ?skip wdt:P729 ?service_entry . FILTER ( ( year ( ?service_entry ) >= 1939 ) && ( year ( ?service_entry ) <= 1946 ) ) }

Norwegian ships


Question: What are the municipalities of Spain located in Biscay, along with their most recent population and the year of that population data, and if available, the population and year of the population data from 10 years prior?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?population ?year ?population10 ?year10 WHERE { ?item wdt:P31 wd:Q2074737 ; ( wdt:P131 * ) wd:Q93366 . ?item p:P1082 ?pop . ?pop ps:P1082 ?population . ?pop pq:P585 ?date . ?pop wikibase:rank wikibase:PreferredRank . BIND ( YEAR ( ?date ) as ?year ) . BIND ( ?year - 10 AS ?years_minus_10 ) OPTIONAL { ?item p:P1082 ?pop10 . ?pop10 ps:P1082 ?population10 . ?pop10 pq:P585 ?date10 . BIND ( YEAR ( ?date10 ) as ?year10 ) . FILTER ( ?year10 = ?years_minus_10 ) } }

Extracting population data from two given years


Question: What are the cities in Russia whose English names end with "pol", along with their coordinates? Please include the item ID and the item label (in English).

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?coords WHERE { ?item wdt:P31 / wdt:P279 * wd:Q515 ; wdt:P17 wd:Q159 ; wdt:P625 ?coords ; rdfs:label ?itemLabel FILTER ( LANG ( ?itemLabel ) = 'en' ) . FILTER ( strEnds ( ?itemLabel , 'pol' ) ) . }

Map of cities


Question: What are the airports, military airbases, or aerodromes that have ceased to exist or stopped being valid? Please provide their item IDs, names, item IDs and labels places they serve (if available), IATA codes (if available), ICAO codes (if available), and end dates.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?itemLabel ?place_served ?place_servedLabel ?iata_c ?icao_c ?end_date WHERE { VALUES ?type { wd:Q1248784 wd:Q695850 wd:Q62447 } ?item p:P31 ?statement . ?statement ps:P31 ?type . ?statement pq:P582 ?end_date . optional { ?item wdt:P238 ?iata_c . } optional { ?item wdt:P239 ?icao_c . } optional { ?item wdt:P931 ?place_served . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . } order by ?itemLabel

Look after an IATA or ICAO code


Question: What are the sovereign states, their coordinates, and their official languages?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?country ?coordinates ?languages WHERE { ?country wdt:P31 wd:Q3624078 . ?country wdt:P37 ?languages . ?country wdt:P625 ?coordinates . } GROUP BY ?country ?coordinates ?languages

Map of languages


Question: What are the men's singles tennis events that do not have a winner indicated and are part of a tournament that belongs to either the ATP Tour or the Grand Prix tennis circuit?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?tournament WHERE { ?item wdt:P31 wd:Q46190676 . ?item wdt:P2094 wd:Q16893072 . MINUS { ?item wdt:P1346 ?winner . } ?item wdt:P361 ?tournament . ?tournament wdt:P361 ?tour . ?tour wdt:P3450 ?season_of . VALUES ?season_of { wd:Q300008 wd:Q3775082 } }

Tennis events without a winner


Question: What are the municipalities in the Province of Girona, Spain?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { ?item wdt:P31 / wdt:P279 * wd:Q2074737 . ?item wdt:P131 / wdt:P131 * wd:Q7194 . }

List of municipalities in a province


Question: What are the rural communes of Morocco?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { ?item wdt:P31 wd:Q17318027 . }

`rural commune of Morocco (Q17318027)`


Question: What are the distinct entities among South Korea, Norfolk Island, Wallis and Futuna, Tristan da Cunha, Christmas Island, and Galápagos Province, along with their population, area in square kilometers, and the date of the population data? Please only consider the latest available population date, and exclude areas that apply to lagoons, World Heritage Sites, UNESCO World Heritage Site buffer zones, and the Kuril Islands dispute, if this information is available.

SELECT DISTINCT ?i ?population ?area_sqkm ?date
WITH { SELECT ?i (MAX(?date_) as ?date) WHERE
  {
   VALUES ?i {wd:Q884 wd:Q31057 wd:Q35555 wd:Q220982 wd:Q31063 wd:Q475038}
              ## Problematic entities with multiple population values
      OPTIONAL {                  ## Get population dates for maxing purposes
      ?i p:P1082 ?popstatement.
      ?popstatement a wikibase:BestRank .
      ?popstatement pq:P585 ?date_ .
      }
   } GROUP BY ?i } as %i
WHERE
{
  INCLUDE %i
  OPTIONAL {                  ## Population, if it exists
      ?i p:P1082 ?popstatement.
      ?popstatement a wikibase:BestRank .
      ?popstatement ps:P1082 ?population .
      ?popstatement pq:P585 ?date .
  }
  OPTIONAL {                  ## Area, if it exists
    ?i p:P2046 ?areastatement .
    ?areastatement a wikibase:BestRank .
    MINUS { ?areastatement pq:P518 wd:Q187223. }     ## Filter out lagoons
    MINUS { ?areastatement pq:P518 wd:Q9259. }       ## Filter out UNESCO sites
    MINUS { ?areastatement pq:P518 wd:Q64364418. }   ## Filter out buffer zones
    MINUS { ?areastatement pq:P1012 wd:Q389717. }    ## Filter out contested Islands
    ?areastatement psn:P2046/wikibase:quantityAmount ?area_norm .
    BIND( ROUND(?area_norm/1000000) as ?area_sqkm) .
  }
}

Maxdate


Question: How many students did the educational organization with the Research Organization Registry (ROR) ID "024z2rq82" have each year? Please include a count for each year (if available), and order results by year.

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item ?students ?year WHERE { ?item wdt:P6782 "024z2rq82" . ?item p:P2196 ?stm . ?stm ps:P2196 ?students . OPTIONAL { ?stm pq:P585 ?year . } } ORDER BY ?year

Trouble connecting the qualifier to a property


Question: How many votes did the "PP+Cs" and "Vox" parties receive in each jurisdiction during the 2020 Basque regional election, grouped by each place and party?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?place ?party ( sum ( ?votes_ ) as ?votes ) WHERE { ?election wdt:P361 wd:Q30594119 . ?election wdt:P1001 ?place . ?election p:P726 ?stat . VALUES ?party { wd:Q85843184 wd:Q15630787 } . ?stat ps:P726 ?party . ?stat pq:P1111 ?votes_ . } group by ?place ?party

Number of votes of a given party on an election by municipality


Question: Which institutions have the highest number of theses or dissertations submitted to them, ordered by the count of distinct theses or dissertations in descending order?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?institution ( count ( distinct ?item ) as ?count ) WHERE { ?item wdt:P4101 ?institution . ?item wdt:P31 / wdt:P279 * wd:Q1266946 . } group by ?institution order by desc ( ?count )

Theses, which institution has most?


Question: What are the businesses headquartered in the Czech Republic, excluding Adental Czech Republic and Investiční a poštovní banka, along with their total revenue, headquarters location, date of revenue (if available), net profit, profit margin (rounded to two decimal places), and the unit of revenue (if available)? Please order the results by ascending profit margin and limit the results to 20.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?revenue ?hq ?date ?profit ( ROUND ( ?profmar * 1000 ) / 100 AS ?profmar_rounded ) ?unit WHERE { ?item wdt:P31 wd:Q4830453 . ?item wdt:P159 ?hq . ?hq wdt:P17 wd:Q213 . ?item p:P2139 ?revenueSt . ?revenueSt a wikibase:BestRank ; ps:P2139 ?revenue . OPTIONAL { ?revenueSt psv:P2139 ?psv . ?psv wikibase:quantityUnit ?unit } . OPTIONAL { ?revenueSt pq:P585 ?date } . ?item p:P2295 ?profSt . ?profSt a wikibase:BestRank ; ps:P2295 ?profit . BIND ( ?revenue / ?profit AS ?profmar ) . FILTER ( ?profmar > 0 ) FILTER ( ?item not in ( wd:Q100707321 , wd:Q12021780 ) ) } ORDER BY ASC ( ?profmar ) LIMIT 20

Values with specific unit


Question: Which distinct works are part of the series "Dictionnaire critique du marxisme [Critical of Marxism] (German)"? For each work, include title, publication year, ISBN-10 number, number of page, URL (all if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?Titel ( year ( ?Erscheinungsdatum ) as ?Erscheinungsjahr ) ?ISBN_ ?Umfang ?DigitalisatURL ?Datensatz WHERE { ?Datensatz wdt:P179 wd:Q96024609 . OPTIONAL { ?Datensatz wdt:P1476 ?Titel . } OPTIONAL { ?Datensatz wdt:P577 ?Erscheinungsdatum . } OPTIONAL { ?Datensatz wdt:P957 ?ISBN_ . } OPTIONAL { ?Datensatz wdt:P1104 ?Umfang . } OPTIONAL { ?Datensatz wdt:P747 ?Ausgabe . ?Ausgabe wdt:P953 ?DigitalisatURL . } OPTIONAL { ?Datensatz wdt:P4969 ?Bearbeitung . ?Bearbeitung wdt:P747 ?derivative_work_edition . ?derivative_work_edition wdt:P953 ?DigitalisatURL . } } GROUP BY ?Titel ?Erscheinungsdatum ?ISBN_ ?Umfang ?DigitalisatURL ?Datensatz

Online edition / series of creative works


Question: What are the cat breeds? For each cat breed, also return the cats that are instances of it if available.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?CatBreed ?Cat WHERE { ?CatBreed wdt:P31 wd:Q43577 . OPTIONAL { ?Cat wdt:P31 ?CatBreed . } } GROUP BY ?CatBreed ?Cat

A set of cat breeds along with the cats that benlong to


Question: What are the formations in the United States of America, along with their labels, and the number of items that have each formation as their main subject? Please order the results by the count in descending order, followed by the item label.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ( COUNT ( ?things ) AS ?count ) WHERE { ?item wdt:P31 wd:Q736917 . ?item wdt:P17 wd:Q30 . ?things wdt:P921 ?item . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } GROUP BY ?item ?itemLabel ORDER BY DESC ( ?count ) ?itemLabel

Count of items with particular subject


Question: What are the item IDs, populations (if available), and land areas in square kilometers (if available) for Budapest, Wake Island, and Germany, excluding any area measurements that apply to lagoons?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?e ?i ?population ?area_sqkm WHERE { { SELECT DISTINCT ?e ?i ?r WHERE { VALUES ?i { wd:Q1781 wd:Q43296 wd:Q183 } OPTIONAL { ?i owl:sameAs ?r . } BIND ( COALESCE ( ?r , ?i ) AS ?e ) } } OPTIONAL { ?e wdt:P1082 ?population . } OPTIONAL { ?e p:P2046 ?areastatement . ?areastatement a wikibase:BestRank . MINUS { ?areastatement pq:P518 wd:Q187223 . } ?areastatement ps:P2046 ?area_sqkm . } }

List of Countries and their population and land area in square kilometers


Question: What are the distinct items that either have the Rivière Mégiscane as their mouth of the watercourse or are tributaries of watercourses that have the Rivière Mégiscane as their mouth of the watercourse?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?item WHERE { BIND ( wd:Q2155719 AS ?qid ) { ?item wdt:P403 ?qid . } UNION { ?item wdt:P974 / wdt:P403 ?qid . } }

Union


Question: What are the countries and their capitals for all sovereign states, excluding those where the capital has an end date? Please include the labels for both the countries and their capitals and order by country label.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?country ?countryLabel ?city ?cityLabel WHERE { ?country wdt:P31 wd:Q3624078 . ?city p:P1376 ?statement . ?statement ps:P1376 ?country . FILTER NOT EXISTS { ?statement pq:P582 [] } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?countryLabel

Berlin is not appears in the list of capitals


Question: What are the praenomen in anicent Rome, and what are their native labels (e.g. 'Octavus'), if available?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?praenomen ?native_label WHERE { ?praenomen wdt:P31 wd:Q1240901 . OPTIONAL { ?praenomen p:P1705 ?statement . ?statement ps:P1705 ?native_label . } }

Normal and Preferred


Question: Who attended the University of Washington but does not have an academic degree qualifier, along with their date of birth if available? Order results in descending order by date of birth, and limit to 500 results.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?DoB WHERE { ?item p:P69 ?statement . ?statement ps:P69 wd:Q219563 . FILTER NOT EXISTS { ?statement pq:P512 [] . } OPTIONAL { ?item wdt:P569 ?DoB . } } ORDER BY DESC ( ?DoB ) LIMIT 500

Query Qualifier Values?


Question: What are the details of individuals who have held the position of an Italian minister, including their item ID, the specific office they held, their date of birth, place of birth, sex or gender, and the start and end times of their tenure, if available?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> Select ?member ?office ?dateBirth ?placeBirth ?sex ?start ?end Where { ?member p:P39 ?stat . ?stat ps:P39 / wdt:P279 * wd:Q3858501 . ?stat ps:P39 ?office . OPTIONAL { ?stat pq:P580 ?start . } OPTIONAL { ?stat pq:P582 ?end . } OPTIONAL { ?member wdt:P569 ?dateBirth . } OPTIONAL { ?member wdt:P19 ?placeBirth . } OPTIONAL { ?member wdt:P21 ?sex . } }

Noob looks for help


Question: Who were the people appointed by Donald Trump, and which position was this for each person?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wd: <http://www.wikidata.org/entity/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?person ?position_held { ?person p:P39 ?p39stm . ?p39stm ps:P39 ?position_held . ?p39stm pq:P748 wd:Q22686 . }

Entities Appointed By Donald Trump


Question: What are the errata (published corrections to previous publications) with English labels starting with "Erratum:" that are not referenced by any item using the "corrigendum / erratum" property? Also, provide their corresponding item labels (after removing the "Erratum: " prefix) and items, where the item labels are longer than 20 characters.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?errata ?errataLabel ?itemLabel ?item WHERE { ?errata wdt:P31 wd:Q1348305 . filter not exists { ?itemZ wdt:P2507 ?errata . } ?errata rdfs:label ?errataLabel . filter ( lang ( ?errataLabel ) = "en" ) filter ( strstarts ( ?errataLabel , "Erratum:" ) ) bind ( replace ( ?errataLabel , "Erratum: " , "" ) as ?itemLabel ) . ?item rdfs:label ?itemLabel . filter ( strlen ( ?itemLabel ) > 20 ) }

Corrections, errata and corrigenda, oh my


Question: Who has the family name Krupp (the QID Q37069298) and also have "Bertha" somewhere in their label?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?person WHERE { ?person wdt:P734 wd:Q37069298 . ?person rdfs:label ?label . FILTER REGEX ( ?label , "Bertha" ) }

Q-ID for known string of item label


Question: What other items are owned by the owner of the merchant ship Edward John? For each item, please also include its owner, the start (if available) and end times (if available) of ownership .

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?start ?end ?do WHERE { ?item wdt:P1830 wd:Q24027085 . ?item p:P1830 ?statement . ?statement ps:P1830 ?do . optional { ?statement pq:P580 ?start . } optional { ?statement pq:P582 ?end . } }

Please help with qualifier labels


Question: What are the lighthouses and their colors in Norrköping Municipality, Baltic coast?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?colour2 WHERE { VALUES ?value { wd:Q40125473 } FILTER ( ?item = ?value ) ?item p:P462 ?mem . ?mem ps:P462 ?colour2 . OPTIONAL { ?mem pq:P518 ?qual . } }

Twice-broken lighthouse colour query


Question: Which poems are in the public domain, either in English or with no specified language, and do not have an audio recording?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { ?item wdt:P31 wd:Q5185279 . ?item wdt:P6216 wd:Q19652 . filter not exists { ?item wdt:P989 [] . } { ?item wdt:P407 wd:Q1860 . } UNION { FILTER NOT EXISTS { ?item wdt:P407 [] . } } }

Public domain poems without an audio recording


Question: Which periodicals have a primary language of Esperanto?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?a WHERE { ?a wdt:P31 / wdt:P279 * wd:Q1002697 . ?a wdt:P407 wd:Q143 . }

All newspapers and magazines in Basque language


Question: What are the distinct items, along with their coordinates, that were born in a place within Norway and either have the United States of America as their country of citizenship or died in a place within the United States of America?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?item ?coord WHERE { { ?item wdt:P27 wd:Q30 . } union { ?item wdt:P20 ?pod . ?pod wdt:P17 wd:Q30 . } ?item wdt:P19 ?pob . ?pob wdt:P625 ?coord . ?pob wdt:P17 wd:Q20 . }

Norwegian citizens born outside Norway


Question: What are the events in the 2020 Formula One World Championship, along with the event times and the sum of the ages of the participants who ranked 1st, 2nd, or 3rd in each event?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?event ?eventtime ( SUM ( ?age ) AS ?age_sum ) WHERE { ?event wdt:P361 wd:Q41174436 . ?event p:P710 [ ps:P710 ?item ; pq:P1352 ?rank ] . ?event wdt:P585 ?eventtime . ?item wdt:P569 ?dob . BIND ( xsd:integer ( FLOOR ( ( ?eventtime - ?dob ) / 365.25 ) ) AS ?age ) FILTER ( ?rank in ( 1 , 2 , 3 ) ) } GROUP BY ?event ?eventtime

Combined age of podium F1


Question: What are the paintings in the Bavarian State Painting Collections with labels in German that end in ")"?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { ?item wdt:P195 wd:Q812285 . ?item wdt:P31 wd:Q3305213 . ?item rdfs:label ?iLabel . FILTER ( LANG ( ?iLabel ) = "de" ) FILTER ( STRENDS ( ?iLabel , ')' ) ) }

Filter for labels with specific suffix


Question: What are the recordings that feature performers and the instruments they played?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item ?performer ?instrument WHERE { ?statement pq:P1303 ?instrument . ?statement ps:P175 ?performer . ?item p:P175 ?statement . }

Music help - personnel that played on a recording


Question: What are the items that are not metro stations, but have a connecting line which is a rapid transit railway line? For each such item, return also the connecting line in your results.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?line WHERE { ?item wdt:P81 ?line . ?line wdt:P31 / wdt:P279 * wd:Q15079663 . FILTER NOT EXISTS { ?item wdt:P31 / wdt:P279 * wd:Q928830 . } }

Subway stations that aren't subway stations


Question: Which scholarly articles published in the journal Geosphere do not have an English label?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { ?item wdt:P31 wd:Q13442814 . ?item wdt:P1433 wd:Q15817086 . FILTER NOT EXISTS { ?item rdfs:label ?english_label . FILTER ( LANG ( ?english_label ) = "en" ) } }

Finding Geosphere articles without en: title


Question: What are the countries that are members of the United Nations, along with their capitals, populations, area sizes, heads of state, images of the heads of state, currencies, flag images, and coordinate locations (all only if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> select ?country ?cap ?pop ?area ?head ?imagehead ?currency ?flag ?coord where { ?country wdt:P31 wd:Q6256 ; wdt:P463 wd:Q1065 ; optional { ?country wdt:P36 ?cap . } optional { ?country wdt:P1082 ?pop } optional { ?country wdt:P2046 ?area } optional { ?country wdt:P35 ?head . ?head wdt:P18 ?imagehead } optional { ?country wdt:P38 ?currency } optional { ?country wdt:P41 ?flag } optional { ?country wdt:P625 ?coord } }

Duplication