Wikidata:WikiProject Kerala/Queries

Main pageProject talkQueriesSub projectsEventsNews

Malayalam / Kerala related peoples edit

Malayalam women (by birth / language) without an article on Malayalam Wikipedia edit

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX schema: <http://schema.org/>
# Malayalam women (by birth / language) without an article on Malayalam Wikipedia
SELECT ?item ?itemLabel ?birth ?pobLabel ?death ?podLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  BIND(xsd:integer(STRAFTER(STR(?item), "Q")) AS ?qid)
  ?item wdt:P31 wd:Q5.
  ?item wdt:P21 wd:Q6581072.
  { ?item wdt:P19 wd:Q1186. }
  UNION
  {
    ?item wdt:P19 ?pob.
    ?pob wdt:P131* wd:Q1186.
  }
  UNION
  { ?item wdt:P103 wd:Q36236. }
  UNION
  { ?item wdt:P1412 wd:Q36236. }
  OPTIONAL { ?item wdt:P569 ?birth. }
  OPTIONAL { ?item wdt:P19 ?pob. }
  OPTIONAL { ?item wdt:P570 ?death. }
  OPTIONAL { ?item wdt:P20 ?pod. }
  OPTIONAL {
    ?sitelink schema:about ?item.
    ?sitelink schema:inLanguage "ml".
  }
  FILTER(!BOUND(?sitelink))
}
GROUP BY ?item ?itemLabel ?birth ?pobLabel ?death ?podLabel
ORDER BY DESC(?statements)
Try it!

Successful candidates during 2016 Kerala Legislative Assembly edit

# Created by User:Gnoeee
# Successful candidates during 2016 Kerala Legislative Assembly in each constituencies
SELECT ?constituency_No ?jurisdictionLabel ?successful_candidateLabel ?electorate ?total_valid_votes ?votes_received ?political_partyLabel (100*?votes_received/?total_valid_votes AS ?candidate_Vote_percent) WHERE {
  ?item wdt:P31 wd:Q40231;
    wdt:P541 wd:Q99709336.
  ?item wdt:P1001 ?jurisdiction.
  ?jurisdiction p:P31 ?id.
  ?id ps:P31 wd:Q54375461 .
  ?id pq:P1545 ?constituency_No.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ml". }
  OPTIONAL { ?item wdt:P1697 ?total_valid_votes. }
  OPTIONAL { ?item wdt:P991 ?successful_candidate. }
  OPTIONAL { ?item wdt:P1831 ?electorate. }
  ?item p:P991 ?sc.
  ?sc pq:P1111 ?votes_received;
    pq:P102 ?political_party.
}
ORDER BY ASC(xsd:integer(?constituency_No) )
Try it!

Chief Ministers of Kerala from 1957 - current edit

# Created by User:Gnoeee
#Chief Ministers of Kerala
SELECT ?item ?itemLabel ?start ?end WHERE {
  ?item p:P39 ?statement.
  ?statement ps:P39 _:b1.
  _:b1 (wdt:P279*) wd:Q26218416.
  OPTIONAL { ?statement pq:P580 ?start. }
  OPTIONAL { ?statement pq:P582 ?end. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ASC(?start)
Try it!

Malayalam Films edit

Malayalam films without Malayalam labels in Wikidata edit

# Created by User:Gnoeee
# Malayalam films without Malayalam labels in Wikidata
SELECT ?item ?len ?lml {
  ?item wdt:P31 wd:Q11424.
  ?item wdt:P364 wd:Q36236
  OPTIONAL { ?item rdfs:label ?len. FILTER(LANG(?len)="en") }
  FILTER NOT EXISTS { ?item rdfs:label ?lml. FILTER(LANG(?lml)="ml") }
  }
Try it!

Malayalam films in Wikidata released in the year 2019 edit

# Created by User:Gnoeee
# Malayalam films released in the year 2019
SELECT ?film ?filmLabel ?publication_date WHERE {
  ?film wdt:P31 wd:Q11424.
  ?film wdt:P364 wd:Q36236.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?film wdt:P577 ?publication_date. }
  FILTER (year(xsd:dateTime(?publication_date)) = 2019)
}
ORDER BY (?publication_date)
Try it!

Malayalam films which has article in English Wiki but not in Malayalam Wiki edit

# Created by User:Gnoeee
# Malayalam language films which has article in English Wiki but not in Malayalam Wiki
SELECT ?item ?itemLabel WHERE {
  ?item wdt:P31 wd:Q11424.
  ?item wdt:P364 wd:Q36236.
  ?sitelink schema:about ?item .
	FILTER EXISTS { ?len schema:about ?item . ?len schema:inLanguage "en" }
	FILTER NOT EXISTS { ?lml schema:about ?item . ?lml schema:inLanguage "ml" }
	SERVICE wikibase:label {
		bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
	}
}
GROUP BY ?item ?itemLabel
ORDER BY ?itemLabel
Try it!

Malayalam films released per year edit

# Malayalam films released per year
#defaultView:BarChart
SELECT ?year (COUNT(?item) AS ?cnt) WHERE {
  ?item wdt:P31 wd:Q11424;
    wdt:P364 wd:Q36236;
    wdt:P577 ?publicationdate.
  BIND(STR(YEAR(?publicationdate)) AS ?year)
  FILTER(BOUND(?year))
}
GROUP BY ?year
ORDER BY (?year)
Try it!

Indian gallantry awardee edit

# Indian gallantry awardee

SELECT ?item  ?itemLabel ?itemDescription ?itemAltLabel
{ ?item wdt:P6919 ?code . minus { ?item rdfs:label ?il. filter(lang(?il)="ml") }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Territories edit

Number of wards in each Grama panchayath edit

# Created by User:Gnoeee
# Number of wards in each Grama panchayath
SELECT ?gp ?gpLabel (COUNT(DISTINCT ?entity) as ?count) WHERE { 
  ?entity wdt:P31 wd:Q1195098.
  ?entity wdt:P131/wdt:P131* wd:Q1186. 
  ?entity wdt:P361 ?gp.
  ?gp wdt:P31 wd:Q2732840.
 SERVICE wikibase:label {bd:serviceParam wikibase:language "en" .}
}
GROUP BY ?gp ?gpLabel HAVING (?count >= 0) 
ORDER BY DESC(?count)
Try it!

LSG Wards in Kerala by wardnumber edit

The following query uses these:

  • Properties: instance of (P31)     , located in the administrative territorial entity (P131)     , part of (P361)     , series ordinal (P1545)     
    # Created by User:Gnoeee
    # LSG Wards in Kerala by wardnumber
    SELECT ?wardnumber ?item ?len ?lml ?den ?part_ofLabel WHERE {
      ?item wdt:P31 wd:Q1195098.
      ?item wdt:P131/wdt:P131* wd:Q1186. 
      ?item p:P361 ?id.
      ?id pq:P1545 ?wardnumber.
      OPTIONAL {
        ?item rdfs:label ?len;
          schema:description ?den.
        FILTER((LANG(?len)) = "en")
        FILTER((LANG(?den)) = "en")
        ?item rdfs:label ?lml;
        FILTER((LANG(?lml)) = "ml")
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ml". }
      OPTIONAL { ?item wdt:P361 ?part_of. }
    }
    
    ORDER BY ASC (?part_ofLabel) (xsd:integer(?wardnumber))
    

Politics edit

2021 MLAs below 40 years edit

# Created by User:naveenpf
# 2021 MLAs below 40 years

SELECT ?age ?item ?itemLabel ?partyLabel ?party_groupLabel ?dob ?districtLabel ?start ?end WHERE {
  ?item p:P39 ?statement.
  ?statement ps:P39 _:b1;
    pq:P2715 wd:Q85737920.
  _:b1 (wdt:P279*) wd:Q19468152.
  ?item wdt:P569 ?dob.
  BIND(2021  - (YEAR(?dob)) AS ?age)
  OPTIONAL { ?statement pq:P580 ?start. }
  OPTIONAL { ?statement pq:P582 ?end. }
  OPTIONAL { ?statement pq:P768 ?district. }
  OPTIONAL { ?statement pq:P4100 ?party_group. }
  OPTIONAL { ?statement pq:P102 ?party. }
  OPTIONAL { ?statement pq:P1365 ?precededby. }
  OPTIONAL { ?statement pq:P1366 ?succeededby. }
  OPTIONAL { ?statement pq:P2715 ?electedin. }
  FILTER(?age <= 40 )
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY (?age)
Try it!


Dams, Schemes River and Basins edit

Hyrdo Electric Projects in Kerala edit

#Created by User:Gnoeee
#defaultView:Tree
#Hyrdo Electric Projects in Kerala
SELECT ?powerScheme ?powerSchemeLabel ?hasPart ?hasPartLabel 
WHERE {
  ?powerScheme (wdt:P31/(wdt:P279*)) wd:Q108792154;
    (wdt:P131/(wdt:P131*)) wd:Q1186.
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
    ?powerScheme rdfs:label ?powerSchemeLabel.
    ?hasPart rdfs:label ?hasPartLabel.
  }
  OPTIONAL { ?powerScheme wdt:P527 ?hasPart. }
}
Try it!