Question: Which items have an official website containing 'itch.io', and what are their labels and official website URLs?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?linked_from ?linked_fromLabel ?p856 { ?linked_from wdt:P856 ?p856 . FILTER ( CONTAINS ( STR ( ?p856 ) , 'itch.io' ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY ?linked_fromLabel

Items that links to specific websites


Question: Which items have more than one unit for the "longest observed lifespan" property, and how many units do they have?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX p: <http://www.wikidata.org/prop/> SELECT ?item ( COUNT ( ?unit ) AS ?number_of_units ) { ?item p:P4214 [ psv:P4214 [ wikibase:quantityUnit ?unit ] ] . } GROUP BY ?item HAVING ( ?number_of_units > 1 )

Strange quantityUnit in `longest observed lifespan (P4214)` property for 11 objects


Question: Which items have an official website URL that contains 'bbc.com', and what are their labels?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?itemLabel ?website WHERE { ?item wdt:P856 ?website . FILTER CONTAINS ( LCASE ( STR ( ?website ) ) , 'bbc.com' ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } }

Item from website URL


Question: What are the names, birth dates, archive institutions (if available), archive descriptions (if available), inventory numbers (if available), film titles, and award titles of film directors born between 1921 and 1929 who have directed films that received Cannes Film Festival Awards? Please order the results by the archive institution names in descending order.

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 ?naissance ?archives ?archivesLabel ?archivesDescription ?inventaire ?filmLabel ?recompenseLabel { ?item wdt:P106 wd:Q2526255 ; wdt:P569 ?naissance . OPTIONAL { ?item p:P485 ?statement . ?statement ps:P485 ?archives . OPTIONAL { ?statement pq:P217 ?inventaire . } } FILTER ( year ( ?naissance ) > 1920 ) . FILTER ( year ( ?naissance ) < 1930 ) . ?film wdt:P166 ?recompense . ?film wdt:P57 ?item . ?recompense wdt:P31 wd:Q28444913 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,it" . } } ORDER BY DESC ( ?archivesLabel )

Qualifier


Question: Who are the siblings of Jane Austen, excluding George Austen and Cassandra Austen, along with their labels?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?include ?includeLabel WHERE { wd:Q36322 wdt:P3373 ?include . FILTER NOT EXISTS { wd:Q36322 wdt:P3373 ?include . VALUES ?include { wd:Q3101398 wd:Q2505245 } } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Can't figure out how to exclude statements


Question: Who are the pairs of individuals born in Italy with the same family name, born in the same place within a 10-year interval, married to each other, and both without any siblings?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item1 ?item1Label ?birthdate1 ?item2 ?item2Label ?birthdate2 ?birthplaceLabel { ?item1 wdt:P19 ?birthplace ; wdt:P734 ?fn . ?birthplace wdt:P17 wd:Q38 . ?item2 wdt:P19 ?birthplace ; wdt:P734 ?fn . hint:Prior hint:rangeSafe true . FILTER ( str ( ?item1 ) < STR ( ?item2 ) ) ?item1 wdt:P569 ?birthdate1 . ?item2 wdt:P569 ?birthdate2 . FILTER ( ABS ( YEAR ( ?birthdate1 ) - YEAR ( ?birthdate2 ) ) < 10 ) ?item1 wdt:P26 ?item2 . FILTER NOT EXISTS { ?item1 wdt:P3373 [] } FILTER NOT EXISTS { ?item2 wdt:P3373 [] } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY ?item1Label ?birthdate1

Brothers without property


Question: How many crew members were aboard the space shuttle mission STS-102 only for takeoff?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ( COUNT ( ?up ) AS ?up_only ) WHERE { values ?item { wd:Q384250 } . optional { ?item p:P1029 ?tom . optional { ?tom pq:P518 ?applies . } } BIND ( IF ( ?applies = wd:Q854248 , 1 , 1 / 0 ) AS ?up ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } GROUP BY ?item ?itemLabel

Conditional sum fail


Question: What are the items with a United States Statutes at Large citation and a United States Public Law number containing '116-', along with their optional point in time, short name, signatory, and the point in time of the signatory (all optional)?

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/> SELECT ?item ?pl ?signatory ?date2 ?short ?itemLabel WHERE { ?item wdt:P3825 ?stat ; wdt:P3837 ?pl . OPTIONAL { ?item wdt:P585 ?date . } OPTIONAL { ?item wdt:P1813 ?short . } OPTIONAL { ?item p:P1891 ?stat2 . ?stat2 ps:P1891 ?signatory ; . OPTIONAL { ?stat2 pq:P585 ?date2 . } } OPTIONAL { } FILTER ( CONTAINS ( ?pl , '116-' ) ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" } }

Getting the point-in-time of a property?


Question: How many Italian external IDs do mathematicians in the website Mathematica Italiana have, grouped by the number of such IDs? In other words, how many mathematicians have 1 external ID, how many have 2, and so on.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> Select ?ID_count ( count ( ?item ) as ?item_count ) where { SELECT ?item ( count ( ?id ) as ?ID_count ) WHERE { ?item wdt:P9114 ?P9114id . OPTIONAL { ?item ?prop ?id . ?propItem wikibase:directClaim ?prop . ?propItem wikibase:propertyType wikibase:ExternalId . ?propItem wdt:P17 wd:Q38 . } } group by ?item } group by ?ID_count order by desc ( ?ID_count )

Count only certain identifiers


Question: Who are the doctoral advisors of Leonhard Euler, and their advisors, and so on? In addition, who are his doctoral student, grand-student, great-grand-student, and great-great-grand-students? Each tuple in the result should contain both the student and their doctoral advisor.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?doctor ?doctorMaster WHERE { { ?root ( wdt:P184 * ) ?doctor . } union { ?root wdt:P185 / wdt:P185 ? / wdt:P185 ? / wdt:P185 ? ?doctor . } ?doctor wdt:P184 ?doctorMaster . VALUES ?root { wd:Q7604 } }

Doctoral advisor


Question: What are the administrative territorial entities within the district of Offenbach and their respective twin towns or sister cities, along with 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 ?twin ?twinLabel WHERE { wd:Q7912 wdt:P150 * ?item . ?item wdt:P190 ?twin . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

List of all partnerships in the district of Offenbach


Question: Who are the pianists born in Morocco and died in Paris?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?PersonA ?PersonALabel WHERE { ?PersonA wdt:P106 wd:Q486748 . ?PersonA wdt:P19 / wdt:P17 ? wd:Q1028 . hint:Prior hint:gearing "forward" . ?PersonA wdt:P20 wd:Q90 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Pianists born in Morocco who died in Paris


Question: What are the items that are both a volume and a scientific journal?

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 DISTINCT ?item ?itemLabel WHERE { ?item p:P31 [ ps:P31 wd:Q1238720 ] . ?item p:P31 [ ps:P31 wd:Q5633421 ] . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]" . } }

Items that are "instance of" two things at the same time


Question: What are the distinct border checkpoints, their labels, and their coordinates (if available) for Cyprus?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?item ?itemLabel ?coord WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } VALUES ?borders { wd:Q15974882 } ?item wdt:P361 * / wdt:P31 / wdt:P279 * wd:Q757292 . ?item wdt:P361 * / wdt:P31 * / wdt:P279 * ?borders . OPTIONAL { ?item wdt:P625 ?coord . } }

Equivalent of IN in a query


Question: Who were the politicians born on June 14, 1946? Include also their family names, given names, and dates of birth.

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 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 ?human ?humanLabel ?lastName ?givenNames ?dob WHERE { ?human wdt:P106 wd:Q82955 . ?human p:P735 / ps:P735 ?givenNames . ?human wdt:P734 ?lastName . ?human wdt:P569 ?dob . hint:Prior hint:rangeSafe true . FILTER ( ?dob >= xsd:dateTime ( "1946-06-14T00:00:00Z" ) && ?dob < xsd:dateTime ( "1946-06-15T00:00:00Z" ) ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }

All given names for a person.


Question: What are the items that are associated with both Zambia and Angola as their countries, and do not have any other country associations?

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:P17 wd:Q953 . ?item wdt:P17 wd:Q916 . FILTER NOT EXISTS { ?item wdt:P17 ?P17 . FILTER ( ?P17 NOT IN ( wd:Q916 , wd:Q953 ) ) } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]" . } }

I need a help search `country (P17)` with specific countries


Question: Which items have a Roman praenomen, have identical English and Catalan labels, and do not have a Latin label? Include the item, Roman praenomen, and the English label in the results.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?roman_praenomen ?enlabel WHERE { ?item wdt:P2358 ?roman_praenomen . ?item rdfs:label ?enlabel . FILTER ( LANG ( ?enlabel ) = 'en' ) . ?item rdfs:label ?calabel . FILTER ( LANG ( ?calabel ) = 'ca' ) . FILTER ( STR ( ?enlabel ) = STR ( ?calabel ) ) . OPTIONAL { ?item rdfs:label ?lalabel . FILTER ( LANG ( ?lalabel ) = 'la' ) . } FILTER ( ! BOUND ( ?lalabel ) ) . }

Catalan label and Roman people


Question: Who are the people that have a specific relationship with Marilyn Monroe (Marilyn Monroe is the object), and what is the nature of their relationship? Consider these relationships: child, place of death, unmarried partner, sibling, and spouse.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?PersonLabel ?relationshipLabel WHERE { ?Person ?predicate wd:Q4616 . ?relationship wikibase:directClaim ?predicate . VALUES ?relationship { wd:P40 wd:P20 wd:P451 wd:P3373 wd:P26 } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }

Type of Relationships


Question: Are Microsoft Windows, macOS, iOS, and Android classified as "MobileOS" or "DesktopOS"? Retrun whether each one is a MobileOS or DesktopOS

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?product ?productLabel ?productType WHERE { VALUES ?product { wd:Q1406 wd:Q14116 wd:Q48493 wd:Q94 } . BIND ( IF ( EXISTS { ?product wdt:P31 wd:Q920890 } , "MobileOS" , "DesktopOS" ) AS ?productType ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Using a triple as an IF condition


Question: Which genera have taxon names consisting of exactly two letters and what are their taxon names?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?taxon_name WHERE { ?item wdt:P31 wd:Q16521 . ?item wdt:P105 wd:Q34740 . ?item wdt:P225 ?taxon_name . FILTER ( STRLEN ( ?taxon_name ) = 2 ) }

Two-letter genera, on Wikispecies


Question: For each european knot tyers meeting, give the session number and the start and end dates for each event. In addition, also include the city and specific location (e.g. mesumes, etc.) where it took place (city and specific location only if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?session ?item ?city ?site ?start ?end WHERE { ?item wdt:P393 ?session . ?item wdt:P31 wd:Q112064134 . ?item wdt:P276 ?site . OPTIONAL { ?site wdt:P276 * / wdt:P131 * ?city . ?city wdt:P31 / wdt:P279 * wd:Q486972 . } ?item wdt:P580 ?start . ?item wdt:P582 ?end . }

How to retrieve the city of a building with sparql?


Question: Who are the Zambian citizens who are screenwriters, film directors, or actors, and what are their exact occupations?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { VALUES ?occ { wd:Q28389 wd:Q2526255 wd:Q33999 } ?item wdt:P106 / wdt:P279 * ?occ . ?item wdt:P106 ?occupation . ?occupation wdt:P279 * ?occ . ?item wdt:P27 wd:Q953 . }

African Cinema Content Lacking Wikipedia Pages in Wen


Question: What are the primary topics of the articles written in "Deutschlands merkwürdige Bäume", and what are their coordinates?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?mainSubjLabel ?coordinates WHERE { wd:Q19172509 wdt:P527 ?Baeume . ?Baeume wdt:P921 ?mainSubj . ?mainSubj wdt:P625 ?coordinates . }

Modify the displayed Sitelink in the Infolayers on map view


Question: Which organizations have the ticker symbol "FB", and on which stock exchanges are they listed? Include the organizations, ticker simples, and stock exchanges in the response.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> SELECT ?Org ?OrgLabel ?StockExchange ?StockExchangeLabel ?Ticker WHERE { ?Org p:P414 ?SE . ?SE ps:P414 ?StockExchange . ?SE pq:P249 ?Ticker . FILTER ( ?Ticker = "FB" ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }

Find a public company


Question: What are the names, GND IDs, birth locations, and coordinates of the birth locations for authors who have the GND ID "118561359", with labels provided in German if available?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?author ?authorLabel ?GND ?birthLocation ?coordinates WHERE { VALUES ?GND { "118561359" } ?author wdt:P227 ?GND ; wdt:P19 ?birthLocation . ?birthLocation wdt:P625 ?coordinates . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_Language],de" . } }

Query via ID, Retrieving GeoData


Question: What events took place in Tokyo in 2002, including their labels and specific dates?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?when WHERE { ?item wdt:P31 / wdt:P279 * wd:Q1656682 . ?item wdt:P131 wd:Q1490 . ?item wdt:P585 ?when . BIND ( year ( ?when ) as ?when2 ) filter ( ?when2 = 2002 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]" . } }

2002 events in Tokyo


Question: What is the count of writers born in Castile and León, grouped by their gender labels?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?genderLabel ( count ( ?gender ) as ?count ) WHERE { ?item wdt:P106 wd:Q36180 . ?item wdt:P19 / wdt:P131 * wd:Q5739 . ?item wdt:P21 ?gender . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } group by ?genderLabel

All female vs male writters born in a territorial entity including all the sub-territorial entities


Question: What are the names and dates of birth of the 10 youngest and 10 oldest goal scorers in the UEFA Super Cup? In addition, include when the specific goal in consideration took place, and how old was the player (in days) when that goal took place.

SELECT ?player ?playerLabel ?dob ?goal_date ?goal_age_days
WITH
{
  SELECT ?player ?dob ?date_first ?date_latest ?age_first ?age_latest
  WHERE
  {
    ?player p:P6509 ?p6509stm . # goals
    ?p6509stm pq:P7124 ?date_first .
    ?p6509stm pq:P7125 ?date_latest .
    ?p6509stm pq:P642 wd:Q484028 . # for UEFA Super Cup
    ?player wdt:P569 ?dob . # Date of birth
    BIND(?date_first - ?dob AS ?age_first)
    BIND(?date_latest - ?dob AS ?age_latest)
  }
} as %query
WHERE
{
  {
    SELECT ?player ?dob (?date_first AS ?goal_date) (?age_first AS ?goal_age_days)
    {
      INCLUDE %query
    }
    ORDER BY ASC(?goal_age_days)
    LIMIT 10
  }
  UNION
  {
    SELECT ?player ?dob (?date_latest AS ?goal_date) (?age_latest AS ?goal_age_days)
    {
      INCLUDE %query
    }
    ORDER BY DESC(?goal_age_days)
    LIMIT 10
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ASC(?goal_age_days)

Top 10 of the youngest and the oldest goal scorers and players in tournament history


Question: What are the distinct trademarks that contain "mercedes" in its English name, are owned by an organization, and have a logo image? Please provide their labels in English, the logo images, and the names of the owning organizations.

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 ?trademark ?trademarkLabel ?image ?organization WHERE { ?trademark wdt:P31 / wdt:P279 * wd:Q167270 ; rdfs:label ?trademarkLabel . FILTER ( LANG ( ?trademarkLabel ) = 'en' ) . FILTER ( CONTAINS ( LCASE ( ?trademarkLabel ) , 'mercedes' ) ) . ?trademark wdt:P127 ?organization . ?organization wdt:P31 / wdt:P279 * wd:Q43229 . ?trademark wdt:P154 ?image . }

Bug in usage of REGEX


Question: What is the average number of passengers and the deviation from the average number of passengers for each year after 1985 at the "JNB" airport? Return the average number, the deviation, and the year for each tuple.

SELECT ?item ?itemLabel (avg(?number) as ?passenger) (max(avg(?number) - ?number) as ?plus_minus) ?year
with {
  select ?item ?statement ?year ?timevalue ?numberperperiod{
    ?item wdt:P238 ?IATA
    VALUES ?IATA {"JNB"}.
    ?item p:P3872 ?statement.
    ?statement pqv:P585 ?timevalue
               ; ps:P3872 ?numberperperiod
               .
    ?timevalue wikibase:timeValue ?date .

    MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
    bind (YEAR(?date) AS ?year)
    FILTER (?year >1985) .
  }
} as %airport

where {
  {
    select ?item ?year (sum(?numberperperiod) as ?number) {
      include %airport .
      ?timevalue wikibase:timePrecision ?prec filter ( ?prec > 9 )
    } group by ?item ?year
  } union {
      ?timevalue wikibase:timePrecision 9 .
    bind (?numberperperiod as ?number)
      include %airport
  } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?item ?itemLabel ?year
  order by ?item desc (?year)

A possible (elaborated) solution, using the initial model


Question: Which schools in the Philippines are named after humans, and who are they named after?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?itemLabel ?namedAfter ?namedAfterLabel WHERE { ?item wdt:P31 / wdt:P279 * wd:Q2385804 . ?item wdt:P17 wd:Q928 . ?item wdt:P138 ?namedAfter . ?namedAfter wdt:P31 wd:Q5 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Current US legislators sorted by age and schools in the Philippines named after persons


Question: How many distinct African female citizens described in the Dictionary of African Biography have a Wikipedia article in any language?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX schema: <http://schema.org/> PREFIX wd: <http://www.wikidata.org/entity/> select ( count ( distinct ?person ) as ?count ) where { ?person wdt:P31 wd:Q5 . ?person wdt:P21 wd:Q6581072 . ?person wdt:P27 / wdt:P30 wd:Q15 . ?article schema:about ?person ; schema:isPartOf ?domain . filter ( contains ( str ( ?domain ) , "wikipedia" ) ) ?person wdt:P1343 wd:Q46002746 . }

African women queries


Question: Who are the female Swiss citizens who are politicians and are also either diplomats, employed by the United Nations, or employed by an international organization?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { ?item wdt:P106 wd:Q82955 . { ?item wdt:P106 wd:Q193391 . } UNION { ?item wdt:P108 / wdt:P361 * wd:Q1065 . } UNION { ?item wdt:P108 / wdt:P31 wd:Q484652 . } ?item wdt:P21 wd:Q6581072 . ?item wdt:P27 wd:Q39 . }

Swiss women politicians involved in foreign affairs and/or international policy


Question: What are the railway stations located in São Paulo?

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 ?itemLabel WHERE { ?item wdt:P31 wd:Q55488 . ?item p:P131 ?statement . ?statement ps:P131 wd:Q174 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,pt " . } }

show source


Question: What are the earliest and latest years in which works authored by Albert Einstein were published?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> select ( min ( year ( ?date ) ) as ?min_year ) ( max ( year ( ?date ) ) as ?max_year ) { values ?author { wd:Q937 } ?author ^ wdt:P50 / wdt:P577 ?date . }

Flourished dates


Question: Who are the distinct individuals who held the position of Massachusetts state senator, excluding those who served in the 1929-1930 Massachusetts legislature? Also, provide the count of their sitelinks if available.

SELECT distinct ?item ?linkcount with { select ?item where
{
  ?position wdt:P279* wd:Q20058776 . hint:Prior hint:gearing "forward".
  ?item p:P39 [ps:P39 ?position
                      ; pq:P2937 ?leg
                      ; wikibase:rank ?rank
              ] .           # position held: Massachusetts state senator
  filter ( ?leg not in (wd:Q96050576)) .
  filter (?rank != wikibase:DeprecatedRank)

} } as %i
where
{
  include %i
  ?item wdt:P793 wd:Q96050576 .                      # significant event: 1929 legislature
  ?item wdt:P31 wd:Q5 .                            # human
  OPTIONAL {?item wikibase:sitelinks ?linkcount .} # count of sitelinks
}

specify senators who served in a particular legislative term?


Question: How many people, grouped by their country of citizenship, have a Tabakalera ID and are part of the Arteleku collection?

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 ( COUNT ( ?ser_humano ) AS ?count ) ?paisLabel WHERE { ?ser_humano wdt:P31 wd:Q5 . ?ser_humano wdt:P27 ?pais . ?ser_humano p:P10069 ?statement . ?statement ps:P10069 ?Tabakalera_ID . ?statement pq:P195 wd:Q61070552 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } GROUP BY ?paisLabel

Filtering by Identifier's qualifiers


Question: What are the names, dates of birth (if available), and dates of death (if available) of female employees or former employees of the Bank of England?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?date_of_birth ?date_of_death WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } OPTIONAL { } ?item wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581072 . OPTIONAL { ?item wdt:P569 ?date_of_birth . } OPTIONAL { ?item wdt:P570 ?date_of_death . } ?item wdt:P108 wd:Q183231 . } LIMIT 1000

list all female employees  and those who have positions at the Bank of England


Question: What are the cities in Boulder County, Colorado, and what are their latest population, when and how was that population determined?

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 ?itemLabel ?population ?population_date ?population_methodLabel WHERE { ?item p:P31 / ps:P31 / wdt:P279 * wd:Q1093829 . ?county wdt:P131 wd:Q1261 . ?item wdt:P131 wd:Q113029 . ?item wdt:P131 ?county . ?county wdt:P131 ?state . OPTIONAL { ?item p:P1082 ?population_statement . ?population_statement ps:P1082 ?population . ?population_statement pq:P585 ?population_date . ?population_statement pq:P459 ?population_method . } FILTER NOT EXISTS { ?item p:P1082 / pq:P585 ?population_date_2 . FILTER ( ?population_date_2 > ?population_date ) } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }

Select first item in a list of attributes


Question: Which airport has the ICAO airport code "RJAA" and what place does it serve, along with their respective labels in English?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?airport ?airportLabel ?airportIn ?airportInLabel WHERE { ?airport wdt:P239 "RJAA" . { ?airport wdt:P931 ?airportIn . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }

Query to Obtain City of the Airport [SOLVED]


Question: What are the details of female individuals who have an Anime News Network person ID and work as a director, television director, anime director, or film director? Please include their names, all their occupations, date of birth (if available), and date of death (if available).

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?dateofbirth ?dateofdeath WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P21 wd:Q6581072 . ?item wdt:P1982 ?ANNid . { ?item wdt:P106 wd:Q3455803 } UNION { ?item wdt:P106 wd:Q2059704 } UNION { ?item wdt:P106 wd:Q11284414 } UNION { ?item wdt:P106 wd:Q2526255 } ?item wdt:P106 ?occupation OPTIONAL { ?item wdt:P569 ?dateofbirth . } OPTIONAL { ?item wdt:P570 ?dateofdeath . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ja" . ?occupation rdfs:label ?occupationLabel . ?item rdfs:label ?itemLabel . } } group by ?item ?itemLabel ?dateofbirth ?dateofdeath ?ANNid

Avoiding duplicates


Question: What are the distinct airports located in either Abkhazia (a Russian administrative division in Georgia) or the Republic of Abkhazia (a state with limited recognition in the Caucasus) that are considered to be aerodromes in Wikidata? Please provide their labels, and if available, their coordinates, ICAO airport codes, and IATA airport codes.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?airport ?airportLabel ( SAMPLE ( ?coord ) AS ?coord ) ?ICAO ?IATA WHERE { VALUES ?country { wd:Q23334 wd:Q31354462 } ?airport ( wdt:P31 / wdt:P279 * ) wd:Q62447 . ?airport wdt:P17 ?country . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]" . } OPTIONAL { ?airport wdt:P625 ?coord . } OPTIONAL { ?airport wdt:P239 ?ICAO . } OPTIONAL { ?airport wdt:P238 ?IATA . } } GROUP BY ?airport ?airportLabel ?ICAO ?IATA

Query not showing the good elements


Question: Which individuals have the same Transfermarkt ID for both player and manager roles and what are their IDs?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?id WHERE { ?item wdt:P2446 ?id ; wdt:P2447 ?id }

Identical external IDs


Question: Who are the individuals with Estonian citizenship who were born and died between January 1, 1941, and January 1, 1991?

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 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 DISTINCT ?item WHERE { ?item wdt:P27 wd:Q191 . ?item p:P569 / psv:P569 ?node_born . ?item p:P570 / psv:P570 ?node_dead . ?node_born wikibase:timeValue ?born . ?node_born wikibase:timePrecision ?precision_born . ?node_dead wikibase:timeValue ?dead . ?node_dead wikibase:timePrecision ?precision_dead . FILTER ( ?born >= "1941-01-01T00:00:00Z" ^^ xsd:dateTime ) FILTER ( ?born < "1991-01-01T00:00:00Z" ^^ xsd:dateTime ) FILTER ( ?dead >= "1941-01-01T00:00:00Z" ^^ xsd:dateTime ) FILTER ( ?dead < "1991-01-01T00:00:00Z" ^^ xsd:dateTime ) }

Wrong query


Question: Which items have an Elo rating, along with the Elo rating value and two different points in time associated with that rating, where the first point in time is earlier than the second point in time?

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 ?elo ?pit1 ?pit2 WHERE { ?item p:P1087 [ ps:P1087 ?elo ; pq:P585 ?pit1 ; pq:P585 ?pit2 ] . FILTER ( ?pit1 < ?pit2 ) . }

Elo ratings with two `point in time (P585)`


Question: How many individuals are there who have a Munzinger person ID but do not have a GND ID?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ( COUNT ( ?item ) AS ?count ) { ?item wdt:P31 wd:Q5 . ?item wdt:P1284 [] . MINUS { ?item wdt:P227 [] . } }

Munzinger person ID but GND missing


Question: What are the movies in which both Brad Pitt and Leonardo DiCaprio appear together?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?movie ?movieLabel { ?movie wdt:P31 / wdt:P279 * wd:Q11424 . ?movie wdt:P161 wd:Q35332 . ?movie wdt:P161 wd:Q38111 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

List of Common movies between 2 actors


Question: What are the dams located in Cyprus?

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:P17 wd:Q229 . ?item wdt:P31 / wdt:P279 * wd:Q12323 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Dams


Question: How many people were awarded the title of International Master by a chess federation in the year 1995?

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 ( COUNT ( * ) AS ?cnt ) WHERE { ?item p:P2962 [ ps:P2962 wd:Q752119 ; pq:P580 ?start ] . FILTER ( YEAR ( ?start ) = 1995 ) . }

Number of International Masters awarded per year


Question: What are the distinct municipalities in Quebec that are either local municipalities of Quebec or unorganized areas of Canada? These municipalities should be located within Quebec, should not have a Banque de noms de lieux du Québec ID, and should not have been dissolved, abolished, demolished, or has ended.

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 ?municip ?municipLabel ?statutLabel ?mrcLabel ?regionLabel WHERE { ?municip p:P31 ?statement . { ?statement ps:P31 / wdt:P279 * wd:Q3327873 } union { ?statement ps:P31 wd:Q3518810 } FILTER NOT EXISTS { ?statement pq:P582 ?pqfin . } ?municip wdt:P31 ?statut . ?municip wdt:P131 ?mrc . ?mrc wdt:P131 ?region . ?region wdt:P131 wd:Q176 . Optional { ?municip wdt:P2100 ?ctq . } FILTER NOT EXISTS { ?municip wdt:P2100 ?x } FILTER NOT EXISTS { ?municip wdt:P576 ?dissolu } FILTER NOT EXISTS { ?municip wdt:P582 ?end } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" , "fr" . } } ORDER BY ?regionLabel ?mrcLabel ?municipLabel LIMIT 1000

Qualifier in FILTER NOT EXISTS


Question: Which disasters, classified as hazards causing significant physical damage, destruction, or death, began on a Friday the 13th? Please provide their start times as well.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?disaster ?disasterLabel ?start_time WHERE { ?disaster wdt:P31 / wdt:P279 * wd:Q3839081 ; wdt:P580 ?start_time . BIND ( DAY ( ?start_time ) AS ?q ) . FILTER ( ?q = 13 ) . BIND ( MONTH ( ?start_time ) + IF ( MONTH ( ?start_time ) < 3 , 12 , 0 ) AS ?m ) . BIND ( YEAR ( ?start_time ) - IF ( MONTH ( ?start_time ) < 3 , 1 , 0 ) AS ?_year ) . BIND ( ?_year - FLOOR ( ?_year / 100 ) * 100 AS ?K ) . BIND ( FLOOR ( YEAR ( ?start_time ) / 100 ) AS ?J ) . BIND ( ?q + FLOOR ( 13 * ( ?m + 1 ) / 5 ) + ?K + FLOOR ( ?K / 4 ) + FLOOR ( ?J / 4 ) - 2 * ?J AS ?_h ) . FILTER ( ?_h - FLOOR ( ?_h / 7 ) * 7 = 6 ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . }

Disasters starting on Friday 13


Question: The number of members in the British House of Commons (House of Commons (Q11005)) varies as members may resign or die and vacancies are filled by by-elections. Find the smallest, largest number of members in the year 2021 and the average number of members for the whole year.

SELECT (sum(?count) / 365 as ?count2) (min(?count) as ?mincount) (max(?count) as ?maxcount)
WITH {
  SELECT ?item ?date WHERE {
  ?item wdt:P31 wd:Q47150325.
  ?item wdt:P585 ?date . hint:Prior hint:rangeSafe true.
  filter("2021-01-01"^^xsd:dateTime <= ?date && ?date < "2022-01-01"^^xsd:dateTime )
} } as %dates
WITH {
  SELECT ?date (count(?MP) as ?count) WHERE {
  INCLUDE %dates
  ?MP p:P39 ?stat .
  ?stat ps:P39 wd:Q77685926.
  filter not exists {?stat pq:P580 ?start . filter(?start > ?date ) }
  filter not exists {?stat pq:P582 ?end . filter(?end < ?date ) }
  filter not exists {
    ?stat pq:P582 ?endt .
    ?MP p:P39 ?stat2 .
    ?stat2 ps:P39 wd:Q77685926.
    ?stat2 pq:P580 ?endt .
    filter(str(?stat2) != str(?stat))
    filter(?endt = ?date)
    }
} group by ?date } as %counts
WHERE
{
INCLUDE %counts

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by desc(?date)

Submission from Infrastruktur


Question: How many distinct items were published between January 1, 1700, and December 31, 1799, in the municipalities of Bilbao, San Sebastián, Tolosa, and Vitoria-Gasteiz?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ( count ( DISTINCT ?item ) as ?count ) WHERE { VALUES ?place { wd:Q8692 wd:Q10313 wd:Q497801 wd:Q14318 } ?item wdt:P291 ?place . ?item wdt:P577 ?publishing_date . FILTER ( ?publishing_date >= "1700-01-01" ^^ xsd:dateTime && ?publishing_date <= "1799-12-31" ^^ xsd:dateTime ) BIND ( YEAR ( ?publishing_date ) as ?year_ ) }

Get bubble chart based on the number of printed matter published each year


Question: How many current board members, grouped by their gender, for organizations that are part of the DAX index? Only include the best avaialble gender.

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 ?gender ?genderLabel ( COUNT ( ?board_member ) AS ?count ) { wd:Q155718 wdt:P527 ?item . ?item p:P3320 ?board_member_statement . ?board_member_statement a wikibase:BestRank . ?board_member_statement ps:P3320 ?board_member . FILTER NOT EXISTS { ?board_member_statement pq:P582 [] . } ?board_member wdt:P21 ?gender . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en" . } } GROUP BY ?gender ?genderLabel

Gender breakdown of organizations (that are "part of" bigger organizations)?


Question: Among Pablo Picasso, Salvador Dalí, and NASA, filter those that are humans. Then group by their sex or gender. The response should be a list, containing how many are for which gender.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?genderLabel ( COUNT ( DISTINCT ?person ) AS ?number ) WHERE { VALUES ?person { wd:Q5593 wd:Q23548 wd:Q5577 } ?person wdt:P31 wd:Q5 ; wdt:P21 ?gender . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?gender rdfs:label ?genderLabel . } } GROUP BY ?gender ?genderLabel

Find the today's featured article or a range (from the start to today for example)


Question: What are the details of each tennis tournament edition that is part of the 1990 WTA Tour? Include the year, start time, end time, country, surface played on, location, and prize money, all if available.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?y ?start ?end ?countryLabel ?surfaceLabel ?locationLabel ?prize WHERE { ?item wdt:P31 wd:Q47345468 ; wdt:P361 wd:Q1134303 . OPTIONAL { ?item wdt:P585 ?y0 . BIND ( YEAR ( ?y0 ) as ?y ) } OPTIONAL { ?item wdt:P580 ?start . } OPTIONAL { ?item wdt:P582 ?end . } OPTIONAL { ?item wdt:P17 ?country . } OPTIONAL { ?item wdt:P765 ?surface . } OPTIONAL { ?item wdt:P276 ?location . } OPTIONAL { ?item wdt:P2121 ?prize } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

1990 WTA Tour


Question: What are the galleries, libraries, archives, and museums in Germany, along with types (e.g., are they mesumes, libraries, visitor centers?) and types, excluding those operated by businesses?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?GLAM ?GLAMLabel ?Betreiber ?BetreiberLabel ?ist_ein_e_ ?ist_ein_e_Label WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?GLAM ( wdt:P31 / wdt:P279 * ) wd:Q1030034 . ?GLAM wdt:P137 ?Betreiber . ?GLAM wdt:P17 wd:Q183 . MINUS { ?Betreiber wdt:P31 wd:Q4830453 . } ?GLAM wdt:P31 ?ist_ein_e_ . }

GLAMs in Germany that are publicly funded


Question: How many people are in each district located in the town of Kremmen, Germany year-by-year? In other words, in your response, include the year, district, and the population for each tuple.

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 ( str ( YEAR ( ?pointInTime ) ) AS ?Jahr ) ?Einwohnerzahl ?OrtsteilLabel ?Ortsteil WHERE { ?Ortsteil wdt:P131 ? wd:Q587094 . ?Ortsteil p:P1082 ?populationStatement . ?populationStatement ps:P1082 ?Einwohnerzahl . ?populationStatement pq:P585 ?pointInTime . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Area chart of populations compared


Question: What are the emergency phone numbers in each country, along with the main uses of these numbers (if available), ordered by country and phone number? Return for each county, their emergency number and, if available, the main uses of that number

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?country ?number ?use WHERE { ?country p:P2852 ?p2852stm . ?p2852stm ps:P2852 ?number . OPTIONAL { ?p2852stm pq:P366 ?use } } ORDER BY ?countryLabel ?numberLabel

Why some optional "?use" values show up but not others?


Question: What are the pairs of siblings who have a male parent with Japanese citizenship, are born less than 300 days apart, and are not twins (i.e., not born on the same day)? Also return for each pair, their birthdays

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 ?child1 ?child1Label ?birth1 ?child2 ?child2Label ?birth2 WHERE { ?parent wdt:P31 wd:Q5 . ?parent wdt:P21 wd:Q6581097 . ?parent wdt:P40 ?child1 . ?parent wdt:P40 ?child2 . ?parent wdt:P27 wd:Q17 FILTER ( ?child1 != ?child2 ) ?child1 p:P569 ?birth1_statement . ?birth1_statement psv:P569 ?birth1_value . ?birth1_value wikibase:timePrecision 11 . ?birth1_value wikibase:timeValue ?birth1 . ?child2 p:P569 ?birth2_statement . ?birth2_statement psv:P569 ?birth2_value . ?birth2_value wikibase:timePrecision 11 . ?birth2_value wikibase:timeValue ?birth2 . FILTER ( ?birth1 < ?birth2 && ?birth2 - ?birth1 < 300 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Siblings with close dates of birth


Question: Who are people with occupations that are subclasses of "journalist" (but excluding those with only "journalist" as their occupation), ordered by the item labels, with a limit of 100 results? Return also their occupations

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?occ WHERE { ?item wdt:P106 ?occ . ?occ wdt:P279 * wd:Q1930187 . filter ( ?occ not in ( wd:Q1930187 ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY ?itemLabel LIMIT 100

obtain label of subclasses of the selection, while excluding the starting class


Question: What are the publications or printed materials published between January 1, 1700, and December 31, 1799 (both inclusive), in Bilbao, San Sebastián, Tolosa, Vitoria-Gasteiz, Pamplona, or Bayonne? Please provide their labels, coordinates of the place of publication, and publication dates.

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 ?label ?coord ?place ?argitaratze_data WHERE { VALUES ?type { wd:Q732577 wd:Q1261026 } ?item wdt:P31 / wdt:P279 * ?type ; wdt:P577 ?argitaratze_data . FILTER ( ( ?argitaratze_data >= "1700-01-01" ^^ xsd:dateTime ) && ( ?argitaratze_data <= "1799-12-31" ^^ xsd:dateTime ) ) VALUES ?place { wd:Q8692 wd:Q10313 wd:Q497801 wd:Q14318 wd:Q10282 wd:Q134674 } ?item wdt:P291 ?place . ?place wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,eu" . } }

Repeated items in the results


Question: Who have resided in Paris, including their start and end times of residence if available, where the residence period includes or overlaps with the month of September 1977, ordered by the start time?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 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 ?entity ?entityLabel ?starttime ?endtime where { ?entity wdt:P31 wd:Q5 . ?entity p:P551 ?statement . ?statement ps:P551 wd:Q90 . OPTIONAL { ?statement pq:P580 ?starttime . } OPTIONAL { ?statement pq:P582 ?endtime . } FILTER ( ( ?starttime <= "1977-09-01" ^^ xsd:dateTime && "1977-10-01" ^^ xsd:dateTime <= ?endtime ) || ( "1977-09-01" ^^ xsd:dateTime <= ?starttime && ?starttime <= "1977-10-01" ^^ xsd:dateTime ) || ( "1977-09-01" ^^ xsd:dateTime <= ?endtime && ?endtime <= "1977-10-01" ^^ xsd:dateTime ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?entity ?entityLabel ?starttime ?endtime ORDER BY ?starttime

How to remove duplicate query results (based on the values of the results)?


Question: What are the distinct frigates that have at least two different operators and do not have an official name qualifier associated with each operator? Please provide their labels as well.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 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 distinct ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q161705 . ?item wdt:P137 ?operator1 . ?item wdt:P137 ?operator2 . filter ( str ( ?operator1 ) != str ( ?operator2 ) ) filter not exists { ?item p:P1448 / pq:P137 ?operator1 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]" . } } order by ?itemLabel

Ships with multiple operators that do not have multiple official names


Question: Who are the recipients of the Honda Sports Award and their alma maters (if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?person ?school WHERE { ?person wdt:P166 / wdt:P31 wd:Q5892712 . OPTIONAL { ?person wdt:P69 ?school . ?school wdt:P31 / wdt:P279 * wd:Q38723 . } }

Honda Sports Award alma mater


Question: What are the books or literary works published after January 1, 1980, has an English label, originating from Italy? Include their titles and authors' names in their native language. In addition, for each one, count the number of other entities that have an edge pointing towards it.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 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 ?label ?authorlabel ( COUNT ( ?anotherItem ) AS ?inbound_links ) WHERE { VALUES ?type { wd:Q571 wd:Q7725634 } ?item wdt:P31 ?type ; wdt:P577 ?date ; wdt:P50 ?author . ?author wdt:P1559 ?authorlabel . FILTER ( ( LANG ( ?label ) ) = "en" ) FILTER ( ?date > "1979-01-01T00:00:00Z" ^^ xsd:dateTime ) ?item rdfs:label ?label . FILTER ( ( LANG ( ?label ) ) = "en" ) ?item wdt:P495 wd:Q38 . OPTIONAL { ?anotherItem ?predicate ?item . ?property wikibase:directClaim ?predicate . } } GROUP BY ?item ?label ?authorlabel

Number of links of "what links here" in Wikipedia for Italian Books 1980-2021


Question: Which items have a identifier for the Enciclopedia Italiana on Treccani website with an author qualifier, excluding those authored by Goffredo Coppola?

PREFIX wd: <http://www.wikidata.org/entity/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT DISTINCT ?item WHERE { ?item p:P4223 ?ei . ?ei pq:P50 ?author . FILTER ( ?author != wd:Q3772798 ) }

Check on multiple qualifiers


Question: What are the films shot in Georgia, USA, and who are their cast members?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?film ?filmLabel ?castmember ?castmemberLabel WHERE { ?film wdt:P31 wd:Q11424 . ?film wdt:P915 / wdt:P131 * wd:Q1428 . ?film wdt:P161 ?castmember . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } . }

Query to identify the [[Property:`cast member (P161)`|actors who were in]] [[`film (Q11424)`|films]] [[Property:`filming location (P915)`|shot in]] [[`Category:Films shot in Georgia (U.S. state) (Q7140743)`|Georgia]].


Question: Who are the writers that were either born or died in the canton of Vaud? Also return their birthplaces and death places.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?ecrivain ?ecrivainLabel ?lieuNaissance ?lieuMort WHERE { ?ecrivain wdt:P31 wd:Q5 . ?ecrivain wdt:P106 wd:Q36180 . { ?ecrivain wdt:P19 ?lieuNaissance . ?lieuNaissance wdt:P131 wd:Q12771 . } UNION { ?ecrivain wdt:P20 ?lieuMort . ?lieuMort wdt:P131 wd:Q12771 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr" . } } ORDER BY ?ecrivainLabel

Remove Duplicate


Question: What are the taxa within the phylum Echinodermata, including all levels of parent taxa, along with their labels and taxon ranks, ordered by their english label alphabetically and select the top 100?

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

`Echinodermata (Q44631)`


Question: What are the scholarly articles published in the peer-reviewed open-access journal ZooKeys in 2018, including their publication dates, and if available, their Wikimedia Commons categories and links to their Wikimedia Commons pages? Order results by their publication dates from oldest to newest.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?date ?commonscat WHERE { ?item wdt:P1433 wd:Q219980 ; wdt:P577 ?date ; wdt:P31 wd:Q13442814 . FILTER ( YEAR ( ?date ) = 2018 ) . OPTIONAL { ?item wdt:P373 ?commonscat } SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' } } ORDER BY ASC ( ?date )

Scholarly articles with images on Commons


Question: How many humans in Wikidata are identified as non-binary, intersex, trans woman, or trans man, along with their respective labels?

SELECT ?sex ?sexLabel ?count
WITH
{
    SELECT ?sex (COUNT(?human) AS ?count)
    WHERE
    {
        ?human wdt:P31 wd:Q5.
        ?human wdt:P21 ?sex.
       VALUES ?sex {wd:Q48270 wd:Q1097630 wd:Q1052281 wd:Q2449503}.
    }
    GROUP BY ?sex
} AS %results
WHERE
{
    INCLUDE %results.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

how many trans-people in Wikidata?


Question: Who are citizens of Norway that have held a position as a teacher or a subclass of teacher, along with their labels, dates of birth (if available), and Norwegian historical register of persons IDs (if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?P569 ?P4574 WHERE { ?item wdt:P27 wd:Q20 . ?item wdt:P39 / wdt:P279 * wd:Q37226 . OPTIONAL { ?item wdt:P569 ?P569 . } OPTIONAL { ?item wdt:P4574 ?P4574 . } }

List of teachers and the Querybuilder


Question: What are the scholarly articles that have an author with a series ordinal of "1000", and what is the highest series ordinal value for each of these articles, ordered by the highest series ordinal value in descending order? So, the answer should be article 1 has the highest ordinal of 5000, article 2 has the highest ordinal of 4000, etc.

SELECT ?paper ?paperLabel ?count
WITH {
  SELECT ?paper WHERE {
     ?paper wdt:P31 wd:Q13442814.
     ?paper p:P2093/pq:P1545 "1000" .
  }
} AS %papers
WITH {
  SELECT ?paper (MAX(xsd:integer(?val)) AS ?count) WHERE {
     INCLUDE %papers .
     ?paper p:P2093/pq:P1545 ?val .
  } GROUP BY ?paper
} AS %author_count
WHERE {
   INCLUDE %author_count .
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count)

Papers with the most authors


Question: What are the films that have won the Academy Award for Best Picture, with only those that have a theatrical version length listed on Wikidata? For each such film, also include its director (if available) and duration (if available).

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 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 ?filmLabel ?duration ?film WHERE { ?film wdt:P31 wd:Q11424 . ?film wdt:P166 wd:Q102427 . OPTIONAL { ?film wdt:P57 ?director . } OPTIONAL { ?film p:P2047 ?durationStatement . } OPTIONAL { ?durationStatement ps:P2047 ?duration . } ?durationStatement a wikibase:BestRank . OPTIONAL { ?durationStatement pq:P518 ?version . } FILTER ( CONTAINS ( ?versionLabel , "theatrical" ) ) . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?film rdfs:label ?filmLabel . ?version rdfs:label ?versionLabel . } } ORDER BY ( ?filmLabel )

Select theatrical version if version label is available


Question: Who are the actresses that have won either the Academy Award for Best Supporting Actress or the Academy Award for Best Actress? Return a a tuple of the actress, the actress's IMBD ID (if available), the associated movie, and the associated movie's IMBD ID (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 ?actor ?actor_IMBD ?movie ?movie_IMBD { VALUES ?award { wd:Q106301 wd:Q103618 } { ?actor p:P166 ?award_statement . ?award_statement ps:P166 ?award . ?award_statement pq:P1686 ?movie . } UNION { ?movie p:P166 ?award_statement . ?award_statement ps:P166 ?award . ?award_statement pq:P1346 ?actor . } OPTIONAL { ?movie wdt:P345 ?movie_IMBD . } OPTIONAL { ?actor wdt:P345 ?actor_IMBD . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

All movies that won the awards


Question: Which items have a sibling who shares the same date of birth, but the sibling does not have a reciprocal sibling relationship back to the item? Return the item and their sibliing in each tuple, and no duplicate tuples.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT DISTINCT ?item ?itemLabel ?sibling ?siblingLabel WHERE { ?item wdt:P3373 ?sibling . ?item wdt:P569 ?dob . ?sibling wdt:P569 ?dob . filter not exists { ?sibling wdt:P3373 ?item . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Twins with different place of birth


Question: What are the cities that are considered to be urban municipalities in Germany, independent cities of Germany, district capitals, Greater district towns, large district towns, large independent cities of Lower Saxony, or medium-sized district towns (in Germany)? Only return those that are still currently considered so (i.e., no end time qualifier). Return the city and the start date (if available) it is considered to be of that status.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 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 distinct ?item ?itemLabel ?urban_municipality_rankLabel ?start_date ?end_date WHERE { VALUES ?type { wd:Q42744322 wd:Q22865 wd:Q134626 wd:Q448801 wd:Q1548518 wd:Q1548525 wd:Q54935786 } ?item p:P31 / p:P279 * ?statement . ?statement ps:P31 ?type . optional { ?statement pq:P580 ?start_date . } optional { ?statement pq:P582 ?end_date . } filter not exists { ?statement pq:P582 ?end_date . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by ?itemLabel

Data issue discussion


Question: Who are composers that have lived in either Los Angeles or New York City? For each composer, determine whether they lived longer in LA or NYC. Return a list of 3-tuples in your response, consisting of: (the composer, x, y) where x should be "LA" if they lived in LA longer and empty if they lived in "NYC" longer, similar for y. So, for instance, if composer "Olivia Rodrigo" lived in NYC longer, you should return (Olivia Rodrigo, "", "NYC"), and they lived in LA longer then you should return (Olivia Rodrigo, "LA", "")

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?composer ?composerLabel ( MAX ( ?LA ) AS ?Los_Angelses ) ( MAX ( ?NYC ) AS ?New_York ) WHERE { VALUES ?residence { wd:Q65 wd:Q60 } ?composer wdt:P31 wd:Q5 . ?composer wdt:P106 / wdt:P279 * wd:Q36834 . ?composer wdt:P551 / wdt:P131 * ?residence . BIND ( IF ( ?residence = wd:Q65 , "LA" , "" ) AS ?LA ) BIND ( IF ( ?residence = wd:Q60 , "NYC" , "" ) AS ?NYC ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } GROUP BY ?composer ?composerLabel

List composers residences


Question: What are the items that are either located in Argentona, have Argentona as their place of birth, place of death, or residence?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?Argentona WHERE { { ?Argentona wdt:P131 wd:Q11539 } union { ?Argentona wdt:P19 wd:Q11539 } union { ?Argentona wdt:P20 wd:Q11539 } union { ?Argentona wdt:P551 wd:Q11539 } }

multiple querrys in one


Question: Which nonprofit organizations had a total revenue in 2017? Please include the organization's name, the revenue amount, the unit of the revenue, and the specific point in time.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 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 ?revenue ?unitLabel ?time WHERE { ?item wdt:P31 / wdt:P279 * wd:Q163740 . ?item p:P2139 ?stat . ?stat psv:P2139 / wikibase:quantityAmount ?revenue . ?stat psv:P2139 / wikibase:quantityUnit ?unit . ?stat pq:P585 ?time . FILTER ( "2017-00-00" ^^ xsd:dateTime <= ?time && ?time < "2018-00-00" ^^ xsd:dateTime ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

All NGOs with revenue in 2017


Question: What are the distinct border checkpoints that are part of the Schengen Area border, excluding those that have been dissolved, are part of an open border, a maritime boundary, the Inner German border, or air borders? Please include their labels and coordinates, if available.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?item ?itemLabel ?coord WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?item wdt:P31 wd:Q757292 . ?item wdt:P361 * / wdt:P31 / wdt:P279 * wd:Q67371697 . MINUS { ?item wdt:P576 _:b2 . } MINUS { ?item wdt:P361 wd:Q17163396 . } MINUS { ?item wdt:P361 wd:Q3089219 . } MINUS { ?item wdt:P361 wd:Q700754 . } MINUS { ?item wdt:P361 wd:Q67218438 . } OPTIONAL { ?item wdt:P625 ?coord . } }

Time out


Question: Which taxa have been described by the New Zealand radio programme "Critter of the Week" that also have a common name in English? Each taxon should also be itself a class or has a parent (can be recursive) that is a class. Include in each tuple the taxon, (one of) its English common name, and the taxon that is a class.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?taxon_common_name ?parent ?parentLabel WHERE { ?item wdt:P1343 wd:Q58450498 ; wdt:P1843 ?taxon_common_name . ?item wdt:P171 * ?parent . ?parent wdt:P105 wd:Q37517 . FILTER ( langMatches ( lang ( ?taxon_common_name ) , "en" ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Taxonomic class for Critter of the Week


Question: What are the different occupations of individuals who have a Vatican Library VcBA ID, and how many distinct individuals are there for each occupation, ordered by the count in descending order?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?type ( COUNT ( DISTINCT ?item ) AS ?count ) WHERE { ?item wdt:P8034 ?id . ?item wdt:P106 ?occ . BIND ( ?occ AS ?type ) } GROUP BY ?type ORDER BY DESC ( ?count )

Group minor results


Question: What are the Wikidata properties related to politics that are also used as identifiers?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?Wikidata_egenskap_knyttet_til_politikk ?Wikidata_egenskap_knyttet_til_politikkLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?Wikidata_egenskap_knyttet_til_politikk wdt:P31 wd:Q22984475 . ?Wikidata_egenskap_knyttet_til_politikk wdt:P31 wd:Q19847637 }

Wikidata property related to politics


Question: What are the bunkers located within a 30 km radius around the Gravesend Cold War Bunker?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { { SELECT DISTINCT ?item WHERE { wd:Q26676412 wdt:P625 ?targetLoc . SERVICE wikibase:around { ?item wdt:P625 ?location . bd:serviceParam wikibase:center ?targetLoc . bd:serviceParam wikibase:radius "30" . bd:serviceParam wikibase:distance ?dist . } ?item wdt:P31 / wdt:P279 * wd:Q91122 . } } }

wikibase:around not including itself


Question: Which universities located in Berlin were founded before 1890, excluding those that were dissolved, abolished, or demolished before 1890? Please include their founding dates.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?university ?founded WHERE { { { SELECT DISTINCT ?subclass { ?subclass wdt:P279 * wd:Q3918 } } } . ?university wdt:P131 + wd:Q64 ; wdt:P31 ?subclass ; wdt:P571 ?founded . FILTER ( YEAR ( ?founded ) < 1890 ) . MINUS { ?university wdt:P576 ?date . FILTER ( YEAR ( ?date ) < 1890 ) . } . }

Universities that existed in Berlin in 1890


Question: What are the items listed on the National Heritage List for England that have a label containing the word "cinema" (case insensitive) but are not instances of a movie theater?

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:P1216 [] . ?item rdfs:label ?itemLabel . FILTER ( CONTAINS ( LCASE ( ?itemLabel ) , "cinema" @en ) ) . MINUS { ?item wdt:P31 wd:Q41253 } . }

Description containing a certain word


Question: What are the headquarters locations of the companies Apple, Amazon, Microsoft, Meta, and Google, including the cities, specific location if available (e.g. Apple Park), and states in the United States where these headquarters are located? Include in your response for each company, its specific location (if available), the city, and the state.

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 ?company ?location ?city ?state WHERE { VALUES ?company { wd:Q312 wd:Q3884 wd:Q2283 wd:Q380 wd:Q95 } ?company p:P159 ?HQ_statement . ?HQ_statement ps:P159 ?city . OPTIONAL { ?HQ_statement pq:P276 ?location . } ?city wdt:P131 + ?state . ?state wdt:P31 wd:Q35657 . } GROUP BY ?company ?location ?city ?state ORDER BY ASC ( ?company )

Access Wikidata property qualifiers


Question: Who are the current members of the European Union, ordered by their names in English?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 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:P463 ?stm . ?stm ps:P463 wd:Q458 . MINUS { ?stm pq:P582 [] . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by ( ?itemLabel )

Member of EU (without UK)


Question: What are the names and dates of birth of individuals who have held the position of Pope, ensuring that the dates of birth are precise to the day?

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 ?dob WHERE { ?item wdt:P39 wd:Q19546 . ?item p:P569 ?dob_statement . ?dob_statement psv:P569 ?dob_value . ?dob_value wikibase:timeValue ?dob . ?dob_value wikibase:timePrecision 11 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Excluding imprecise dates from the results


Question: What are the villages within a 27 km radius from the village of Półwsie in Lower Silesian, Poland, including their coordinates?

#Display villages within the specific radius from a specific place

SELECT ?place ?location WITH {
  SELECT ?place ?location {
  wd:Q7264829 wdt:P625 ?polvillLoc .
  SERVICE wikibase:around {
    ?place wdt:P625 ?location.
    bd:serviceParam wikibase:center ?polvillLoc;
      wikibase:radius "27".
  }
  ?place wdt:P31 wd:Q3558970 .
 }
 } AS %i WHERE {
  include %i
}

Limit coordinates and link to Wikipedia


Question: What are the items described at a URL containing "https://www.flickr.com/" that do not have an associated image?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?url WHERE { ?item wdt:P973 ?url . optional { ?item wdt:P18 ?image . } filter ( bound ( ?image ) = false ) filter ( contains ( str ( ?url ) , "https://www.flickr.com/" ) ) }

Write a query for me please


Question: What are the details of sculptors associated with the Art Nouveau movement? Additionally, provide their gender (if available), occupation (if available), image (if available), place of birth (if available), and date of birth (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?gender ?image ?place ?date ?profession WHERE { ?item wdt:P106 wd:Q1281618 ; wdt:P135 wd:Q34636 . OPTIONAL { ?item wdt:P21 ?gender . } OPTIONAL { ?item wdt:P18 ?image . } OPTIONAL { ?item wdt:P19 ?place . } OPTIONAL { ?item wdt:P569 ?date . } OPTIONAL { ?item wdt:P106 ?profession . } }

Female form of label


Question: Who are the female science fiction writers and/or those associated with the science fiction genre, who either have German as their native language, speak or write German, are citizens of Germany (including the German Democratic Republic, West Germany, or Nazi Germany), and/or were born in a place located within these regions? For each person, return also their dates of birth and death (both if available), then Order the list alphabetically by name.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?person ?personLabel ?dob ?dod WHERE { ?person wdt:P31 wd:Q5 . ?person wdt:P21 wd:Q6581072 . { ?person wdt:P106 wd:Q18844224 } union { ?person wdt:P136 / wdt:P279 * wd:Q24925 . } { ?person wdt:P103 wd:Q188 . } union { ?person wdt:P1412 wd:Q108 . } union { ?person wdt:P27 ?Germanish . } union { ?person wdt:P19 / wdt:P131 * ?Germanish . } VALUES ?Germanish { wd:Q183 wd:Q16957 wd:Q713750 wd:Q7318 } optional { ?person wdt:P569 ?dob } optional { ?person wdt:P570 ?dod } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by ?personLabel

Female German-language science-fiction writers


Question: What are the details of astronauts, including their name, country of citizenship, astronaut mission, time in space, date of birth, and start of their work period, if available?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?nombre ?pa_s_de_nacionalidad ?misi_n_del_astronauta ?premio_recibido ?fecha_de_nacimiento ?inicio_del_periodo_de_actividad WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P106 wd:Q11631 . OPTIONAL { ?item wdt:P2561 ?nombre . } OPTIONAL { ?item wdt:P27 ?pa_s_de_nacionalidad . } OPTIONAL { ?item wdt:P450 ?misi_n_del_astronauta . } OPTIONAL { ?item wdt:P2873 ?premio_recibido . } OPTIONAL { ?item wdt:P569 ?fecha_de_nacimiento . } OPTIONAL { ?item wdt:P2031 ?inicio_del_periodo_de_actividad . } }

astronautas


Question: Which libraries are located in the region of Abruzzo?

SELECT ?item with
{ select ?item where
  {
    ?item (wdt:P131/wdt:P131*) wd:Q1284.
   }
} as %i where
{
  include %i
?item (wdt:P31/wdt:P279*) wd:Q7075.
}

List of libraries by region


Question: Who are the individuals with the family name "Walker" whose occupation is either a drawer, engraver, or printmaker, including dates of birth and dates of death (if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?date_of_birth ?date_of_death WHERE { VALUES ?occupation { wd:Q15296811 wd:Q329439 wd: wd:Q11569986 } ?item wdt:P31 wd:Q5 . ?item wdt:P106 / wdt:P279 * ?occupation . { ?item wdt:P734 wd:Q1158605 . } OPTIONAL { ?item wdt:P569 ?date_of_birth . } OPTIONAL { ?item wdt:P570 ?date_of_death . } }

Draughtsmen and Engravers called A. Walker or W. Walker


Question: Select 10 video games ordered by item ID, and list their platform and genre.

SELECT ?item ?platform ?genre with {
  SELECT ?item WHERE
  {
    ?item wdt:P31 wd:Q7889 .
  } ORDER BY ?item LIMIT 10 } as %i
WHERE
{
  include %i
  ?item wdt:P400 ?platform.
  ?item wdt:P136 ?genre.
}

Get all release dates, platforms, genres, etc. for a video game in one query


Question: What are the characters that are part of the English alphabet, along with their Unicode characters and Unicode character statements, excluding those that have a Unicode code point qualifier?

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 ?unicode_character ?unicode_character_statement WHERE { ?item wdt:P361 wd:Q754673 . ?item p:P487 ?unicode_character_statement . ?unicode_character_statement ps:P487 ?unicode_character . MINUS { ?unicode_character_statement pq:P4213 [] . } }

Items satisfying one property statement, but not having one qualifier


Question: Who has held the position of Director of the Scuola Normale Superiore? If available, Please provide their years of birth, years of death, start years of the position, end years of the position, and Treccani IDs.

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 ?birthyear ?deadyear ?startyear ?endyear ?trec WHERE { ?item wdt:P39 wd:Q41210386 . ?item p:P39 ?position . ?position ps:P39 wd:Q41210386 . OPTIONAL { ?item wdt:P569 ?db . } OPTIONAL { ?item wdt:P570 ?dd . } OPTIONAL { ?position pq:P580 ?st . } OPTIONAL { ?position pq:P582 ?en . } OPTIONAL { ?item wdt:P3365 ?trec . } BIND ( str ( YEAR ( ?db ) ) AS ?birthyear ) BIND ( str ( YEAR ( ?dd ) ) AS ?deadyear ) BIND ( str ( YEAR ( ?st ) ) AS ?startyear ) BIND ( str ( YEAR ( ?en ) ) AS ?endyear ) }

Directors of the Scuola Normale Superiore


Question: Which countries have never had a citizen or sports representative who participated in an event and received an Olympic medal? Exclude historical countries and countries that were dissolved, abolished, or demolished before 1896.

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 ?country WHERE { ?country wdt:P31 wd:Q7275 . MINUS { ?country wdt:P31 wd:Q3024240 } . MINUS { ?country wdt:P576 ?date . FILTER ( YEAR ( ?date ) < 1896 ) . } . MINUS { ?person ( wdt:P27 | wdt:P1532 ) ?country ; p:P1344 / pq:P166 / wdt:P279 * wd:Q636830 . } . }

Countries that have never won a medal at the Olympics


Question: Get the items and English item labels that are instances or subclasses of a type of sport, along with a single (maximum-valued) image, if available.

SELECT ?item ?image ?label WITH {
  SELECT ?item (MAX(?p18) AS ?image) {
    ?item wdt:P31/wdt:P279* wd:Q31629 .
    OPTIONAL { ?item wdt:P18 ?p18 } .
  } GROUP BY ?item
} AS %subquery WHERE {
  INCLUDE %subquery .
  ?item rdfs:label ?label .
  FILTER ( LANG( ?label ) = "en" ) .
}

Search for with subclass depth, first image and return labels in all languages


Question: What are the items that are instances of structures such as buildings, hospitals, theatre buildings, sculptures, restaurants, commemorative plaques, metro stations, gardens, houses, main libraries, private educational institutions in Catalonia, hotels, church buildings, historic buildings, EADA Business School, movie theaters, Catalonia schools, Catalonia Institutes, bookstores, Catholic church buildings, libraries, fountains, or art galleries, and are located within a combined distance of less than 2.54 units from both the coordinates of Espina del mar and Port. Inauguració bocana nord?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> PREFIX geof: <http://www.opengis.net/def/function/geosparql/> SELECT ?item WHERE { VALUES ?inst { wd:Q41176 wd:Q16917 wd:Q24354 wd:Q860861 wd:Q11707 wd:Q721747 wd:Q928830 wd:Q1107656 wd:Q3947 wd:Q12317349 wd:Q111594067 wd:Q27686 wd:Q16970 wd:Q35112127 wd:Q1273818 wd:Q41253 wd:Q111236457 wd:Q50359544 wd:Q200764 wd:Q1088552 wd:Q7075 wd:Q483453 wd:Q1007870 } . ?item wdt:P31 ?inst . ?item wdt:P625 ?coord . wd:Q99509385 wdt:P625 ?focus1 . wd:Q113663833 wdt:P625 ?focus2 . BIND ( geof:distance ( ?coord , ?focus1 ) + geof:distance ( ?coord , ?focus2 ) as ?d ) . FILTER ( ?d < 2.54 ) . }

Addition that work in PetScan


Question: What are the population, male population, and female population of Sankt Andreasberg at different points in time, ordered by date?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 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 ?point_in_time ?population ?malePopulation ?femalePopulation WHERE { { wd:Q661700 p:P1082 _:wp . _:wp ps:P1082 ?population . _:wp pq:P585 ?point_in_time . BIND ( YEAR ( ?point_in_time ) AS ?Jahr ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de" . } } UNION { wd:Q661700 p:P1540 _:mp . _:mp ps:P1540 ?malePopulation . _:mp pq:P585 ?point_in_time . } UNION { wd:Q661700 p:P1539 _:fp . _:fp ps:P1539 ?femalePopulation . _:fp pq:P585 ?point_in_time . } } ORDER BY ?point_in_time

population chart


Question: Who are the members of the historic Lower House and Upper House of the Parliament of Sweden, whose party's Sweedish label contain the string "vilde" in their party name? For each person, also return the associated party, and the start (if available) and end (if available) times of the party.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 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 ?wd ?party ?startvilde ?endvilde WHERE { SERVICE <https://query.wikidata.org/sparql> { VALUES ?position { wd:Q81531912 wd:Q33071890 } ?wd wdt:P31 wd:Q5 ; wdt:P39 ?position . ?wd rdfs:label ?name . FILTER ( lang ( ?name ) = "sv" ) { ?wd p:P102 ?PartyWD . ?PartyWD ps:P102 ?p OPTIONAL { ?PartyWD pq:P580 ?startvilde } OPTIONAL { ?PartyWD pq:P582 ?endvilde } ?p rdfs:label ?party . FILTER ( LANG ( ?party ) = "sv" ) . FILTER ( CONTAINS ( ?party , 'vilde' ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en" . } } } }

Persons who dont have a picture


Question: Who are the chess players with an OlimpBase Chess Olympiad player ID who somehow have not participated in any Chess Olympiad event?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?itemLabel WHERE { ?item wdt:P3940 ?value . MINUS { ?item wdt:P1344 ?olymp . ?olymp wdt:P31 wd:Q428303 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } . } LIMIT 1000

Chess olympiad participantes


Question: What are the items with numerical values greater than 10,000,000 that are instances of large numbers in Wikidata, along with their numerical values?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?valeur ?itemLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?item wdt:P1181 ?valeur . FILTER ( ?valeur > 10000000 ) ?item wdt:P31 wd:Q1816844 . } group by ?item ?valeur ?itemLabel

Rest of division


Question: Which films have received the Academy Award for Best Director after 2010? Please also include the year they received the award and their IMDb ID 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 ?itemLabel ( YEAR ( ?time ) as ?year ) ?IMDb_ID WHERE { ?item wdt:P31 wd:Q11424 ; p:P166 ?oscar_statement . ?oscar_statement ps:P166 wd:Q103360 ; pq:P585 | ( pq:P805 / wdt:P585 ) ?time . OPTIONAL { ?item wdt:P345 ?IMDb_ID . } ?oscar_statement wikibase:rank ?rank . FILTER ( ?rank = wikibase:PreferredRank || ( ?rank = wikibase:NormalRank && NOT EXISTS { ?item p:P166 / wikibase:rank wikibase:PreferredRank . } ) ) FILTER ( YEAR ( ?time ) > 2010 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }

List of Oscar Best Movies


Question: What are the communes of France with postal codes ranging from 85001 to 85999 (both inclusive)? For each commune, include the postal code, its images (if available) and official websites (if available).

PREFIX schema: <http://schema.org/>
SELECT ?commune ?communeLabel ?communeImage ?communePostalCode ?communeWebsite

    WITH {
      SELECT ?commune ?communePostalCode WHERE {
        ?commune wdt:P31 wd:Q484170;
                 p:P625 ?coordinate.
        ?coordinate psv:P625 ?coordinate_node.
        ?commune wdt:P281 ?communePostalCode
        FILTER (?communePostalCode > "85000" && ?communePostalCode < "86000")
      }
      GROUP BY ?commune ?communePostalCode
    } AS %results

    WHERE {
      INCLUDE %results.
      OPTIONAL { ?commune wdt:P18 ?communeImage }.
      OPTIONAL { ?commune wdt:P856 ?communeWebsite }.

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

ORDER BY ?communePostalCode

Optimization: query to get all french communes with some datas


Question: What are the planets beyond the Solar System in Wikidata with at least one associated image? Return the planet and the associated image(s).

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?exoplanet ?exoplanetLabel ?image WHERE { ?exoplanet wdt:P31 wd:Q44559 ; wdt:P18 ?image . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Show Photo Attribution


Question: What are the departments in France and their INSEE department codes? Additionally, provide the following statistics about church buildings located within each department: the total count of church buildings, the count of church buildings without coordinates, the count of church buildings without images, the percentage of church buildings with coordinates, and the percentage of church buildings with images. Order results from lower to higher INSEE codes.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?INSEE ?itemLabel ?depCount ( IF ( ?_withCoord > ?depCount , 0 , ?depCount - ?_withCoord ) AS ?withoutCoord ) ( IF ( ?_withImg > ?depCount , 0 , ?depCount - ?_withImg ) AS ?withoutImg ) ( ROUND ( ( IF ( ?_withCoord > ?depCount , ?depCount , ?_withCoord ) / ?depCount ) * 100 * 100 ) / 100 AS ?withCoord ) ( ROUND ( ( IF ( ?_withImg > ?depCount , ?depCount , ?_withImg ) / ?depCount ) * 100 * 100 ) / 100 AS ?withImg ) WHERE { { SELECT ?item ( COUNT ( DISTINCT ?item2 ) AS ?depCount ) ( COUNT ( DISTINCT ?coord ) AS ?_withCoord ) ( COUNT ( DISTINCT ?img ) AS ?_withImg ) WHERE { ?commune wdt:P31 / wdt:P279 * wd:Q484170 . ?item2 wdt:P31 / wdt:P279 * wd:Q16970 . hint:Prior hint:gearing "forward" . ?item2 wdt:P131 ?commune . ?commune wdt:P131 ?item . ?item wdt:P2586 ?INSEE . OPTIONAL { ?item2 wdt:P625 ?coord } . OPTIONAL { ?item2 wdt:P18 ?img } . } GROUP BY ?item } . ?item wdt:P2586 ?INSEE . SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } . } ORDER BY ?INSEE

Query failing


Question: What are the items described at a URL starting with "https://www.redib.org/recursos/Serials/Record/oai_revista" (disregarding the `<` character) along with their titles (if available) and ISSNs (if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?title ?issn ?url WHERE { ?item wdt:P973 ?url . FILTER ( SUBSTR ( STR ( ?url ) , 1 , 57 ) = "https://www.redib.org/recursos/Serials/Record/oai_revista" ) . OPTIONAL { ?item wdt:P1476 ?title . } OPTIONAL { ?item wdt:P236 ?issn . } }

Specific url in a specific property


Question: Who are the female tennis players that were either born in Belarus and/or represent Belarus in sports and are still considered to be players (i.e. do not have a recorded end date of profession)? In addition, for each player, if rating information is available, include their most recent rating and when that rating started to take effect.

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 ?rating ?when WHERE { BIND ( wd:Q10833314 AS ?tennisPlayer ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],be-tarask,uk,pl,en" . } ?item wdt:P31 wd:Q5 . ?item wdt:P21 wd:Q6581072 . { ?item wdt:P19 wd:Q184 . } UNION { ?item wdt:P19 / wdt:P131 * wd:Q184 . } UNION { ?item wdt:P1532 wd:Q184 . } ?item p:P106 ?profession . ?profession ps:P106 ?tennisPlayer . FILTER NOT EXISTS { ?profession pq:P582 ?x } OPTIONAL { ?item p:P1352 ?singleRanking . ?singleRanking ps:P1352 ?rating . ?singleRanking pq:P641 wd:Q18123880 . ?singleRanking pq:P585 ?when . } filter not exists { ?item p:P1352 ?singleRanking2 . ?singleRanking2 ps:P1352 ?rating2 . ?singleRanking2 pq:P641 wd:Q18123880 . ?singleRanking2 pq:P585 ?when2 . filter ( str ( ?singleRanking ) != str ( ?singleRanking2 ) ) filter ( ?when2 > ?when ) } }

Acting tennis players by ranking


Question: For each parliamentary terms of the House of Commons of Canada, how many members belong to each party? Count only those member with a recorded electoral district for that term.

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 ?législatureLabel ( count ( distinct ?item ) as ?count ) ?groupeLabel where { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } ?item p:P39 ?fonction ; wdt:P39 wd:Q15964890 . ?fonction ps:P39 wd:Q15964890 ; pq:P4100 ?groupe ; pq:P2937 ?législature ; pq:P768 ?circonscription . } group by ?législatureLabel ?groupeLabel ?count ?rgb order by desc ( ?législatureLabel )

specific colors


Question: For each member state of the UN, what are the number of seats in each of its legislative bodies? Do not count those that are considered to be particular legislative terms (e.g. "42nd Canadian Parliament"), or those that already are recorded as "bicameral" in nature (e.g., for the United States, you should return both US Senate and US House of Representatives, but not "US Congress").

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?itemLabel ?appliestoLabel ?seats WHERE { ?item wdt:P1342 ?seats . ?item wdt:P1001 ?appliesto . ?appliesto wdt:P463 wd:Q1065 . minus { ?item wdt:P31 / wdt:P279 * wd:Q15238777 . } minus { ?item wdt:P31 wd:Q189445 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by ?appliestoLabel

`number of seats (P1342)` (members in lower and upper houses)


Question: What are the musical instruments played by people who are affiliated with the University of Washington School of Music and have been educated at the University of Washington, and how many people play each instrument?

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?instrument ?instrumentLabel ( COUNT ( ?student ) AS ?count ) WHERE { ?student wdt:P1303 ?instrument ; wdt:P1416 wd:Q98035717 ; wdt:P69 wd:Q219563 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?instrument ?instrumentLabel

Query for all instruments played by people affiliated with a particular organization, and the number of those people who play each instrument


Question: Which individuals are citizens of Dominican Republic but were not born in Dominican Republic?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item WHERE { ?item wdt:P27 wd:Q786 . FILTER ( NOT EXISTS { ?item wdt:P19 ?place . ?place ( wdt:P131 * ) wd:Q786 . hint:Prior hint:gearing "forward" . } ) }

Municipalties of Czech Republic


Question: What are the countries in the world, along with their population, Human Development Index (HDI), life expectancy, continent, and nominal GDP, ordered by descending HDI?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?population ?hdi ?lifeExpectancy ?continentLabel ?GDP WHERE { ?item wdt:P31 wd:Q6256 . ?item wdt:P1082 ?population . ?item wdt:P1081 ?hdi . ?item wdt:P30 ?continent . ?item wdt:P2250 ?lifeExpectancy . ?item wdt:P8744 / wdt:P2131 ?GDP . } ORDER BY DESC ( ?hdi )

Need to select all the coutries in the world, and their GPD


Question: Who are the recipients of the Wollaston Medal, and in which year did they receive it, if available? Please list them in order of the date they received the award.

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 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 ?recipient ?recipientLabel ( YEAR ( ?time ) AS ?year ) WHERE { ?recipient p:P166 ?statement . ?statement ps:P166 wd:Q832424 . OPTIONAL { ?statement pq:P585 ?time . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY ?time

including `point in time (P585)`


Question: What are the names, dates of birth (if available), dates of death (if available), positions held (if available), start times of those positions (if available), and end times of those positions (if available) of individuals who are citizens of Spain, were born in Madrid, and are politicians, statespersons, monarchs, or sovereigns?

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 ?dateofbirth ?dateofdeath ?position ?starttime ?endtime WHERE { ?item wdt:P31 wd:Q5 ; wdt:P27 wd:Q29 ; wdt:P19 wd:Q2807 VALUES ?occupation { wd:Q82955 wd:Q372436 wd:Q116 wd:Q2304859 } ?item wdt:P106 ?occupation . OPTIONAL { ?item wdt:P570 ?dateofdeath . } OPTIONAL { ?item wdt:P569 ?dateofbirth . } OPTIONAL { ?item p:P39 ?p . ?p ps:P39 ?position . OPTIONAL { ?p pq:P580 ?starttime . } OPTIONAL { ?p pq:P582 ?endtime . } } SERVICE wikibase:label { bd:serviceParam wikibase:language "es" . } }

how to select P properties beneath a Q item


Question: Which pairs of different commercial airports share the same IATA code? Exclude military airports, railway stations, Royal Air Force stations, and airports that have been dissolved, abolished, or demolished. For each pair, return the shared IATA code and the two airports.

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 ?code ?item1 ?item2 WHERE { ?item1 wdt:P31 / wdt:P279 * wd:Q1248784 . ?item1 p:P238 ?statement1 . ?statement1 ps:P238 ?code . minus { ?statement1 pq:P582 [] . } ?item2 p:P238 ?statement2 . ?statement2 ps:P238 ?code . minus { ?statement2 pq:P582 [] . } FILTER ( ?item1 != ?item2 ) minus { ?item1 wdt:P31 / wdt:P279 * wd:Q695850 . } minus { ?item1 wdt:P31 / wdt:P279 * wd:Q1311670 . } minus { ?item1 wdt:P31 / wdt:P279 * wd:Q7373622 . } minus { ?item2 wdt:P31 / wdt:P279 * wd:Q695850 . } minus { ?item2 wdt:P31 / wdt:P279 * wd:Q1311670 . } minus { ?item2 wdt:P31 / wdt:P279 * wd:Q7373622 . } minus { ?item1 wdt:P576 ?date } minus { ?item2 wdt:P576 ?date } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . } } ORDER BY ?code

Adapting a query


Question: How many distinct official websites does each programming language have, ordered by the count in descending order? Each tuple in result should contains the language and its number of official websites.

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 ?lang ( COUNT ( DISTINCT ?website ) as ?count ) WHERE { ?lang wdt:P31 / wdt:P279 * wd:Q9143 . ?lang p:P856 ?website . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?lang ?langLabel ORDER BY DESC ( ?count )

Number of values of a property of each instance


Question: What are the archive agencies and instutions located in Switzerland? For each one, also include the cantons they are located in (if available), their ISIL identifiers (if available), and their GLAM IDs (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?item ?canton ?ISIL ?GLAM WHERE { ?item wdt:P31 / wdt:P279 * wd:Q166118 . ?item wdt:P17 wd:Q39 . OPTIONAL { ?item wdt:P791 ?ISIL } OPTIONAL { ?item wdt:P3066 ?GLAM } OPTIONAL { ?item wdt:P131 * ?canton . ?canton wdt:P31 wd:Q23058 } }

L'ensemble des archives en Suisse


Question: What are the items with INE municipality codes that are exactly 9 digits long, and what are their corresponding codes?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?id WHERE { ?item wdt:P772 ?id . FILTER ( STRLEN ( ?id ) = 9 ) . }

Identifier with 11 digits


Question: Who participated in the 2018 Tour de France (the bicycle race), their current sports teams, and the year they started with their current team?

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 ?person ?team ( year ( ?st ) as ?since ) WHERE { ?person wdt:P1344 wd:Q28859163 . ?person p:P54 ?teamStatement . ?teamStatement ps:P54 ?team . optional { ?teamStatement pq:P580 ?st } optional { ?teamStatement pq:P582 ?et } filter ( bound ( ?st ) && ! bound ( ?et ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } order by desc ( ?since )

Getting property label


Question: Who are the Japanese citizens who born in the 15th and 16th centuries and what are their birthdates?

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 ?person ?personLabel ?date_of_birth WHERE { ?person wdt:P31 wd:Q5 . ?person wdt:P27 wd:Q17 . ?person wdt:P569 ?date_of_birth . FILTER ( "1400-00-00" ^^ xsd:dateTime <= ?date_of_birth && ?date_of_birth < "1600-00-00" ^^ xsd:dateTime ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Persons from a certain time period and country


Question: What are the games, that have a North American video game content rating and were released on or before December 31, 1998? For each tuple, return the game, its ESRB rating, and the release date. One game can have multiple release dates, in which case they should appear in different rows.

PREFIX p: <http://www.wikidata.org/prop/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> 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 ?ESRB_rating ?released WHERE { ?item p:P852 / ps:P852 ?ESRB_rating . ?item wdt:P31 / wdt:P279 * wd:Q11410 . ?item wdt:P577 ?released . FILTER ( ?released <= "1998-12-31T00:00:00Z" ^^ xsd:dateTime ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

`ESRB rating (P852)`


Question: For each GUI toolkit or framework, how many items in Wikidata are using it? Include only those with some items using it (disregard those not being used by any item). Also, make sure that items using the framework in a different language is aslo counted towards the original one (e.g. the ones using PyGTK is also counted towards GTK).

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?toolkit ?toolkitLabel ?count WHERE { { SELECT ?toolkit ( count ( ?item ) as ?count ) WHERE { ?item wdt:P1414 / wdt:P1372 * ?toolkit . } GROUP BY ?toolkit } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY DESC ( ?count )

Count that groups subclasses of certain items


Question: What are the programming languaes and those considered to be file formats which are programmed in a language? For each one, also include its file extension format (e.g. txt).

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT distinct ?item ?ext where { { ?item wdt:P31 wd:Q235557 . ?item wdt:P277 ?lang . } UNION { ?item wdt:P31 / wdt:P279 * wd:Q9143 . } ?item wdt:P1195 ?ext SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } order by ?langLabel ?ext

Is there a way to get list of typical file extensions of source code files?


Question: What are the dams in Japan along with their coordinates, that are within 1.00001 kilometers of another dam? Include the nearby dam and its coordinate, and the distance between them. Each pair should only appear once.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item ?coord ?place ?location ?dist WHERE { ?item wdt:P31 / wdt:P279 * wd:Q12323 . ?item wdt:P625 ?coord . ?item wdt:P17 wd:Q17 SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?coord . bd:serviceParam wikibase:radius "1.00001" . bd:serviceParam wikibase:distance ?dist . } ?place wdt:P31 / wdt:P279 * wd:Q12323 . filter ( str ( ?item ) < str ( ?place ) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } } ORDER BY ?dist

Dam within 1km of another dam