query-dbdfac1eeb796810b4c1c09b1dde210d
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?desc ?state ?stateLabel ?eyear ?member ?memberLabel WHERE {
BIND(wd:Q1445 as ?state) # Tamil Nadu
BIND (wd:Q3532431 as ?name)
?item wdt:P31 wd:Q3429959 . # constituency
?item wdt:P131 ?state . # get state name
#filter (?item = ?name) .
?item wdt:P585 ?eyear . # election year
filter (year(?eyear)=2014). # filter year of election
optional{ ?item wdt:P991 ?member . }# member name from qualifier . Not fetching for some items.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
OPTIONAL {
?item rdfs:label ?desc filter (lang(?desc) = "ta").
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?desc"):::projected
v2("?eyear"):::projected
v5("?item"):::projected
v6("?member"):::projected
v4("?name")
v3("?state"):::projected
c4(["wd:Q3429959"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["en"]):::literal
f0[["year-from-dateTime(?eyear) = '2014^^xsd:integer'"]]
f0 --> v2
bind1[/"'wd:Q1445'"/]
bind1 --as--o v3
bind2[/"'wd:Q3532431'"/]
bind2 --as--o v4
v5 --"wdt:P31"--> c4
v5 --"wdt:P131"--> v3
v5 --"wdt:P585"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P991".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v1
end