Showing posts with label SPARQL. Show all posts
Showing posts with label SPARQL. Show all posts

Friday, 20 June 2025

Description of football player, Gender, Country

 https://w.wiki/EXLz


Saturday, 10 February 2024

Adding category using PAWD

First 

let us collect the wikipedia articles that has no category of people who died in 2023 using sparql

Sample : Link

Second:

Extract the title using MS Excel


Third

Paste the article title in PAWS as given below

PAWS

------------

import pywikibot


def add_category_to_article(page_title, category):

    site = pywikibot.Site('ml', 'wikipedia')  # Malayalam Wikipedia

    page = pywikibot.Page(site, page_title)


    # Check if the page exists

    if not page.exists():

        print(f"Page '{page_title}' does not exist.")

        return


    # Check if the page already has the category

    if category in page.categories():

        print(f"Page '{page_title}' already has the category '{category}'.")

        return


    # Add the category to the page

    page.text += f"\n[[വർഗ്ഗം:{category}]]"

    page.save(f"കാറ്റഗറി ചേർക്കുന്നു '{category}' ")


def main():

    articles = [

"എസ്ഥേർ_ഈല്ലം",

"ദരൂഷ്_മെഹ്‌റൂജി"



    ]


    category = "2023-ൽ മരിച്ചവർ"


    for article in articles:

        add_category_to_article(article, category)


if __name__ == "__main__":

    main()



Fourth

Run the python file.



NB: Note, there should not be comma after the last title in python and recheck the category name properly.

It is based on wikidata statement: Date of death.

Wednesday, 29 March 2023

Commons Query

 To Get file names that are not available in your languae

Link


Codes

SELECT ?file ?title ?captionEn ?captionMl ?img_

WITH

{

  SELECT ?file ?title

  WHERE

  {

    SERVICE wikibase:mwapi

    {

      bd:serviceParam wikibase:api "Search" .

      bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .

      bd:serviceParam mwapi:srsearch "deepcategory:\"Otto von Bismarck by year\" prefix:File:" .

      bd:serviceParam mwapi:srlimit "max" .

      ?title wikibase:apiOutput mwapi:title .

      ?pageid wikibase:apiOutput "@pageid" .

    }

    BIND (URI(CONCAT('https://commons.wikimedia.org/entity/M', ?pageid)) AS ?file)

  }

} AS %get_files

WHERE

{

  INCLUDE %get_files

  # ?file wdt:P180 ?depicts ?img_.

  # service <https://query.wikidata.org/sparql> {

  #   OPTIONAL {?depicts rdfs:label ?depicts_label FILTER (lang(?depicts_label) = 'en') } 

  # }

  OPTIONAL { ?file rdfs:label ?captionEn FILTER (lang(?captionEn) = 'en') }

  OPTIONAL { ?file rdfs:label ?captionMl FILTER (lang(?captionMl) = 'ml') }

    optional {

    ?item wdt:P18 ?img_ .

  }

  bind (if(bound(?img_), 

           ?img_, 

           <http://commons.wikimedia.org/wiki/Special:FilePath/File:Profile_avatar_placeholder_large.png>) as ?image)

} order by desc(?date)

Tuesday, 10 January 2023

WD item do not have ml labels - Category

 https://w.wiki/6D5m

Items that do not have labels in ml

 Query 

https://w.wiki/6D4n 

Wednesday, 31 August 2022

UAE School and Webites

 List of Schools in UAE  277

Schools with websites : 59

School without websites: 218

Wednesday, 17 August 2022

UAE Archeological sites that do not have located territory

 Query link

#UAE Archelogical sites that do not lave located territory 

SELECT ?item ?itemLabel 

WHERE 

{

  ?item wdt:P361 wd:Q3962347. # Archelogical sites

   MINUS {

    ?item p:P131 ?statement1.

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language

}}


Thursday, 21 July 2022

Missing descriptions of Indonesian primary schools

https://w.wiki/5UzK 

 https://w.wiki/5UqN 

Science des

https://w.wiki/5UqT 



Sunday, 5 June 2022

Schools with out Coordinates in UAE

Schools


Schools - Without wbsites

Sunday, 1 August 2021

Missing description for chess players

Chess Players 

 https://w.wiki/3mYD 


missing Labels in wikimedia category

https://w.wiki/3n6m  

SELECT ?item ?len {
  ?item wdt:P31 wd:Q4167836.
  ?item rdfs:label ?len. FILTER(LANG(?len)="en")
  FILTER NOT EXISTS { ?item rdfs:label ?lml. FILTER(LANG(?lml)="ml") }
}
LIMIT 100


Items with less than 11 statements in  ml wiki
https://w.wiki/3$bP

Thursday, 19 December 2019

SPARQL query to find out all female scientists with no Arabic but an English article

SPARQL query to find out all female scientists with no Arabic but an English article.


SELECT DISTINCT ?item ?entitle ?enarticle WHERE {
  ?item wdt:P31 wd:Q5;
        wdt:P106/wdt:P279* wd:Q901;
        wdt:P21 wd:Q6581072.
  MINUS {
    ?ararticle schema:about ?item;
               schema:isPartOf <https://ar.wikipedia.org/>.
  }
  ?enarticle schema:about ?item;
             schema:name ?entitle;
             schema:isPartOf <https://en.wikipedia.org/>.

}


Courtesy - Lucas Werkmeister
 [Dec 18, 2019 12:01:27 AM
It is his version: https://w.wiki/E4X

Tuesday, 1 October 2019

Missing descriptions in ml districts

To add description.
Located in the administrative territorial entity - p131
Malappuram district (Q1030918)


#no description
SELECT ?item ?itemLabel?itemLabel_ml WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P131 wd:Q1030918.
  optional {?item rdfs:label ?itemLabel_ml . filter(lang(?itemLabel_ml)="ml")}
  filter not exists {?item schema:description ?itemDesc_ml . filter(lang(?itemDesc_ml)="ml")}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 200


Wednesday, 31 July 2019

SPARQL query to finding wikidata items Which does not have descriptions

#no description
SELECT ?item ?itemLabel ?itemLabel_ml
WHERE 
{
  ?item wdt:P106 wd:Q11900058 .
  optional {?item rdfs:label ?itemLabel_ml . filter(lang(?itemLabel_ml)="ml")}
  filter not exists {?item schema:description ?itemDesc_ml . filter(lang(?itemDesc_ml)="ml")}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
by - Tagishsimon (talk)

My SPARQL query to finding wikidata items Which does not have labels

I would like to get SPARQL query for finding wikidata items ( ?item wdt:P106 wd:Q11900058 ) Which does not have labels and descriptions in language(ml/ar). So that I can add labels and descriptions in those languages. --Akbarali (talk) 09:56, 16 July 2019 (UTC)

#no label
SELECT ?item ?itemLabel ?itemDesc_ml
WHERE 
{
  ?item wdt:P106 wd:Q11900058 .
  filter not exists {?item rdfs:label ?itemLabel_ml . filter(lang(?itemLabel_ml)="ml")}
  optional {?item schema:description ?itemDesc_ml . filter(lang(?itemDesc_ml)="ml")}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

To try this
Prepared Credit for Tagishsimon