Wikidata:WikiProject India/Queries
Queries related to India (Q668), displaying cool visualizations, will be stored in this page. |
Query Libraries
[edit]Queries
[edit]Administration
[edit]Demographics
[edit]Bubble Chart showing population growth in districts of India between 2001 and 2011 |
---|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
# Population growth in districts of India between 2001 and 2011
#Credit: Mahir256
#defaultView:BubbleChart
#?fbclid=IwAR1KBWqLU5J2-SJ3jj8Jfc7PxnXgTNXUkofDcSPM9CvstaiVo22xFYtpD_Q
SELECT DISTINCT ?vLabel ?pop WHERE {
?v wdt:P31 wd:Q1149652.
?v wdt:P17 wd:Q668.
?v p:P1082 ?popStmt2011.
?popStmt2011 ps:P1082 ?pop2011.
?popStmt2011 pq:P585 "+2011-01-01T00:00:00Z"^^xsd:dateTime.
?v p:P1082 ?popStmt2001.
?popStmt2001 ps:P1082 ?pop2001.
?popStmt2001 pq:P585 "+2001-01-01T00:00:00Z"^^xsd:dateTime.
BIND((xsd:integer(?pop2011)) - (xsd:integer(?pop2001)) AS ?change)
BIND(IF(?change > 0, ?change, 0) AS ?pop)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?pop ?vLabel
ORDER BY DESC(?pop)
}
|
Map showing sex ratio in districts of India according to 2011 census |
---|
#Credit: Mahir256
#Map showing sex ratio in districts of India according to 2011 census
#defaultView:Map{"hide": "?rgb"}
SELECT ?d ?dLabel ?shape ?ratio ?rgb WHERE {
?d wdt:P31 wd:Q1149652; p:P1540 ?malepopstmt ; p:P1539 ?femalepopstmt ; wdt:P3896 ?shape.
?malepopstmt ps:P1540 ?malepop ; pq:P585 "+2011-01-01T00:00:00Z"^^xsd:dateTime.
?femalepopstmt ps:P1539 ?femalepop ; pq:P585 "+2011-01-01T00:00:00Z"^^xsd:dateTime.
BIND (xsd:integer(?malepop)/xsd:integer(?femalepop) AS ?ratio)
BIND (IF(?ratio < 0.8, "008000", IF(?ratio < 0.9, "32cd32", IF(?ratio < 1, "7fff00", IF(?ratio < 1.1, "ffa500", IF(?ratio < 1.2, "ff6347", "ff0000"))))) AS ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
|
Election
[edit]TreeMap of members of the 16th Lok Sabha by state |
---|
#TreeMap of members of the 16th Lok Sabha by state
#Credit: Mahir256
#defaultView:TreeMap
SELECT ?state ?stateLabel ?item ?itemLabel{
?item p:P39 ?pstmt.
?pstmt ps:P39 wd:Q42509248 ; pq:P768 ?dst. ?dst wdt:P131+ ?state. ?state wdt:P31/wdt:P279 wd:Q131541.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Map showing % of vote received by Communist Party of India (Marxist) in 2014 Indian General Election |
---|
#Map showing percentage of vote received by CPI(M) in 2014 Indian General Election
#Credit: Mahir256
#defaultView:Map{"hide": ["?rgb", "?shape"]}
SELECT ?const ?ecicode ?constLabel ?turnout ?shape ?rgb {
?const wdt:P31/wdt:P279* wd:Q47481352.
?const p:P6871 ?codestmt . ?codestmt ps:P6871 ?ecicode ; pq:P805 wd:Q3587169.
?const wdt:P3896 ?shape .
?election14 wdt:P1001 ?const ; wdt:P361/wdt:P361* wd:Q3587169 ;
wdt:P1868 ?ballots.
OPTIONAL { ?election14 p:P726 ?cstmt. ?cstmt pq:P1111 ?turnout14 ; pq:P102 wd:Q234277. }
BIND(IF(BOUND(?turnout14),(?turnout14 / ?ballots)*100,-1) AS ?turnout)
BIND(IF(?turnout = -1,"7f7f7f",
IF(?turnout > 20,IF(?turnout > 25,IF(?turnout > 30,'b22222','cd5c5c'),'f08080'),'ffa07a')
) AS ?rgb).
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"}
}
|
Public Service
[edit]Map of medical facilities in West Bengal, color-coded by type |
---|
# Credit: User:Mahir256
# Map of medical facilities in West Bengal, color-coded by type
#defaultView:Map
SELECT DISTINCT ?i ?iLabel ?layer ?c {
?item wdt:P31/wdt:P279* wd:Q4260475 ; wdt:P17 wd:Q668; wdt:P131* wd:Q1356 ; wdt:P625 ?c.
?thing rdfs:label ?tl. FILTER(LANG(?tl)="en")
BIND(?tl as ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
|
Map of schools in Kerala, color-coded by type |
---|
# Credit: User:Mahir256
# Map of schools in Kerala, color-coded by type
#defaultView:Map
SELECT DISTINCT ?i ?iLabel ?layer ?c WHERE {
?item (wdt:P31/(wdt:P279*)) wd:Q3914; wdt:P17 wd:Q668; wdt:P131* wd:Q1186 ; wdt:P625 ?c.
?thing rdfs:label ?tl.
FILTER((LANG(?tl)) = "en")
BIND(?tl AS ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
|
Tree map of postal administrative divisions |
---|
#Tree map of Indian postal administrative divisions
#defaultView:TreeMap
SELECT ?c ?cLabel ?r ?rLabel ?d ?dLabel {
?d wdt:P31 wd:Q63676827 ; wdt:P749 ?r .
?r wdt:P31 wd:Q63676819 ; wdt:P749 ?c .
?c wdt:P31 wd:Q63676815.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}
}
|
Society
[edit]Indian Red Cross Society (IRCS) and its branches |
---|
#List of organizations of the Indian Red Cross Society (IRCS): notably its state branches; added 2021-02-23, by Jura1
SELECT ?rc ?rcLabel ?hqLabel ?roleLabel ?item ?itemLabel ?sts ?ids
{
?rc ( wdt:P361 | wdt:P463 | wdt:P749 )* wd:Q16237727 .
OPTIONAL { ?rc wdt:P2541 ?item }
OPTIONAL { ?rc wdt:P159 ?hq }
OPTIONAL { ?rc wdt:P856 ?ws }
OPTIONAL { ?rc ( p:P361 | p:P463 | p:P749 ) [ pq:P2868 ?role ; ( ps:P361 | ps:P463 | ps:P749 ) / ( wdt:P361 | wdt:P463 | wdt:P749 )* wd:Q16237727 ] }
?rc wikibase:statements ?sts ; wikibase:identifiers ?ids .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?item = wd:Q668)
|
Transport
[edit]Map showing connection of commercial airlines in India |
---|
# Credit: User:Mahir256
#defaultView:Map{"hide":["?coordinates", "?line", "?rgb"]}
SELECT DISTINCT ?coordinates ?line ?sa ?saLabel ?connectLabel ?image ?code ?rgb
WITH {
SELECT ?sa (SAMPLE(?coordinates) AS ?coordinates) (SAMPLE(?image) AS ?image) (sample(?lat1) as ?lat1) (sample(?lon1) as ?lon1) (sample(?code) as ?code) WHERE {
{?sa wdt:P31 wd:Q1248784} UNION {?sa wdt:P31 wd:Q644371}
?sa wdt:P17 wd:Q668 .
?sa wdt:P625 ?coordinates .
?sa p:P625 / psv:P625 / wikibase:geoLatitude ?lat1 .
?sa p:P625 / psv:P625 / wikibase:geoLongitude ?lon1 .
OPTIONAL { ?sa wdt:P18 ?image }.
OPTIONAL { ?sa wdt:P5696 ?code }.
} GROUP BY ?sa
} AS %sas
WITH {
SELECT ?da (sample(?lat2) as ?lat2) (sample(?lon2) as ?lon2) WHERE {
{?da wdt:P31 wd:Q1248784} UNION {?da wdt:P31 wd:Q644371}
?sa wdt:P521 ?da.
?da p:P625 / psv:P625 / wikibase:geoLatitude ?lat2 .
?da p:P625 / psv:P625 / wikibase:geoLongitude ?lon2 .
} GROUP BY ?da
} AS %das
WITH {
SELECT ?line ?connect ("9B0058" as ?rgb) WHERE {
INCLUDE %sas .
INCLUDE %das .
?sa p:P521 ?dastmt .
?dastmt ps:P521 ?da .
?dastmt pq:P137 ?connect .
# FILTER(STR(?sa) < STR(?da)) .
BIND(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) .
BIND(STRDT(?str, geo:wktLiteral) AS ?line)
}
} AS %lines
WHERE {
{ INCLUDE %sas } UNION { INCLUDE %lines } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Map showing level of data completeness for railway stations in India |
---|
# Credit: User:Mahir256
#defaultView:Map{"hide":["?cd","?l,"?rgb"]}
SELECT DISTINCT ?cd ?l ?i ?iLabel ?ct ?ctLabel ?rgb ?x
WITH {
SELECT ?i ?cd ?lat1 ?lon1 ?loc ?x(sample(?op)as?op)
WHERE
{VALUES ?c1{wd:Q668} ?i wdt:P31 wd:Q55488;
wdt:P625 ?cd;
wdt:P17 ?c1;
p:P625/psv:P625 ?y.
?y wikibase:geoLatitude ?lat1; wikibase:geoLongitude ?lon1.
OPTIONAL {?i wdt:P131 ?loc}
OPTIONAL {?i wdt:P137 ?op}
OPTIONAL {{?i wdt:P5696 ?x}
UNION {?i wdt:P6785 ?x}
}
}
GROUP BY ?i ?cd ?lat1 ?lon1 ?loc ?x}AS%s
WITH
{
SELECT
?l ?ct ?o ?t
WHERE
{
VALUES ?c1{wd:Q668}
INCLUDE %s.
?i p:P197 ?nss.
?nss ps:P197 ?ns.
?ns p:P625/psv:P625 ?z.
?z wikibase:geoLatitude ?lat2; wikibase:geoLongitude ?lon2.
OPTIONAL {?nss pq:P81 ?ct.
OPTIONAL {?ct wdt:P127 ?o}
}
OPTIONAL {?nss pq:P5051 ?t}
FILTER(STR(?i)< STR(?ns)).
BIND(CONCAT('LINESTRING(',STR(?lon1),' ',STR(?lat1),',',STR(?lon2),' ',STR(?lat2),')')AS?str).
BIND(STRDT(?str,geo:wktLiteral)AS?l)}}AS%l
WHERE
{{INCLUDE%s} UNION {INCLUDE%l}.
BIND(IF(BOUND(?l),IF(BOUND(?ct),IF(BOUND(?t),IF(BOUND(?o),"00f","4682b4"),"40e0d0"),"ff0"),IF(BOUND(?x),IF(BOUND(?loc),IF(BOUND(?op),"00f","4682b4"),"40e0d0"),"ff0"))AS?rgb)
SERVICE wikibase:label{bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".}}
|
Film
[edit]Timeline of films in which Aamir Khan was an actor |
---|
#Timeline of films in which Aamir Khan was an actor
#defaultView:Timeline
SELECT DISTINCT ?film ?filmLabel ?start where {
?film wdt:P161 wd:Q9557 ; wdt:P577 ?start.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|
Bubble chart of number of times Shahrukh Khan collaborated with other actors |
---|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#Bubble chart of number of times Shahrukh Khan collaborated with other actors
#defaultView:BubbleChart
SELECT DISTINCT ?coactorLabel (COUNT(?film) as ?films) WHERE {
?film wdt:P31 wd:Q11424 ; wdt:P161 wd:Q9535 ; wdt:P161 ?coactor.
FILTER(?coactor != wd:Q9535)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?coactorLabel
|
Women
[edit]List of women scientists in India |
---|
# List of women scientists in India
SELECT ?instance_of ?instance_ofLabel ?field_of_work ?field_of_workLabel ?date_of_birth WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?instance_of wdt:P31 wd:Q5;
wdt:P21 wd:Q6581072;
wdt:P106 wd:Q901;
wdt:P27 wd:Q668.
OPTIONAL { ?instance_of wdt:P101 ?field_of_work. }
OPTIONAL { ?instance_of wdt:P569 ?date_of_birth. }
}
LIMIT 100
|
Notable Indian women whose manner of death (P1196) was homicide (Q149086) or a subclass of it |
---|
# Notable Indian women whose manner of death (P1196) was homicide (Q149086) or a subclass of it
SELECT ?India ?IndiaLabel ?date_of_birth ?date_of_death WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?India wdt:P27 wd:Q668.
?India p:P1196/ps:P1196/wdt:P279* wd:Q149086.
?India wdt:P21 wd:Q6581072.
OPTIONAL { ?India wdt:P569 ?date_of_birth. }
OPTIONAL { ?India wdt:P570 ?date_of_death. }
}
LIMIT 100
|
Item and Property Specific
[edit]India-specific properties and usage count |
---|
The following query uses these:
|
cumulative growth of India items |
---|
The following query uses these:
|
Quarry
[edit]- Label/description/alias stats for South Asian tongues on Wikidata
- Edits on particular articles (might be helpful, while running Label-a-thon or content improvement etc. with a specific list of items)
Items without statements
[edit]There may be queries posted on behalf of Wikidata's WikiProject India that display maps attempting to show the entirety of India, and which in the process may indicate national borders that you do not accept. The maps that Wikidata's Query Service uses come from OpenStreetMap, and therefore the practices in use there with regard to international borders will necessarily be mirrored in Wikidata's Query Service. We do not endorse nor condemn any particular borders that are provided by OpenStreetMap, and Wikidata's WikiProject India does not have the capability nor the authority to adjust the borders. We thus request that, if you have any complaints about the maps that are being used in our queries, you get in touch with the people behind OpenStreetMap and air your concerns there. Thank you. |