Bikarhêner:Balyozxane/Notên ji workshopa wîkîdaneyê

Small wiki toolkits <> Kurdish Wikimedians Writing Wikidata Queries 9 April 2021 Mahir Morshed (User:Mahir256

Links


Intro slides: https://reasonator.toolforge.org/?q=Q213189


https://reasonator.toolforge.org/?q=Q12233160

https://reasonator.toolforge.org/?q=Q132754

https://reasonator.toolforge.org/?q=Q100596812

https://reasonator.toolforge.org/?q=Q23857533

https://reasonator.toolforge.org/?q=Q2041543


https://ringgaard.com/kb/Q31779923

https://ringgaard.com/kb/Q73787425


https://ringgaard.com/kb/Q97167929

https://ringgaard.com/kb/Q3088356

https://ringgaard.com/kb/Q90221263

https://ringgaard.com/kb/Q2582732


https://www.wikidata.org/wiki/Q15698423

https://www.wikidata.org/wiki/Q29976875

https://www.wikidata.org/wiki/Q17863945

https://www.wikidata.org/wiki/Q724555

https://www.wikidata.org/wiki/Q57306

https://www.wikidata.org/wiki/Q62513493

Query examples https://query.wikidata.org/ :

   
    # Get all items that are mosques
    SELECT * { ?i wdt:P31 wd:Q32815 }
    Ctrl-Space for autocomplete of items/properties
    
    # Get all items that are mosques and the labels for those items
    SELECT * { ?i wdt:P31 wd:Q32815 . ?i rdfs:label ?iLabel . }
    
    # Get all items that are mosques and the labels for those items in Kurmanji first, then Sorani if unavailable, then English
    SELECT ?i ?iLabel {
  ?i wdt:P31 wd:Q32815 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ku,ckb,en". }
}

# Get all items that are mosques and the labels, descriptions, and aliases for those items in Kurmanji first, then Sorani if unavailable, then English
SELECT ?মসজিদ ?মসজিদLabel ?মসজিদDescription ?মসজিদAltLabel {
  ?মসজিদ wdt:P31 wd:Q32815 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb,en". }
}

# Get all people who are male and who died in 1967, along with their labels, descriptions, aliases, and specific dates of death
SELECT ?person ?personLabel ?personDescription ?personAltLabel ?dod {
  ?person wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581097 ; wdt:P570 ?dod . FILTER(YEAR(?dod) = 1967)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb,en". }
}

# Get all people who are male and who died in 1967, who have articles on Sorani Wikipedia, along with their labels, descriptions, aliases, and specific dates of death
SELECT ?person ?personLabel ?personDescription ?personAltLabel ?dod ?sitelink {
  ?person wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581097 ; wdt:P570 ?dod . FILTER(YEAR(?dod) = 1967)
  ?sitelink schema:about ?person ; schema:name ?name ; schema:isPartOf <https://ckb.wikipedia.org/> .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb,en". }
}

# Get all people who are male and who have featured articles on Sorani Wikipedia, along with their labels, descriptions, and aliases
SELECT ?person ?personLabel ?personDescription ?personAltLabel ?sitelink {
  ?person wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581097 . 
  ?sitelink schema:about ?person ; schema:name ?name ; schema:isPartOf <https://ckb.wikipedia.org/> ; wikibase:badge wd:Q17437796 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb,en". }
}

# Get all people who are male, who have featured articles on Sorani Wikipedia, who have country qualifiers on their place of birth, along with their labels, descriptions, and aliases
SELECT ?person ?personLabel ?personDescription ?personAltLabel ?sitelink ?pob ?pobLabel ?country ?countryLabel {
  ?person wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581097 . 
  ?sitelink schema:about ?person ; schema:name ?name ; schema:isPartOf <https://ckb.wikipedia.org/> ; wikibase:badge wd:Q17437796 .
  ?person p:P19 [ ps:P19 ?pob ; pq:P17 ?country ] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb,en". }
}

# Get all people whose "instance of" statements are cited to Sorani Wikipedia, along with their labels, descriptions, and aliases
SELECT ?person ?personLabel ?personDescription ?personAltLabel {
  ?person wdt:P31 wd:Q5 .
  ?person p:P31 [ ps:P31 ?pob ; prov:wasDerivedFrom [ pr:P143 wd:Q4115463 ] ] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ckb,en". }
}

# Get all items and their "instance of/subclass of" values that match the search result for "Wikidata" on the Kurmanji Wikipedia
SELECT ?item ?type ?itemLabel ?typeLabel WHERE { {
  SELECT ?item WHERE {
    SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:endpoint "ku.wikipedia.org" ;
      wikibase:api "Generator" ; mwapi:generator "search" ;
      mwapi:gsrsearch "Wikidata" ; mwapi:gsrlimit "max".
      ?item wikibase:apiOutputItem mwapi:item .
    } } LIMIT 100
  }
  hint:Prior hint:runFirst "true" . ?item wdt:P31|wdt:P279 ?type .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ku,en". }
} LIMIT 100

# Get names of categories tied to the Sorani article on "Frederic Chopin"
SELECT ?item ?title ?category ?sitelink WHERE {
  SERVICE wikibase:mwapi { 
    bd:serviceParam wikibase:api "Categories";
    wikibase:endpoint "ckb.wikipedia.org";
    wikibase:limit 50; mwapi:titles "فرێدریک شۆپان".
    ?title wikibase:apiOutput mwapi:title.
    ?category wikibase:apiOutput mwapi:category.
  }
}

# Get items for colleges in Salahaddin University based on membership in a Sorani Wikipedia category
SELECT * WHERE {
  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:endpoint "ckb.wikipedia.org";
    wikibase:api "Generator"; mwapi:generator "categorymembers";
    mwapi:gcmtitle "پۆل:کۆلێژەکانی زانکۆی سەلاحەدین" ; mwapi:gcmprop "ids|title|type";
    mwapi:gcmlimit "max".
    ?member wikibase:apiOutput mwapi:title.
    ?ns wikibase:apiOutput "@ns".
    ?item wikibase:apiOutputItem mwapi:item.
  }
}

# Get images of Iraqi footballers
#defaultView:ImageGrid
SELECT DISTINCT ?item ?itemLabel ?image WHERE {
  ?item wdt:P31 wd:Q5 ; wdt:P27 wd:Q796 ; wdt:P106 wd:Q937857 .
  ?item wdt:P18 ?image_temp.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

# Get a timeline of Turkish prime ministers
#defaultView:Timeline
SELECT ?item ?itemLabel ?start ?end {
  ?item p:P39 [ ps:P39 wd:Q2430415 ; pq:P580 ?start ; pq:P582 ?end ] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Prefix listing: https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Prefixes_used

SPARQL Wikibook: https://en.wikibooks.org/wiki/SPARQL

Requesting a query: https://www.wikidata.org/wiki/Wikidata:Request_a_query

Status updates (query examples): https://www.wikidata.org/wiki/Wikidata:Status_updates