Question: What are the streets named after female individuals who have an identifier in the Women Writers database? For each street, return also its the Women Writers database ID.

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> select ?item ?WWid where { ?item wdt:P31 wd:Q79007 . ?item wdt:P138 ?vernoemd . ?vernoemd wdt:P2533 ?WWid . ?vernoemd wdt:P21 wd:Q6581072 . }

Streets named after womenwriters but without `named after (P138)`


Question: Who are the tennis players that are citizens of only Belgium?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { ?item wdt:P106 wd:Q10833314 ; wdt:P27 wd:Q31 ; wdt:P27 ?citizenship . } GROUP BY ?item HAVING ( COUNT ( DISTINCT ?citizenship ) = 1 )

Only one item to one property


Question: What are the cities in Russia with a population exceeding 100,000? For each one also return their coordinates

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?city ?coord WHERE { ?city wdt:P131 * wd:Q159 ; wdt:P625 ?coord ; wdt:P1082 ?population ; wdt:P31 wd:Q515 . FILTER ( ?population > 100000 ) . }

Cities in Russia on the map


Question: Who are the individuals who have held the position of President of the United States and thier names? For each president, the name should be derived from their official name, birth name, or name in their native language, in that order of preference (return only one name for each president).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?fn { ?item wdt:P39 wd:Q11696 ; wdt:P31 wd:Q5 . OPTIONAL { ?item wdt:P1477 ?bn } OPTIONAL { ?item wdt:P1448 ?on } OPTIONAL { ?item wdt:P1559 ?nn } BIND ( COALESCE ( ?on , ?bn , ?nn ) as ?fn ) }

Get full name given a person


Question: What is the number of legal units for each level 3 legal category in France, with the category name in French, where the count of legal units is greater than 499? Additionally, provide a summary line labeled "OTHER" that sums up the number of legal units for all other categories with counts of 499 or less.

# Nombre d'unités légales par catégorie juridique de niveau 3 (500+)
SELECT ?catégorie ?nomfr ?count
WITH
{
  SELECT ?catégorie ?nomfr (COUNT(?item) AS ?count_1)
  WHERE
  {
    ?catégorie wdt:P31 wd:Q56427813; # catégorie juridique en France
        wdt:P361 wd:Q112176282; # catégorie de niveau 3
        wdt:P2561 ?nomfr. # nom de la catégorie
    FILTER(LANG(?nomfr) = "fr"). # nom en français
    ?item wdt:P1616 ?siren. # unité légale
    {  ?item p:P1454 [ps:P1454 ?catégorie; pq:P1013 wd:Q87711223; prov:wasDerivedFrom [ pr:P248 wd:Q3509449]; prov:wasDerivedFrom [ pr:P5017 ?date] ]. } # catégorie
    UNION
    { ?item p:P1454 [ps:P1454 ?catégorie; pq:P1013 wd:Q87711223; prov:wasDerivedFrom [ pr:P248 wd:Q3509449]; prov:wasDerivedFrom [a wdno:P5017] ]. } # catégorie
  }
  GROUP BY ?catégorie ?nomfr
} AS %all
WHERE
{
  {
    SELECT ?catégorie ?nomfr (?count_1 AS ?count) (?count as ?sortkey)
    WHERE
    {
      INCLUDE %all
      FILTER (?count_1 > 499) # minimum unités légales
    }
  }
  UNION
  {
    SELECT ("OTHER" AS ?catégorie) ("OTHER" AS ?nomfr) (SUM(?count_1) AS ?count) (0 AS ?sortkey)
    WHERE
    {
      INCLUDE %all
      FILTER (?count_1 <= 499)
    }
  }
}
ORDER BY DESC(?sortkey)

Help with GROUP BY and HAVING


Question:
What are the counts and sums of various types of awards received by humans who have won the Gottfried Wilhelm Leibniz Prize? Only consider awards that are general awards, science awards, cultural prizes, chemistry awards, literary awards, physics awards, national academies, and journalism prizes. Additionally, if the dates are available, indicate whether these awards were received before, after, at the same time, or at an unknown time relative to the receipt of the Gottfried Wilhelm Leibniz Prize.

Each result row should contain the prize, the count of people who received that prize, and the counts of people who received it before, after, at the same time, or at an unknown time relative to the Leibniz Prize.

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 ?preis ( COUNT ( * ) AS ?count ) ( SUM ( ?before_ ) AS ?before ) ( SUM ( ?after_ ) AS ?after ) ( SUM ( ?same_ ) AS ?same ) ( SUM ( ?unknown_ ) AS ?unknown ) WHERE { ?person wdt:P31 wd:Q5 . ?person p:P166 ?Leibnitz_preis_statement . ?Leibnitz_preis_statement a wikibase:BestRank ; ps:P166 wd:Q703205 . OPTIONAL { ?Leibnitz_preis_statement pq:P585 ?Leibnitz_preis_time . } ?person p:P166 ?preis_statement . ?preis_statement a wikibase:BestRank ; ps:P166 ?preis . OPTIONAL { ?preis_statement pq:P585 ?preis_time . } ?preis wdt:P31 ?preistype . VALUES ?preistype { wd:Q618779 wd:Q11448906 wd:Q15383322 wd:Q107471279 wd:Q378427 wd:Q107494520 wd:Q5257307 wd:Q1792571 wd:Q55190113 wd:Q1966910 wd:Q1709894 } BIND ( IF ( BOUND ( ?Leibnitz_preis_time ) && BOUND ( ?preis_time ) && ?preis_time < ?Leibnitz_preis_time , 1 , 0 ) AS ?before_ ) BIND ( IF ( BOUND ( ?Leibnitz_preis_time ) && BOUND ( ?preis_time ) && ?preis_time > ?Leibnitz_preis_time , 1 , 0 ) AS ?after_ ) BIND ( IF ( BOUND ( ?Leibnitz_preis_time ) && BOUND ( ?preis_time ) && ?preis_time = ?Leibnitz_preis_time , 1 , 0 ) AS ?same_ ) BIND ( IF ( BOUND ( ?Leibnitz_preis_time ) && BOUND ( ?preis_time ) , 0 , 1 ) AS ?unknown_ ) } GROUP BY ?preis ORDER BY DESC ( ?count )

Other prices of Heinz Maier-Leibnitz-Price winner


Question: Who has an accused witch ID in the Survey of Scottish Witchcraft? For each person, also include their residences, the coordinates of their residences, and gender (if available).

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?witch ?residence ?coordinate ?gender WHERE { ?item wdt:P4478 ?witch ; wdt:P551 ?residence . ?residence wdt:P625 ?coordinate . OPTIONAL { ?item wdt:P21 ?gender . } }

Specifiying colours for a gender representation of Scottish witches


Question: Which individuals had an Elo rating in April 2007 that is exactly their year of birth, and what were their Elo ratings and dates of birth?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pq: <http://www.wikidata.org/prop/qualifier/> SELECT ?item ?eloRating ?dateOfBirth { ?item p:P1087 [ ps:P1087 ?eloRating ; pq:P585 ?eloTime ] ; wdt:P569 ?dateOfBirth . FILTER ( YEAR ( ?eloTime ) = 2007 && MONTH ( ?eloTime ) = 4 && ?eloRating = YEAR ( ?dateOfBirth ) ) . }

Elo ratings in certain month


Question: What are the events won by the Czech-American tennis player Ivan Lendl, as well as tournament, year, country, surface played on, prize money, and number of participants (all if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?event ?tournament ?year ?country ?surface ?purse ?participants WHERE { ?event wdt:P1346 wd:Q182736 . OPTIONAL { ?event wdt:P361 ?tournament . OPTIONAL { ?tournament wdt:P765 ?surface . } OPTIONAL { ?tournament wdt:P2121 ?purse . } OPTIONAL { ?tournament wdt:P17 ?country . } } OPTIONAL { ?event wdt:P585 ?time . BIND ( year ( ?time ) as ?year ) } OPTIONAL { ?event wdt:P1132 ?participants . } }

Tournaments won by Ivan Lendl


Question: What are the castles located in the historic county of Kent, along with their images and/or image of their design plans if available?

PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT DISTINCT ?item ?something WHERE { ?item p:P31 ?statement0 . ?statement0 ( ps:P31 / ( wdt:P279 * ) ) wd:Q23413 . ?item p:P7959 ?statement1 . ?statement1 ( ps:P7959 / ( wdt:P279 * ) ) wd:Q67479626 . OPTIONAL { { ?item wdt:P18 ?something } UNION { ?item wdt:P3311 ?something } } }

Combing lists of images into one string


Question: Who are the Wikimedians in residence, and their employers (if available), items (if available), coordinates (if available), end years (if available), start years (if available), and lengths of tenure (in months) (if available)?

PREFIX pq: <http://www.wikidata.org/prop/qualifier/> PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX ps: <http://www.wikidata.org/prop/statement/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/> SELECT ?employer ?item ?coord ( YEAR ( ?end ) AS ?endyear ) ( YEAR ( ?start ) AS ?startyear ) ( 12 * ( YEAR ( ?end ) - YEAR ( ?start ) ) + MONTH ( ?end ) - MONTH ( ?start ) AS ?lengthmonths ) { ?item p:P106 ?wir . ?wir ps:P106 wd:Q3809586 . OPTIONAL { ?wir pq:P582 ?end . ?wir pqv:P582 [ wikibase:timePrecision ?tp_end ] } OPTIONAL { ?wir pq:P580 ?start . ?wir pqv:P580 [ wikibase:timePrecision ?tp_start ] } OPTIONAL { ?wir pq:P937 ?location . ?location wdt:P625 ?coord . } OPTIONAL { ?wir pq:P108 ?employer } } ORDER BY DESC ( ?endyear )

Map of wikimedians in residence


Question: What are the museums in Europe, along with their Biodiversity Repository ID, country, International Standard Name Identifier (ISNI), GRID ID, Research Organization Registry (ROR) ID, and Library of Congress authority ID?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?museum ?code ?country ?isni ?grid ?ror ?locongress WHERE { ?museum wdt:P4090 ?code . ?museum wdt:P17 ?country . ?museum wdt:P213 ?isni . ?museum wdt:P2427 ?grid . ?museum wdt:P6782 ?ror . ?museum wdt:P244 ?locongress . ?country wdt:P30 wd:Q46 . }

Get organisational identifiers for museums in EUROPE


Question: What are the films directed by Rob Minkoff and the genres of the films (if available), and the earliest publication date of each film (if available)?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?film ?genre ( MIN ( ?publicationDate ) AS ?firstPublication ) WHERE { ?film wdt:P57 wd:Q1151111 . OPTIONAL { ?film wdt:P136 ?genre . } OPTIONAL { ?film wdt:P577 ?publicationDate . } } GROUP BY ?director ?film ?genre

Wikidata list of films by a certain director


Question: What are the details of living authors who are citizens of the United States, were born in Massachusetts after 1919, including their birthplace and date of birth, ordered by their date of birth?

SELECT DISTINCT ?person ?birthplace ?dob WITH {
  SELECT ?person ?birthplace ?dob WHERE {
  ?person wdt:P27 wd:Q30 ;
          wdt:P19/wdt:P131* wd:Q771 ;
          wdt:P19 ?birthplace ;
          wdt:P569 ?dob ;
  OPTIONAL {?person wdt:P570 ?dod .}
  MINUS {?person wdt:P570 [] .}
  FILTER (YEAR(?dob) > 1919)
} GROUP BY ?person ?birthplace ?dob
} AS %i WHERE {
    include %i
    ?person wdt:P106/wdt:P279* wd:Q482980 .
}
ORDER BY ASC (?dob)

Is there a better way to find all "writers" and any of its subclasses?


Question: What are the items associated with the DOIs '10.1126/SCIENCE.156.3775.636' and '10.1145/358027.358042', along with their titles if available?

PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT ?item ?doi ?title WHERE { VALUES ?doi { '10.1126/SCIENCE.156.3775.636' '10.1145/358027.358042' } ?item wdt:P356 ?doi . OPTIONAL { ?item wdt:P1476 ?title . } }

adding item label (or title) to a query


Question: Who are the distinct female individuals with a net worth of at least 1 billion United States dollars? Include their net worth amount, the unit of the net worth, the conversion rate to USD, and the net worth in USD, and order by the net worth in USD in descending order. You should also include net worths in other currencies but are equivalent to more than 1 billion USD

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 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 ?revenue ?usd ?revenue_USD where { ?item wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581072 ; p:P2218 ?s . ?s rdf:type wikibase:BestRank . { ?s psv:P2218 [ wikibase:quantityAmount ?revenue ; wikibase:quantityUnit wd:Q4917 ] . BIND ( wd:Q4917 AS ?unit ) . BIND ( ?revenue AS ?revenue_USD ) . BIND ( 1 AS ?usd ) } UNION { ?s psv:P2218 [ wikibase:quantityAmount ?revenue ; wikibase:quantityUnit ?unit ] . FILTER ( ?unit != wd:Q4917 ) . ?unit p:P2284 ?unit_statement . ?unit_statement wikibase:rank ?unit_rank ; psv:P2284 [ wikibase:quantityUnit wd:Q4917 ; wikibase:quantityAmount ?usd ] . FILTER ( ?unit_rank != wikibase:DeprecatedRank ) . OPTIONAL { FILTER ( ?unit_rank != wikibase:PreferredRank ) . ?unit p:P2284 ?unit_statement1 . ?unit_statement1 psv:P2284 / wikibase:quantityUnit wd:Q4917 ; wikibase:rank wikibase:PreferredRank . FILTER ( ?unit_statement1 != ?unit_statement ) . } . FILTER ( ! BOUND ( ?unit_statement1 ) ) . BIND ( ?revenue * ?usd AS ?revenue_USD ) . } filter ( ?revenue_USD >= 1000000000 ) } order by desc ( ?revenue_USD )

Females billionaires


Question: What are the settlements (villages and towns) in the Czech Republic within a 35 km radius from the village of Mezno? Please include their coordinates, the coordinates of the center point, and the distance from the center point.

PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?place ?location ?centerpointLoc ?distance WHERE { wd:Q2180733 wdt:P625 ?centerpointLoc . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?centerpointLoc . bd:serviceParam wikibase:radius "35" . bd:serviceParam wikibase:distance ?distance . } ?place wdt:P2788 ?P2788 . }

Items with specific property in the radius from the point