User:Ranjithsiji/Queries

From Wikidata
Jump to navigation Jump to search

Dams in Kerala

[edit]

The following query uses these:

Melakartha Ragas in Carnatic Music

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, has use (P366)  View with Reasonator View with SQID
    #Ragas in Carnatic Music
    SELECT ?item ?itemLabel 
    WHERE 
    {
      ?item wdt:P31 wd:Q7410264.
      ?item wdt:P366 wd:Q956883
      SERVICE wikibase:label { bd:serviceParam wikibase:language "ml,en". }
    }
    

Janya Ragas in Carnatic Music

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, has use (P366)  View with Reasonator View with SQID
    #Ragas in Carnatic Music
    SELECT ?item ?itemLabel 
    WHERE 
    {
      ?item wdt:P31 wd:Q3534390.
      ?item wdt:P366 wd:Q956883
      SERVICE wikibase:label { bd:serviceParam wikibase:language "ml,en". }
    }
    

Female Scientists in Wikidata

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel WHERE {
      ?item wdt:P31 wd:Q5;
        wdt:P21 wd:Q6581072;
        wdt:P106 wd:Q901.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Women Politicians in Inda

[edit]

The following query uses these:

Country Lists

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    # List of countries
    SELECT ?country ?label_en ?label_ml
    WHERE
    {
      ?country wdt:P31 wd:Q6256.
      ?country rdfs:label ?label_en filter (lang(?label_en) = "en").
      ?country rdfs:label ?label_ml filter (lang(?label_ml) = "ml").
    }
    

Missing Labels in a District

[edit]

The following query uses these:

  • Properties: located in the administrative territorial entity (P131)  View with Reasonator View with SQID
    # List of Places
    SELECT ?item ?itemLabel ?itemDescription WHERE {
    ?item wdt:P131 wd:Q2429655.
    
     SERVICE wikibase:label { bd:serviceParam wikibase:language "ml,en". }
     FILTER(NOT EXISTS {
       ?item rdfs:label ?lang_label.
       FILTER(LANG(?lang_label) = "en")
     })
    }
    ORDER BY ?itemLabel
    

US Scientists

[edit]

US citizens whose occupation is a subclass of scientist:

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, occupation (P106)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    # List of SCientists
    SELECT ?item ?itemLabel ?article WHERE {
      ?item wdt:P31 wd:Q5.
      ?item wdt:P27 wd:Q30.
      ?item wdt:P106 ?occupation.
      ?occupation wdt:P279 wd:Q901.
      ?article schema:about ?item.
      ?article schema:inLanguage "en".
      ?article schema:isPartOf <https://en.wikipedia.org/>.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    GROUP BY ?item ?itemLabel ?article
    ORDER BY ?itemLabel
    LIMIT 1000
    

Districts in a State of India

[edit]

The following query uses these:

The following query uses these:

Grampanchayats in Kerala

[edit]

The following query uses these:

Municipalities in Kerala

[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
    SELECT ?item ?len ?lml ?district ?dsten ?dstml ?dsthi WHERE {
      ?item wdt:P31 wd:Q15284.
      ?item wdt:P131/wdt:P131* wd:Q1186.
      ?item wdt:P131 ?district.
      OPTIONAL { ?item wdt:P131 ?division. ?division wdt:P31 wd:Q24943410 }
      OPTIONAL { ?item rdfs:label ?Lang. FILTER(LANG(?Lang)="ml") }
      OPTIONAL { ?item rdfs:label ?len. FILTER(LANG(?len)="en") }
      OPTIONAL { ?item rdfs:label ?lml. FILTER(LANG(?lml)="ml") }
      OPTIONAL { ?item schema:description ?den. FILTER(LANG(?den)="en") }
      OPTIONAL { ?item schema:description ?dml. FILTER(LANG(?dml)="ml") }
      OPTIONAL { ?district rdfs:label ?dsten. FILTER(LANG(?dsten)="en") }
      OPTIONAL { ?district rdfs:label ?dstml. FILTER(LANG(?dstml)="ml") }
      OPTIONAL { ?district rdfs:label ?dsthi. FILTER(LANG(?dsthi)="hi") }
    }
    

Temples in Ernakulam without English Labels

[edit]

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 Labels

[edit]

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 Labels

[edit]

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 District

[edit]

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

Schools in Alappuzha District

[edit]

Used to fill the gaps in labels

SELECT ?item ?ilml ?ilen ?kscode ?udisecode 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:Q928959.
  OPTIONAL {
    ?item rdfs:label ?ilml.
    FILTER((LANG(?ilml)) = "ml")
  }
  OPTIONAL {
    ?item rdfs:label ?ilen
    FILTER((LANG(?ilen)) = "en")
  }
  ?item wdt:P7065 ?kscode.
  ?item wdt:P6391 ?udisecode.
  OPTIONAL {  }
}
Try it!

Schools in Alappuzha District