User:AramBot

From Wikidata
Jump to navigation Jump to search
Wikidata Bot This user account is a bot with a bot flag. The bot is operated by Aram.
  • Block this bot if it is malfunctioning.
  • Check its work.
  • Contact the operator about mistakes.
  • See all Requests for Permissions related to this bot: 1
  • License:

Hi there, my main project is ckbwiki. Please let me know on my operator's talk page if you notice anything wrong with my actions.

AramBot, much like Wall-E, works hard to keep the environment tidy and clean.

Tasks

[edit]
# Description Execution time Auto/Manual
1 In ckbwiki, the bot searches the recent changes and then goes to Wikidata; adds missing 'ckb' label to pages that do not have it, updates outdated labels, and deletes those that are identical to the 'mul' label. Daily at 23:00 (UTC) Auto
2 Adds ckbwiki sitelinks for new articles only. Daily, every six hours at 12:00 AM, 6:00 AM, 12:00 PM, and 6:00 PM Auto

Queries

[edit]

Here are the queries I'm using. I will give credit to others.

Central Kurdish Wikipedia pages with missing labels on Wikidata

[edit]
SELECT DISTINCT ?item ?articleLabel
WHERE {
  ?article schema:about ?item ;
           schema:inLanguage "ckb" ;
           schema:isPartOf <https://ckb.wikipedia.org/> ;
           schema:name ?articleLabel .
  
  FILTER NOT EXISTS { 
    ?item rdfs:label ?label . 
    FILTER (lang(?label) = "ckb") 
  }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb". }
}
Try it!

Central Kurdish Wikipedia articles with missing descriptions on Wikidata

[edit]

None of these methods are very accurate, but you can get something at least.

First method

[edit]
SELECT DISTINCT ?item ?articleLabel
WHERE {
  ?article schema:about ?item ;
           schema:inLanguage "ckb" ;
           schema:isPartOf <https://ckb.wikipedia.org/> ;
           schema:name ?articleLabel .

  FILTER NOT EXISTS { 
    ?item schema:description ?description . 
    FILTER (lang(?description) = "ckb") 
  }

  ?item wdt:P31 ?type .
  FILTER (?type NOT IN (
    wd:Q4167836,     # Wikimedia category
    wd:Q15647814,    # Wikimedia administration category
    wd:Q11266439,    # Wikimedia template
    wd:Q15184295,    # Wikimedia module
    wd:Q116152754,   # Wikimedia submodule
    wd:Q107344376,   # Wikimedia module configuration
    wd:Q20010800,    # Wikimedia user language category
    wd:Q59259626,    # Wikimedia module using Wikidata
    wd:Q18711811,    # map data module
    wd:Q19887878,    # Wikimedia infobox template
    wd:Q19842659,    # Wikimedia user language template
    wd:Q115595777,   # taxonomy template
    wd:Q20769160,    # Wikimedia userbox template
    wd:Q116152698,   # Wikimedia subtemplate
    wd:Q11753321,    # Wikimedia navigational template
    wd:Q97303168,    # Wikimedia deletion template
    wd:Q108783631,   # Wikimedia country data template
    wd:Q110010043,   # Wikimedia copyright template
    wd:Q97950663,    # Wikimedia citation template
    wd:Q112869585,   # Wikimedia stub template
    wd:Q108094999,   # Wikimedia sidebar template
    wd:Q4663903      # Wikimedia portal
  ))
}
Try it!

Second method

[edit]
SELECT DISTINCT ?item ?articleLabel
WHERE {
  ?article schema:about ?item ;
           schema:inLanguage "ckb" ;
           schema:isPartOf <https://ckb.wikipedia.org/> ;
           schema:name ?articleLabel .

  FILTER NOT EXISTS { 
    ?item schema:description ?description . 
    FILTER (lang(?description) = "ckb") 
  }

  OPTIONAL {
    ?item schema:description ?enDescription .
    FILTER (lang(?enDescription) = "en")
  }

  FILTER (!CONTAINS(LCASE(?enDescription), "wikimedia template"))
  FILTER (!CONTAINS(LCASE(?enDescription), "wikimedia category"))
  FILTER (!CONTAINS(LCASE(?enDescription), "wikimedia module"))
}
Try it!

All ckbwiki templates that have an item on Wikidata

[edit]
SELECT ?title WHERE {
  ?page schema:about ?wikidataItem .
  ?page schema:isPartOf <https://ckb.wikipedia.org/> .
  ?page schema:name ?encodedTitle .
  BIND(REPLACE(STR(?encodedTitle), "_", " ") AS ?title)
  FILTER(CONTAINS(?title, "داڕێژە:"))
}
Try it!

All cities in Iran not yet created on Central Kurdish Wikipedia

[edit]
SELECT ?city ?cityLabel
WHERE {
  ?city wdt:P31 wd:Q56557504 .  # city of Iran
  OPTIONAL {
    ?article_ckb schema:about ?city.
    ?article_ckb schema:inLanguage "ckb".
    ?article_ckb schema:isPartOf <https://ckb.wikipedia.org/>.
  }
  FILTER(!BOUND(?article_ckb))  # Exclude cities with articles in ckb Wikipedia
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Note: Do you see the exclamation mark (!)? If you remove it, you will only get all the articles created on Central Kurdish Wikipedia. In other words, you will get the opposite result here.

Top 1000 categories available on most wikis, but not on Central Kurdish Wikipedia

[edit]

Credit: User:TomT0m@wikidata is the original author of the first version of this query. See: https://w.wiki/BKZJ

This is really useful for small (and mid-sized) wikis to get started. See w:ckb:ویکیپیدیا:ڕاپۆرتی بنکەدراوە/پۆلە گرنگە دروست نەکراوەکان

SELECT ?item ?enLabel ?numOfSitelinks {
  ?item wdt:P31 wd:Q4167836 .
  ?item wikibase:sitelinks ?numOfSitelinks . hint:Prior hint:rangeSafe "true" .
  ?item rdfs:label ?enLabel.
  filter(lang(?enLabel) = "en")
  filter (?numOfSitelinks > 70) 
  MINUS {
    ?cat schema:isPartOf <https://ckb.wikipedia.org/> ;
         schema:about ?item .
  }
} ORDER BY DESC(?numOfSitelinks) LIMIT 1000
Try it!

You can do the same for other topics such as below one.

Top 100 Biography articles available on most wikis, but not yet created on Central Kurdish Wikipedia

[edit]

Referenced from above query.

SELECT ?item ?enwiki ?numOfSitelinks ?genderLabel (GROUP_CONCAT(DISTINCT ?citizenshipLabel; separator="؛ ") AS ?citizenships)
WHERE {
  {
    SELECT DISTINCT ?item ?enwiki ?numOfSitelinks ?genderLabel ?citizenshipLabel
    WHERE {
      ?item wdt:P31 wd:Q5 .
      ?item wikibase:sitelinks ?numOfSitelinks . 
      hint:Prior hint:rangeSafe "true" .
      FILTER (?numOfSitelinks > 70) 
      
      OPTIONAL {
        ?item wdt:P21 ?gender .
        ?gender rdfs:label ?genderLabel .
        FILTER(LANG(?genderLabel) = "ckb")
      }
      
      OPTIONAL {
        ?item wdt:P27 ?citizenship .
        ?citizenship rdfs:label ?citizenshipLabel .
        FILTER(LANG(?citizenshipLabel) = "ckb")
      }
      
      OPTIONAL {
        ?enwikiPage schema:about ?item ;
                    schema:isPartOf <https://en.wikipedia.org/> ;
                    schema:name ?enTitle .
        BIND(CONCAT("[[:en:", ?enTitle, "|", ?enTitle, "]]") AS ?enwiki)
      }
      
      MINUS {
        ?cat schema:isPartOf <https://ckb.wikipedia.org/> ;
             schema:about ?item .
      }
    }
  }
}
GROUP BY ?item ?enwiki ?numOfSitelinks ?genderLabel
ORDER BY DESC(?numOfSitelinks) 
LIMIT 100
Try it!