query-0d01068c251e293016edf020942d16aa
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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#>
SELECT DISTINCT
?mandal ?mandalLabel (YEAR(?startdate) AS ?startyear) (YEAR(?enddate) AS ?endyear)
WHERE {
?mandal wdt:P31/wdt:P279* wd:Q817477;
p:P131 ?districtnode.
?districtnode ps:P131 wd:Q15341.
OPTIONAL { ?districtnode pq:P580 ?startdate. }
OPTIONAL { ?districtnode pq:P582 ?enddate. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "te,en". }
}
ORDER BY (?mandalLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?districtnode")
v5("?enddate"):::projected
v7("?endyear")
v2("?mandal"):::projected
v1("?mandalLabel"):::projected
v4("?startdate"):::projected
v6("?startyear")
a1((" "))
c10(["bd:serviceParam"]):::iri
c12(["te,en"]):::literal
c6(["wd:Q15341"]):::iri
c3(["wd:Q817477"]):::iri
v2 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v2 --"p:P131"--> v3
v3 --"p:statement/P131"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
bind0[/"year-from-dateTime(?startdate)"/]
v4 --o bind0
bind0 --as--o v6
bind1[/"year-from-dateTime(?enddate)"/]
v5 --o bind1
bind1 --as--o v7