User:Ranjithsiji/Queries

Melakartha Ragas in Carnatic MusicEdit

The following query uses these:

  • Properties: instance of (P31)     , use (P366)     
    1 #Ragas in Carnatic Music
    2 SELECT ?item ?itemLabel 
    3 WHERE 
    4 {
    5   ?item wdt:P31 wd:Q7410264.
    6   ?item wdt:P366 wd:Q956883
    7   SERVICE wikibase:label { bd:serviceParam wikibase:language "ml,en". }
    8 }
    

Janya Ragas in Carnatic MusicEdit

The following query uses these:

  • Properties: instance of (P31)     , use (P366)     
    1 #Ragas in Carnatic Music
    2 SELECT ?item ?itemLabel 
    3 WHERE 
    4 {
    5   ?item wdt:P31 wd:Q3534390.
    6   ?item wdt:P366 wd:Q956883
    7   SERVICE wikibase:label { bd:serviceParam wikibase:language "ml,en". }
    8 }
    

Female Scientists in WikidataEdit

The following query uses these:

Women Politicians in IndaEdit

The following query uses these:

Country ListsEdit

The following query uses these:

  • Properties: instance of (P31)     
    1 # List of countries
    2 SELECT ?country ?label_en ?label_ml
    3 WHERE
    4 {
    5   ?country wdt:P31 wd:Q6256.
    6   ?country rdfs:label ?label_en filter (lang(?label_en) = "en").
    7   ?country rdfs:label ?label_ml filter (lang(?label_ml) = "ml").
    8 }
    

Missing Labels in a DistrictEdit

The following query uses these:

  • Properties: located in the administrative territorial entity (P131)     
     1 # List of Places
     2 SELECT ?item ?itemLabel ?itemDescription WHERE {
     3 ?item wdt:P131 wd:Q2429655.
     4 
     5  SERVICE wikibase:label { bd:serviceParam wikibase:language "ml,en". }
     6  FILTER(NOT EXISTS {
     7    ?item rdfs:label ?lang_label.
     8    FILTER(LANG(?lang_label) = "en")
     9  })
    10 }
    11 ORDER BY ?itemLabel
    

US ScientistsEdit

US citizens whose occupation is a subclass of scientist:

The following query uses these:

  • Properties: instance of (P31)     , country of citizenship (P27)     , occupation (P106)     , subclass of (P279)     
     1 # List of SCientists
     2 SELECT ?item ?itemLabel ?article WHERE {
     3   ?item wdt:P31 wd:Q5.
     4   ?item wdt:P27 wd:Q30.
     5   ?item wdt:P106 ?occupation.
     6   ?occupation wdt:P279 wd:Q901.
     7   ?article schema:about ?item.
     8   ?article schema:inLanguage "en".
     9   ?article schema:isPartOf <https://en.wikipedia.org/>.
    10   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    11 }
    12 GROUP BY ?item ?itemLabel ?article
    13 ORDER BY ?itemLabel
    14 LIMIT 1000
    

Districts in a State of IndiaEdit

The following query uses these:

The following query uses these:

Grampanchayats in KeralaEdit

The following query uses these:

Municipalities in KeralaEdit

The following query uses these:

  • Properties: instance of (P31)     , located in the administrative territorial entity (P131)     
     1 SELECT ?item ?len ?lml ?district ?dsten ?dstml ?dsthi WHERE {
     2   ?item wdt:P31 wd:Q15284.
     3   ?item wdt:P131/wdt:P131* wd:Q1186.
     4   ?item wdt:P131 ?district.
     5   OPTIONAL { ?item wdt:P131 ?division. ?division wdt:P31 wd:Q24943410 }
     6   OPTIONAL { ?item rdfs:label ?Lang. FILTER(LANG(?Lang)="ml") }
     7   OPTIONAL { ?item rdfs:label ?len. FILTER(LANG(?len)="en") }
     8   OPTIONAL { ?item rdfs:label ?lml. FILTER(LANG(?lml)="ml") }
     9   OPTIONAL { ?item schema:description ?den. FILTER(LANG(?den)="en") }
    10   OPTIONAL { ?item schema:description ?dml. FILTER(LANG(?dml)="ml") }
    11   OPTIONAL { ?district rdfs:label ?dsten. FILTER(LANG(?dsten)="en") }
    12   OPTIONAL { ?district rdfs:label ?dstml. FILTER(LANG(?dstml)="ml") }
    13   OPTIONAL { ?district rdfs:label ?dsthi. FILTER(LANG(?dsthi)="hi") }
    14 }
    

Temples in Ernakulam without English LabelsEdit

Used to fill the gaps in labels

# Temples in Ernakulam without English Labels
SELECT ?item ?itemLabel ?qid WHERE 
{
    ?item wdt:P31 wd:Q842402.
  ?item wdt:P131 wd:Q1356097.
  OPTIONAL {
    ?item rdfs:label ?label .
    FILTER(LANG(?label) = 'en') .
  }
  FILTER(!BOUND($label)) .
  BIND (strafter(str(?item), str(wd:)) AS ?qid)
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'ml' }
}

Try it!

The qid is filtered with the last bind command.

Tamil films without Malayalam LabelsEdit

Used to fill the gaps in labels

# Tamil films without malayalam Labels
SELECT ?item ?itemLabel ?dr ?drlabel ?itemDescription ?qid (year(?year) as ?yr ) WHERE 
{
  ?item wdt:P31 wd:Q11424.
  ?item wdt:P364 wd:Q5885.
  ?item wdt:P577 ?year.
  ?item wdt:P57 ?dr
  OPTIONAL {
    ?item rdfs:label ?label .
    ?item rdfs:descriptipn ?desc .
    FILTER(LANG(?desc) = 'ml') .
  }
    OPTIONAL { ?dr rdfs:label ?drlabel. FILTER(LANG(?drlabel)="ml") }

  FILTER(!BOUND($label)) .
  BIND (strafter(str(?item), str(wd:)) AS ?qid)
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}

Try it!

The qid is filtered with the last bind command.

Malayalam films without Malayalam LabelsEdit

Used to fill the gaps in labels

# Created by User:Ranjithsiji
# Malayalam films without Malayalam Description in Wikidata
SELECT ?item ?len ?lml ?itemdesc {
  ?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") }
  FILTER(NOT EXISTS {
    ?item schema:description ?itemdesc.
    FILTER(LANG(?itemdesc) = "ml") # with missing Dutch description
  })
  }

Try it!

Remove the comment in the query for labels also

Schools in Thrissur DistrictEdit

Used to fill the gaps in labels

# Created by User:Jinoy
# Schools in Thrissur District
#defaultView:Map
SELECT ?item ?ilLang ?geo ?U_DISE_code WHERE {
  { ?item wdt:P31 wd:Q9826. }
  UNION
  { ?item wdt:P31 wd:Q64063386. }
  UNION
  { ?item wdt:P31 wd:Q64063317. }
  UNION
  { ?item wdt:P31 wd:Q64062731. }
  ?item (wdt:P131*) wd:Q2429655.
  OPTIONAL {
    ?item rdfs:label ?ilLang.
    FILTER((LANG(?ilLang)) = "ml")
  }
  OPTIONAL { ?item wdt:P625 ?geo. }
  OPTIONAL { ?item wdt:P6391 ?U_DISE_code. }
}

Try it!

Schools in Thrissur District