Wikidata:WikiProject Kosovo/Maintenance Queries

From Wikidata
Jump to navigation Jump to search

SPARQL queries[edit]

# Kosovo citiziens that have an article in EN or DE wiki but not in SQ
SELECT ?item ?itemLabel (COUNT(distinct ?article) as ?count)
{
    {
        SELECT ?item
        {
            {
                hint:Query hint:optimizer "None" .   
                ?item wdt:P31 wd:Q5  .
                ?item wdt:P27 wd:Q1246 .
                MINUS {?sitelinksq schema:about ?item . ?sitelinksq schema:isPartOf <https://sq.wikipedia.org/>}
            }
          ?article schema:about ?item .
              {
            ?article schema:isPartOf <https://de.wikipedia.org/>
              }
             UNION 
              {
            ?article schema:isPartOf <https://en.wikipedia.org/>
              }
        }
    }
    ?article schema:about ?item .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" }
}
GROUP BY ?item ?itemLabel
ORDER BY DESC(?count)
Try it!

# This query shows all the Kosovo people whose label is missing

SELECT ?person ?item ?itemLabel ?itemDescription WHERE {
 ?item wdt:P31 wd:Q5.  
 ?item wdt:P27 wd:Q1246.

SERVICE wikibase:label { bd:serviceParam wikibase:language "en, sq". }
 FILTER(NOT EXISTS {
   ?item rdfs:label ?lang_label.
   FILTER(LANG(?lang_label) = "sq") 
 })
}
ORDER BY ?itemLabel
Try it!

Petscan queries[edit]