query-0e5a17b447c8ea45e0ea02c7e9cbba98

rq turtle/ttl

Jagseer S Sidhu

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?person ?personLabel # we want the Qid of the person and their label in a given language
{
  ?item wdt:P569 ?time.       # get the person's date of birth (if it is present on the item)
  FILTER(YEAR(?time) = 1995). # make sure the year in the date is 1995
  {
    ?item wdt:P19 ?place.       # get the person's place of birth (if it is present on the item)
    ?place wdt:P131* wd:Q22424. # make sure it's in Punjab, India
  }
  UNION # because we want _either_ places of birth _or_ places of residence, not just items with both together
  {
    ?item wdt:P551 ?place.      # get the person's place of residence (if it is present on the item)
    ?place wdt:P131* wd:Q22424. # make sure it's in Punjab, India
  }
  UNION # (similar reasoning to the previous comment on UNION)
  {
    ?item wdt:P937 ?place.      # get the person's place where they worked (if it is present on the item)
    ?place wdt:P131* wd:Q22424  # make sure it's in Punjab, India
  }
  UNION # (similar reasoning to the previous comment on UNION)
  {
    ?item wdt:P69 ?place.       # get the person's place where they were educated (if it is present on the item)
    ?place wdt:P131* wd:Q22424  # make sure it's in Punjab, India
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pa,en". } # for the personLabel, give it to us in Gurmukhi first, then in English if Gurmukhi is not present

Query found at