query-caa50df132a1ab9509335b84a357b71e
Propertiesinstance of (P31)subclass of (P279)located in the administrative territorial entity (P131)successful candidate (P991)point in time (P585)
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 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 ?item ?itemLabel ?desc ?state ?stateLabel ?eyear ?member ?memberLabel
WHERE {
BIND(wd:Q22048 as ?state) # Odisha
BIND (wd:Q3532431 as ?name)
BIND (wd:Q3429959 as ?constituency)
?item wdt:P31/wdt:P279* ?constituency. # constituency
?item p:P131 ?statement . # get state name
?item wdt:P131 ?state .
?item p:P585 [
ps:P585 ?eyear ;
pq:P991 ?member;
].
#Filter (year(?eyear) = 2014) .
#optional{?item wdt:P991 ?member .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL {
?item rdfs:label ?desc filter (lang(?desc) = "en").
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?constituency")
v1("?desc"):::projected
v7("?eyear"):::projected
v5("?item"):::projected
v8("?member"):::projected
v3("?name")
v2("?state"):::projected
v6("?statement")
a1((" "))
a2((" "))
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/"'wd:Q22048'"/]
bind0 --as--o v2
bind1[/"'wd:Q3532431'"/]
bind1 --as--o v3
bind2[/"'wd:Q3429959'"/]
bind2 --as--o v4
v5 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> v4
v5 --"p:P131"--> v6
v5 --"p:direct/P131"--> v2
a2 --"p:statement/P585"--> v7
a2 --"p:qualifier/P991"--> v8
v5 --"p:P585"--> a2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v1
end