Wikidata:WikiProject India/Queries/MKar

From Wikidata
Jump to navigation Jump to search

Monument of National Importance without image[edit]

The following query uses these:

Features: map (Q24515275)  View with Reasonator View with SQID

# Monument of National Importance without image
#defaultView:Map
SELECT ?q ?qLabel ?coords { ?q wdt:P1435 wd:Q17047615 ; wdt:P625 ?coords 
                               MINUS { ?q wdt:P18 [] } . 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country of citizenship (P27)  View with Reasonator View with SQID, given name (P735)  View with Reasonator View with SQID
    #First name of Indians, 1937 items@27 JULY 2020
    SELECT ?givenName ?givenNameLabel (COUNT(DISTINCT ?item) AS ?count) 
    WHERE {
     ?item wdt:P31 wd:Q5. 
     ?item wdt:P27 wd:Q668 .
      ?item wdt:P735 ?givenName .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?givenName ?givenNameLabel 
    ORDER BY DESC(?count)
    

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country of citizenship (P27)  View with Reasonator View with SQID, given name (P735)  View with Reasonator View with SQID
    # Indians without first name, 41932 items@27 JUL 2020
    SELECT ?item ?itemLabel WHERE {
     ?item wdt:P31 wd:Q5. 
     ?item wdt:P27 wd:Q668 .
      FILTER NOT EXISTS { ?item wdt:P735 [] }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country of citizenship (P27)  View with Reasonator View with SQID, given name (P735)  View with Reasonator View with SQID
    #Indians with no first name
    SELECT ?item ?itemLabel 
    WHERE {
     ?item wdt:P31 wd:Q5 . 
     ?item wdt:P27 wd:Q668 .
     OPTIONAL {?item wdt:P735 ?givenname} .
     FILTER (!bound(?givenname)) . 
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
    } 
    ORDER BY ASC(?itemLabel)
    

Wikilar Indians (living) without an image[edit]

The following query uses these:

  • Properties: country of citizenship (P27)  View with Reasonator View with SQID, image (P18)  View with Reasonator View with SQID, date of death (P570)  View with Reasonator View with SQID, Twitter (X) username (P2002)  View with Reasonator View with SQID
    # Most 'wikilar' living Indians citizens without an image 
    # Wikilar as per sitelinks
    SELECT ?item ?itemLabel ?itemDescription (COUNT(?sitelink) AS ?sitelinks) ?twitter
    WHERE {
      ?item wdt:P27 wd:Q668 . # item is a citizen of India 
      MINUS { ?item wdt:P18 [] }. # without an image linked at Wikidata
      MINUS { ?item wdt:P570 [] } . # without date of death statement
      ?sitelink schema:about ?item .
        OPTIONAL {?item wdt:P2002 ?twitter .} 
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
    } 
    GROUP BY ?itemLabel ?itemDescription ?twitter ?item HAVING(?sitelinks >= 10) #sitelink count to focus on the “most wikilar” people
    ORDER BY DESC(?sitelinks)
    

Indian centenarians[edit]

  • Related Wikiproject:

The following query uses these:


Indians died in 2021[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country of citizenship (P27)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID, date of death (P570)  View with Reasonator View with SQID
    #title:Indians deceased in 2021 ordered by the number of sitelinks
    SELECT ?person ?sitelinks ?personLabel ?personDescription ?born ?died ?age 
    WHERE{
      ?person wdt:P31 wd:Q5;
              wdt:P27 wd:Q668;
              wdt:P569 ?born;
              wdt:P570 ?died.
      FILTER ( ?died >= "2021-01-01T00:00:00Z"^^xsd:dateTime && ?died <= "2021-12-31T00:00:00Z"^^xsd:dateTime )
      BIND(?died - ?born AS ?ageInDays).
      BIND(?ageInDays/365.2425 AS ?ageInYears).
      BIND(FLOOR(?ageInYears) AS ?age).
      # or, as one expression:
      #BIND(FLOOR((?died - ?born)/365.2425) AS ?age).  # (https://en.wikibooks.org/wiki/SPARQL/Expressions_and_Functions#COUNT,_MIN,_MAX,_AVG_and_SUM)
      ?person wikibase:sitelinks ?sitelinks.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". }
    }
    ORDER BY DESC(?sitelinks)
    

Indian rails without Indian Railways train number (P8180)[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID, Indian Railways train number (P8180)  View with Reasonator View with SQID, start point (P1427)  View with Reasonator View with SQID, destination point (P1444)  View with Reasonator View with SQID
    # Indian rails without Indian Railways train number (P8180)
    SELECT ?item ?itemLabel ?strt ?dest ?itemDescription (COUNT(?sitelink) AS ?sitelinks) ?irtno WHERE {
      ?item wdt:P31 wd:Q15141321.
      ?item wdt:P17 wd:Q668.
     # MINUS { ?item wdt:P8180 [] } . # without Indian Railways train number
      ?sitelink schema:about ?item.
      OPTIONAL {?item wdt:P8180 ?irtno .} 
      OPTIONAL {?item wdt:P1427 ?strt .} 
      OPTIONAL {?item wdt:P1444 ?dest .} 
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?itemLabel ?itemDescription ?twitter ?item ?irtno ?strt ?dest
    ORDER BY DESC (?sitelinks)
    #ORDER BY DESC (?irtno)
    

Indian participants at the 2020 Summer Olympics[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country for sport (P1532)  View with Reasonator View with SQID, participant in (P1344)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID, sport (P641)  View with Reasonator View with SQID, Olympedia people ID (P8286)  View with Reasonator View with SQID, image (P18)  View with Reasonator View with SQID
    #title:Indian participants at the 2020 Summer Olympics
    SELECT ?item ?linkcount ?itemLabel ?genderLabel ?sportsLabel ?eventLabel ?olympedia_people_id
    WHERE {
    ?item wdt:P31 wd:Q5.                   # <<<<<< Item = Human
     ?item wdt:P1532 wd:Q668.                   # <<<<<< Country for sports  = India
      ?item wdt:P1344 ?event.
     ?event ((wdt:P31/wdt:P279*)?/wdt:P361*) wd:Q181278.
       OPTIONAL { ?item wdt:P21 ?gender }
       OPTIONAL { ?item wdt:P641 ?sports }
      OPTIONAL {?item wdt:P8286 ?olympedia_people_id .}
      OPTIONAL { ?item wikibase:sitelinks ?linkcount.}  #count sitelinks
    #  MINUS{?item wdt:P18 [] .}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }    # for generating label
    }
    GROUP BY ?item ?statements ?linkcount ?itemLabel ?genderLabel ?sportsLabel ?eventLabel ?olympedia_people_id
    ORDER BY DESC(?linkcount)
    

Unmarried persons[edit]

Unknown or no values[edit]

There are times when an item has either no value or an unknown value for a given property. Depending on the property, these data values still provide important information about an item and should still be recorded in Wikidata. For example, we could say that Narendra Modi (Q1058) had no value for the child (P40) property, which is quite different than not recording anything at all. We could also say that Sai Baba of Shirdi (Q260440) has an unknown value for the date of birth (P569) property.


The majority of values in Wikidata will be custom values, and are entered in the usual fashion. Unknown values and no values are added to statements by clicking on the icon beside the value field that looks like this .

Unmarried Indians[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country of citizenship (P27)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID, spouse (P26)  View with Reasonator View with SQID
    #Unmarried Indians 
    SELECT ?human ?humanLabel ?genderLabel ?humanDescription ?dob 
    WHERE {
      ?human wdt:P31 wd:Q5 .
      ?human wdt:P27 wd:Q668 .
      ?human p:P26 ?spouceStatement .
      ?spouceStatement a wdno:P26 .
      OPTIONAL { ?human wdt:P21 ?gender. }
      OPTIONAL { ?human wdt:P569 ?dob. }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?human ?humanLabel ?gender ?genderLabel ?humanDescription ?dob
    ORDER BY ?dob
    LIMIT 123
    

Newpapers of India with URL[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID, official website (P856)  View with Reasonator View with SQID
    #Newpapers of India having URL
    SELECT ?item ?itemLabel ?url 
    WHERE {
      ?item wdt:P31/wdt:P279* wd:Q11032.
      ?item wdt:P17 wd:Q668.
      ?item wdt:P856 ?url.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    } 
    order by ?itemLabel
    

Districts of India[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, located in the administrative territorial entity (P131)  View with Reasonator View with SQID
    #districts of India
    SELECT ?item ?itemLabel ?division ?divisionLabel
    WHERE {
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }	# for generating label
      ?item wdt:P31 wd:Q1149652 .
    OPTIONAL { ?item wdt:P131 ?division. }
    }
    ORDER BY ?divisionLabel
    

Awards of India[edit]

The following query uses these:

  • Properties: award received (P166)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID
    # awards of India
    SELECT ?award ?awardLabel ?awardDescription ?recepients
    {
    	{
        SELECT ?award (COUNT(?person) as ?recepients)
    	{
    		?person wdt:P166 ?award.
            ?award wdt:P17 wd:Q668. # of India
        }
    	GROUP BY ?award 
    	ORDER BY DESC(?recepients)
    	LIMIT 123
        }
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } 
    }
    ORDER BY DESC(?recepients)
    

Awards without any recepient[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID, award received (P166)  View with Reasonator View with SQID
    # Indian awards without a recepient, 134 items @18Aug2020  
    SELECT ?award ?linkcount ?awardLabel WHERE {
      ?award wdt:P31 wd:Q618779.
      ?award wdt:P17 wd:Q668.
      OPTIONAL{ ?recipient wdt:P166 ?award }
      FILTER( !BOUND(?recipient))
      OPTIONAL { ?award wikibase:sitelinks ?linkcount. }  #count sitelinks
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    ORDER BY DESC(?linkcount)
    

Padma Awardees of India[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, award received (P166)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID
    # Padma awardees (using UNION), 3759 items @26JAN2022
    SELECT ?item ?linkcount ?itemLabel ?itemDescription ?awardvalLabel ?year WHERE {
     ?item wdt:P31 wd:Q5.                   # <<<<<< Item = Human
     ?item p:P166 ?award.
     ?award ps:P166 ?awardval.
     
    { ?award ps:P166 wd:Q672392. }         # <<<<<< Award = Padma Vibhushan
    UNION { ?award ps:P166 wd:Q84042880.}  # <<<<<< Padma Vibhushan_Public Affairs
    UNION { ?award ps:P166 wd:Q30143915 }  # <<<<<< Padma Vibhushan_Literature
    UNION { ?award ps:P166 wd:Q30147268 }  # <<<<<< Padma Vibhushan_Science and Engineering
    UNION { ?award ps:P166 wd:Q30147343}   # <<<<<< Padma Vibhushan_Trade and Industry
     
    UNION { ?award ps:P166 wd:Q932650. }   # <<<<<< Award = Padma Bhushan
    UNION { ?award ps:P166 wd:Q30197118}   # <<<<<< Padma Bhushan in Sc. & Eng.
    UNION { ?award ps:P166 wd:Q63877754}      # <<<<<< Award = Padma Bhushan in Lit. & Education
    UNION { ?award ps:P166 wd:Q110686881}      # <<<<<< Award = Padma Bhushan in Trade & Industry
    
    UNION { ?award ps:P166 wd:Q949193. }   # <<<<<< Award = Padma Shri
    UNION { ?award ps:P166 wd:Q30132541}   # Art
    UNION { ?award ps:P166 wd:Q30132621}   # Literature & Edu
    UNION { ?award ps:P166 wd:Q30132672}   # Medicine
    UNION { ?award ps:P166 wd:Q30132492}   # Science & Engineering
    UNION { ?award ps:P166 wd:Q30133065}   # Sports
    UNION { ?award ps:P166 wd:Q30132984}   # Social Work
    UNION { ?award ps:P166 wd:Q60671348}   # Trade & Industry
    UNION { ?award ps:P166 wd:Q30132589}   # Civil
    UNION { ?award ps:P166 wd:Q60671291}   # Other
    UNION { ?award ps:P166 wd:Q60671325}   # <<<<<< Padma Shri in Public Aff.
     
    OPTIONAL { ?item wikibase:sitelinks ?linkcount. } # <<<<<< Link count 
    # Award given in year filter 
    OPTIONAL { ?award pq:P585 ?time. }# <<<<<< Award has a time statement 
    BIND(YEAR(?time) AS ?year)
    # filter(year(?time)=2022)                # <<<<<< Filter for Award time = 2022  
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    # Items without the qualifer point in time # Source: Qualifers on a Heritage Register Item (Wikidata:Request_a_query/Archive/2019/01)
    #filter not exists {?item p:P166 [pq:P585 [] ].}  # <<<<<< filter for items without the qualifier point in time 
    }
    #ORDER BY ASC(?itemLabel)
    ORDER BY DESC(?year)
    #ORDER BY DESC(?linkcount)
    

Airports of India[edit]

The following query uses these:

Indian places without image[edit]

The following query uses these:

Features: map (Q24515275)  View with Reasonator View with SQID

#defaultView:Map
# Places under Indian jurisdiction that has no photo
SELECT DISTINCT ?item ?coord {
  ?item wdt:P131+ wd:Q668 .
  MINUS { ?item wdt:P18 [] } .
  OPTIONAL { ?item wdt:P625 ?coord } .
}

Indian Biographical films[edit]

This query will help to find Hindi movies without IMDb.

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, genre (P136)  View with Reasonator View with SQID, country of origin (P495)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, subtitle (P1680)  View with Reasonator View with SQID, original language of film or TV show (P364)  View with Reasonator View with SQID, based on (P144)  View with Reasonator View with SQID, director (P57)  View with Reasonator View with SQID, composer (P86)  View with Reasonator View with SQID
    # Indian Biographical films, 266 items @ 02 AUG 2020
    SELECT
    ?item ?wikis ?itemLabel ?subtitle ?langLabel (GROUP_CONCAT(DISTINCT ?year; SEPARATOR = ", ") AS ?released) ?directorLabel ?composerLabel ?basedonLabel
    WHERE{
        ?item wdt:P31 wd:Q11424 .
        ?item wdt:P136 wd:Q645928.
     ?item wdt:P495 wd:Q668.
      OPTIONAL { ?item wikibase:sitelinks ?wikis. }  #count sitelinks
      OPTIONAL { ?item wdt:P577 ?date . BIND(YEAR(?date) as ?year) }
      OPTIONAL { ?item wdt:P1680 ?subtitle }
      OPTIONAL { ?item wdt:P364 ?lang }
      OPTIONAL { ?item wdt:P144 ?basedon }
      OPTIONAL { ?item wdt:P57 ?director }
      OPTIONAL { ?item wdt:P86 ?composer }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
     GROUP BY ?item ?itemLabel ?subtitle ?langLabel ?directorLabel ?composerLabel ?wikis ?basedonLabel
    ORDER BY DESC(?released)
    

Tenue of the former Prime Ministers of India (Bar Chart)[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, office held by head of government (P1313)  View with Reasonator View with SQID, position held (P39)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, end time (P582)  View with Reasonator View with SQID
    #defaultView:BarChart
    SELECT ?person ?personLabel (xsd:integer(FLOOR(SUM(DISTINCT ?end-?start)/365.2425)) AS ?totalYears) WHERE {
      ?person wdt:P31 wd:Q5;
              p:P39 [
                ps:P39/^wdt:P1313 wd:Q668;
                pq:P580 ?start;
                pq:P582 ?end
              ].
      BIND(xsd:integer(FLOOR((?end-?start)/365.2425)) AS ?years).
      SERVICE wikibase:label { bd:serviceParam wikibase:language "it", "en". }
    }
    GROUP BY ?person ?personLabel
    ORDER BY DESC(?totalYears)
    

List of Indian states with their chief ministers and their ages[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, head of government (P6)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID
    # List of Indian states with their chief ministers and their ages
    SELECT ?state ?stateLabel ?leader ?leaderLabel ?birthdate ?age
    WHERE {
      ?state wdt:P31 wd:Q13390680.
      ?state wdt:P6 ?leader.
    OPTIONAL {
          ?leader wdt:P569 ?birthdate.
    BIND(YEAR(NOW()) - YEAR(?birthdate) - IF(MONTH(NOW()) < MONTH(?birthdate) || (MONTH(NOW()) = MONTH(?birthdate) && DAY(NOW()) < DAY(?birthdate)), 1, 0) AS ?age) .
      }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY ?stateLabel ?leaderLabel