User:Ranjithsiji/Queries
Dams in India
[edit]The following query uses these:
- Items: dam (Q12323) , India (Q668)
- Properties: subclass of (P279) , instance of (P31) , country (P17)
#Dams in India SELECT DISTINCT ?item ?itemLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ml". } { SELECT DISTINCT ?item WHERE { ?item p:P31 ?statement0. ?statement0 (ps:P31/(wdt:P279*)) wd:Q12323. ?item p:P17 ?statement1. ?statement1 (ps:P17/(wdt:P279*)) wd:Q668. } } }
Dams in Kerala
[edit]The following query uses these:
- Items: dam (Q12323) , India (Q668) , Kerala (Q1186)
- Properties: instance of (P31) , country (P17) , located in the administrative territorial entity (P131)
#Dams in Kerala SELECT ?item ?len ?dsten WHERE { ?item wdt:P31 wd:Q12323. ?item wdt:P17 wd:Q668. ?item wdt:P131/wdt:P131* wd:Q1186. ?item wdt:P131 ?district. OPTIONAL { ?district rdfs:label ?dsten. FILTER(LANG(?dsten)="en") } OPTIONAL { ?item rdfs:label ?len. FILTER(LANG(?len)="en") } }
Melakartha Ragas in Carnatic Music
[edit]The following query uses these:
- Properties: instance of (P31) , has use (P366)
#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) , has use (P366)
#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:
- Items: human (Q5) , female (Q6581072) , scientist (Q901)
- Properties: instance of (P31) , sex or gender (P21) , occupation (P106)
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:
- Items: human (Q5) , female (Q6581072) , politician (Q82955) , India (Q668)
- Properties: instance of (P31) , sex or gender (P21) , occupation (P106) , country of citizenship (P27)
SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q5. ?item wdt:P21 wd:Q6581072. ?item wdt:P106 wd:Q82955. ?item wdt:P27 wd:Q668. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Country Lists
[edit]The following query uses these:
- Items: country (Q6256)
- Properties: instance of (P31)
# 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:
- Items: Thrissur district (Q2429655)
- Properties: located in the administrative territorial entity (P131)
# 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) , country of citizenship (P27) , occupation (P106) , subclass of (P279)
# 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:
- Properties: instance of (P31) , located in the administrative territorial entity (P131)
# List of Districts in India SELECT ?item ?itemLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q1149652. ?item wdt:P131 wd:Q1162. SERVICE wikibase:label { bd:serviceParam wikibase:language "ml". } }
The following query uses these:
- Properties: instance of (P31) , located in the administrative territorial entity (P131)
# List of Districts in India SELECT ?item ?itemLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q1149652. ?item wdt:P131 ?division. ?division wdt:P131 wd:Q1164 SERVICE wikibase:label { bd:serviceParam wikibase:language "ml". } }
Grampanchayats in Kerala
[edit]The following query uses these:
- Items: Gram panchayat (Q2732840) , Kerala (Q1186)
- Properties: instance of (P31) , located in the administrative territorial entity (P131)
# List of Grampanchayats in Kerala SELECT ?item ?ilml WHERE { ?item wdt:P31 wd:Q2732840; (wdt:P131*) wd:Q1186. OPTIONAL { ?item rdfs:label ?ilml. FILTER((LANG(?ilml)) = "ml") } }
Municipalities in Kerala
[edit]The following query uses these:
- Properties: instance of (P31) , located in the administrative territorial entity (P131)
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' }
}
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' }
}
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 ?den ?itemdesc {
?item wdt:P31 wd:Q11424.
?item wdt:P364 wd:Q36236
OPTIONAL { ?item rdfs:label ?len. FILTER(LANG(?len)="en") }
OPTIONAL { ?item schema:description ?den. FILTER(LANG(?den)="en") }
OPTIONAL { ?item rdfs:label ?lml. FILTER(LANG(?lml)="ml") }
# 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
})
}
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. }
}
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 { }
}
Schools in Alappuzha District