query-6926c5c992d3b5849da79185def99ff8
Get assembly constituencies with current district, loksabha const, assembly tewikilinks for use in tewiki district article SELECT DISTINCT ?assembly ?assemblyLabel ?districtLabel ?loksabhaLabel (CONCAT("# [[",STR(?page_titleTE),"|", STRBEFORE(STR(?page_titleTE), " శాసనసభ నియోజకవర్గం"), "]]") as ?assemblytewikilink) WHERE { ?assembly wdt:P31 wd:Q54375413. ?tewikilink schema:about ?assembly; schema:isPartOf https://te.wikipedia.org/; schema:name ?page_titleTE. ?loksabha wdt:P31 wd:Q47481352; wdt:P131 wd:Q1159; wdt:P527 ?assembly. ?assembly p:P131 ?districtnode. ?districtnode ps:P131 ?district. ?district wdt:P131 wd:Q1159. OPTIONAL { ?districtnode pq:P580 ?startdate. } OPTIONAL { ?districtnode pq:P582 ?enddate. } OPTIONAL { ?assembly wdt:P576 ?defdate.} 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) BIND(IF(BOUND(?defdate), YEAR(?defdate), 0 ) AS ?defyear) FILTER ((?startflag_ ="yes" && ?endflag_="no" && ?startyear=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 assembly constituencies with current district, loksabha const, assembly tewikilinks for use in tewiki district article
SELECT DISTINCT ?assembly ?assemblyLabel ?districtLabel ?loksabhaLabel (CONCAT("# [[",STR(?page_titleTE),"|", STRBEFORE(STR(?page_titleTE), " శాసనసభ నియోజకవర్గం"), "]]") as ?assemblytewikilink)
WHERE {
?assembly wdt:P31 wd:Q54375413.
?tewikilink schema:about ?assembly;
schema:isPartOf <https://te.wikipedia.org/>;
schema:name ?page_titleTE.
?loksabha wdt:P31 wd:Q47481352;
wdt:P131 wd:Q1159;
wdt:P527 ?assembly.
?assembly p:P131 ?districtnode.
?districtnode ps:P131 ?district.
?district wdt:P131 wd:Q1159.
OPTIONAL { ?districtnode pq:P580 ?startdate. }
OPTIONAL { ?districtnode pq:P582 ?enddate. }
OPTIONAL { ?assembly wdt:P576 ?defdate.}
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)
BIND(IF(BOUND(?defdate), YEAR(?defdate), 0 ) AS ?defyear)
FILTER ((?startflag_ ="yes" && ?endflag_="no" && ?startyear=2022 )|