User:Arjunaraoc/assembly, loksabha for specified district with assembly tewiki article link
Jump to navigation
Jump to search
Try it!
#Get assembly constituencies with specific district, loksabha const, assembly tewikilinks for use in tewiki district article
SELECT DISTINCT ?assembly ?assemblyLabel ?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 wd:Q110876712
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 )|