query-e52489d90e01d911617f1ce7dfddf1e9
Members of Odisha Vidhan Sabha
title:Members of Odisha Vidhan Sabha with no. of terms elected
SELECT DISTINCT ?item ?wikis ?itemLabel ?genderLabel (count(?term)as ?terms)
WHERE {
?item wdt:P31 wd:Q5. #<<< human
?item p:P39 ?statement.
?statement (ps:P39/wdt:P279*) wd:Q24546266.
OPTIONAL { ?item wdt:P21 ?gender. }
OPTIONAL { ?statement pq:P2937 ?term. }
OPTIONAL { ?item wikibase:sitelinks ?wikis. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". }
}
GROUP by ?item ?wikis ?itemLabel ?genderLabel
ORDER BY DESC(?terms)
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#>
#Members of Odisha Vidhan Sabha
#title:Members of Odisha Vidhan Sabha with no. of terms elected
SELECT DISTINCT ?item ?wikis ?itemLabel ?genderLabel (count(?term)as ?terms)
WHERE {
?item wdt:P31 wd:Q5. #<<< human
?item p:P39 ?statement.
?statement (ps:P39/wdt:P279*) wd:Q24546266.
OPTIONAL { ?item wdt:P21 ?gender. }
OPTIONAL { ?statement pq:P2937 ?term. }
OPTIONAL { ?item wikibase:sitelinks ?wikis. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". }
}
GROUP by ?item ?wikis ?itemLabel ?genderLabel
ORDER BY DESC(?terms)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?gender")
v2("?item"):::projected
v3("?statement")
v5("?term"):::projected
v7("?terms")
v6("?wikis"):::projected
a1((" "))
c6(["wd:Q24546266"]):::iri
c13(["#91;AUTO_LANGUAGE#93;, en"]):::literal
c11(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
v2 --"p:direct/P31"--> c2
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> a1
a1 --"p:direct/P279"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P21".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P2937".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wikibase:sitelinks".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end
bind1[/"count(?term)"/]
v5 --o bind1
bind1 --as--o v7