query-a01d7927af171ccb41c579f83032afbc

rq turtle/ttl

TODO without sitelinks to de.wikipedia

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?item ?itemLabel ?num (count(?sitelink) as ?sitelinks) where {
   {
  select distinct ?item where {
    values ?item_class {wd:Q34 wd:Q183}
    ?item wdt:P27 ?item_class; wdt:P21 wd:Q6581072; wdt:P31 wd:Q5.
  }
}
  bind(xsd:integer(substr(str(?item), 33)) as ?num).
  optional {?sitelink schema:about ?item; schema:isPartOf [wikibase:wikiGroup 'wikipedia']}
  service wikibase:label {bd:serviceParam wikibase:language "de,[AUTO_LANGUAGE]".}
} 
group by ?item ?itemLabel ?num
order by desc(?sitelinks) asc(?num)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?item"):::projected v3("?item_class") v5("?num"):::projected v5("?sitelink"):::projected v6("?sitelinks") a1((" ")) c3(["wd:Q6581072"]):::iri c11(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri c8(["wikipedia"]):::literal c13(["de,#91;AUTO_LANGUAGE#93;"]):::literal bind0[/VALUES ?item_class/] bind0-->v3 bind00(["wd:Q34"]) bind00 --> bind0 bind01(["wd:Q183"]) bind01 --> bind0 v4 --"wdt:P27"--> v3 v4 --"wdt:P21"--> c3 v4 --"wdt:P31"--> c5 bind1[/"http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer'))"/] v4 --o bind1 bind1 --as--o v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."schema:about".-> v4 a1 --"wikibase:wikiGroup"--> c8 v5 --"schema:isPartOf"--> a1 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind3[/"count(?sitelink)"/] v5 --o bind3 bind3 --as--o v6