Jump to content

Wiki Loves Fashion/Articles/SPARQL Query

From Meta, a Wikimedia project coordination wiki
SELECT ?item ?itemLabel_ar ?itemLabel_bn ?itemLabel_he ?itemLabel_it ?linkcount WHERE {
  ?item wdt:P106 ?occ .
  VALUES ?occ {
    wd:Q3501317      #Fashion designer
    wd:Q4610556      #Model
    wd:Q19698265     #Fashion photographer
    wd:Q9397629      #Fashion magazine
    wd:Q11460        #clothing
    wd:Q28823        #textile
    wd:Q5436782      #fashion museums
    wd:Q2090555      #clothing stores
    wd:Q1065579      #costume accessories
    wd:Q11828862     #clothing industry
    wd:Q22676        #shoes
    wd:Q7500021      #shoes store
  }
  FILTER NOT EXISTS {                              #has no it.wikipedia sitelink
    ?wen schema:about ?item .
    ?wen schema:isPartOf <https://it.wikipedia.org/> .
  }
  ?item wdt:P21 wd:Q6581072 .                      #gender: female
  ?item wdt:P31 wd:Q5 .                            #human
  OPTIONAL {?item wikibase:sitelinks ?linkcount .}  #count of sitelinks  
  OPTIONAL {?item rdfs:label ?itemLabel_ar filter (lang(?itemLabel_ar) = "ar").}   #ar label if exists
  OPTIONAL {?item rdfs:label ?itemLabel_bn filter (lang(?itemLabel_bn) = "bn").}   #bn label if exists
  OPTIONAL {?item rdfs:label ?itemLabel_he filter (lang(?itemLabel_he) = "he").}   #he label if exists
  OPTIONAL {?item rdfs:label ?itemLabel_it filter (lang(?itemLabel_it) = "it").}   #it label if exists
}
ORDER BY DESC(?linkcount)   #order by number of sitelinks
LIMIT 8000                  #limit to 8000 items (max number for Listeria)

Cliquez pour essayer !