query-4bb640d8942122e4946382a365b5fda0

rq turtle/ttl

All human settlements in Prakasam district by admin location SELECT DISTINCT ?item ?itemLabel ?itemDescTE ?itemDescEN ?page_titleTE WHERE { ?item (wdt:P31/(wdt:P279*)) wd:Q532; wdt:P131 ?mandal. ?mandal p:P131 ?districtnode. ?districtnode ps:P131 wd:Q15390. OPTIONAL { ?article schema:about ?item; schema:isPartOf https://te.wikipedia.org/; schema:name ?page_titleTE. } OPTIONAL { ?item schema:description ?itemDescTE. FILTER((LANG(?itemDescTE)) = "te") } OPTIONAL { ?item schema:description ?itemDescEN. FILTER((LANG(?itemDescEN)) = "en") } SERVICE wikibase:label { bd:serviceParam wikibase:language "te,en". } OPTIONAL { ?districtnode pq:P580 ?startdate. } OPTIONAL { ?districtnode pq:P582 ?enddate. } BIND(IF(BOUND(?startdate), "yes", "no") AS ?startflag_) BIND(IF(BOUND(?enddate), "yes", "no") AS ?endflag_) BIND(IF(BOUND(?startdate), YEAR(?startdate), 0 ) AS ?startyear) BIND(IF(BOUND(?enddate), YEAR(?enddate), 0 ) AS ?endyear) FILTER((((?startflag_ = "yes") && (?endflag_ = "no")) && (?startyear = 2022 ))|

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#All human settlements  in Prakasam district by admin location
SELECT DISTINCT ?item ?itemLabel ?itemDescTE ?itemDescEN ?page_titleTE WHERE {
  ?item (wdt:P31/(wdt:P279*)) wd:Q532;
    wdt:P131 ?mandal.
  ?mandal p:P131 ?districtnode.
  ?districtnode ps:P131 wd:Q15390.
  OPTIONAL {
    ?article schema:about ?item;
      schema:isPartOf <https://te.wikipedia.org/>;
      schema:name ?page_titleTE.
  }
  OPTIONAL {
    ?item schema:description ?itemDescTE.
    FILTER((LANG(?itemDescTE)) = "te")
  }
  OPTIONAL {
    ?item schema:description ?itemDescEN.
    FILTER((LANG(?itemDescEN)) = "en")
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "te,en". }
  OPTIONAL { ?districtnode pq:P580 ?startdate. }
  OPTIONAL { ?districtnode pq:P582 ?enddate. }
  BIND(IF(BOUND(?startdate), "yes", "no") AS ?startflag_)
  BIND(IF(BOUND(?enddate), "yes", "no") AS ?endflag_)
  BIND(IF(BOUND(?startdate), YEAR(?startdate), 0 ) AS ?startyear)
  BIND(IF(BOUND(?enddate), YEAR(?enddate), 0 ) AS ?endyear)
  FILTER((((?startflag_ = "yes") && (?endflag_ = "no")) && (?startyear = 2022 ))|

Query found at