query-840581afac7148d82376087c0231715b

rq turtle/ttl

as main value with best rank. (P227)GND ID and of the number of values of (P227)GND ID is a count of the items having How about merging the two queries, apart from the risk of timing out? I have tried

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?id ?idLabel ?cod ?items_with_property ?uses_of_property
WHERE {
  ?id wdt:P31 wd:Q55586529 ;
      p:P1552 [ ps:P1552 wd:Q26921380; pq:P3295 ?cod ] .
 { SELECT
 (wikibase:statementProperty as ?use)
 (COUNT(DISTINCT(?item)) as ?items_with_property)
 (COUNT(?value) as ?uses_of_property)
 WHERE { ?item ?id ?value } }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?cod

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?cod"):::projected v2("?id"):::projected v3("?item") v6("?items_with_property"):::projected v5("?use") v7("?uses_of_property"):::projected v4("?value") a1((" ")) c2(["wd:Q55586529"]):::iri c8(["bd:serviceParam"]):::iri c4(["wd:Q26921380"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"p:direct/P31"--> c2 a1 --"p:statement/P1552"--> c4 a1 --"p:qualifier/P3295"--> v1 v2 --"p:P1552"--> a1 v3 -->v2--> v4 bind2[/"'wikibase:statementProperty'"/] bind2 --as--o v5 bind3[/"count(?item)"/] v3 --o bind3 bind3 --as--o v6 bind4[/"count(?value)"/] v4 --o bind4 bind4 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end