query-21b5454670e7c013a944d1dad8384f02
Get parliament consituency in Andhra Padesh with its assembly, old districts prior to 2022 reorg SELECT DISTINCT ?assembly ?assemblyLabel ?olddistrict ?olddistrictLabel ?loksabha ?loksabhaLabel WHERE { ?assembly wdt:P31 wd:Q54375413. ?assembly p:P131 ?districtnode. ?districtnode ps:P131 ?olddistrict. ?olddistrict wdt:P131 wd:Q1159. ?tewikilink schema:about ?assembly; schema:isPartOf https://te.wikipedia.org/; schema:name ?page_titleTE. ?tewikilink_dist schema:about ?olddistrict; schema:isPartOf https://te.wikipedia.org/; schema:name ?page_titleTE_dist.
?loksabha wdt:P31 wd:Q47481352;
wdt:P131 wd:Q1159;
wdt:P527 ?assembly.
OPTIONAL { ?districtnode pq:P580 ?startdate. } 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_ ="no" && ?endflag_="yes" &&year(?enddate) =2022 )|
Use at
- https://query.wikidata.org/sparql
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/>
#Get parliament consituency in Andhra Padesh with its assembly, old districts prior to 2022 reorg
SELECT DISTINCT ?assembly ?assemblyLabel ?olddistrict ?olddistrictLabel ?loksabha ?loksabhaLabel
WHERE {
?assembly wdt:P31 wd:Q54375413.
?assembly p:P131 ?districtnode.
?districtnode ps:P131 ?olddistrict.
?olddistrict wdt:P131 wd:Q1159.
?tewikilink schema:about ?assembly;
schema:isPartOf <https://te.wikipedia.org/>;
schema:name ?page_titleTE.
?tewikilink_dist schema:about ?olddistrict;
schema:isPartOf <https://te.wikipedia.org/>;
schema:name ?page_titleTE_dist.
?loksabha wdt:P31 wd:Q47481352;
wdt:P131 wd:Q1159;
wdt:P527 ?assembly.
OPTIONAL { ?districtnode pq:P580 ?startdate. }
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_ ="no" && ?endflag_="yes" &&year(?enddate) =2022 )|