query-f43cf9ac5a4c97932367aa15e63acb3b

rq turtle/ttl

Number of Chinese labels

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?numberOfDifferentChineseLabels WHERE {
  {
    SELECT ?item (COUNT(DISTINCT ?plainlabel) AS ?numberOfDifferentChineseLabels) WHERE {
      {
        SELECT ?item WHERE {
          ?item wdt:P106 wd:Q13141064 .
        }
      }
      OPTIONAL {
        ?item rdfs:label ?label .
        BIND(STR(?label) AS ?plainlabel) .
      }
      FILTER( SUBSTR(LANG(?label), 0, 2) = "zh" ) . 
      FILTER( BOUND(?label) ) .
    } GROUP BY ?item
  }
  FILTER(?numberOfDifferentChineseLabels > 0) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY DESC(?numberOfDifferentChineseLabels)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v2("?label") v5("?numberOfDifferentChineseLabels"):::projected v4("?plainlabel") c8(["bd:serviceParam"]):::iri c10(["en"]):::literal c5(["wd:Q13141064"]):::iri f0[["?numberOfDifferentChineseLabels > '0^^xsd:integer'"]] f0 --> v5 f1[["bound(?label)"]] f1 --> v2 f2[["substring(?label,'0^^xsd:integer','2^^xsd:integer') = 'zh'"]] f2 --> v2 v3 --"wdt:P106"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."rdfs:label".-> v2 bind3[/"str(?label)"/] v2 --o bind3 bind3 --as--o v4 end bind5[/"count(?plainlabel)"/] v4 --o bind5 bind5 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end