query-0a512816401f92e3d6e977465cc51cf3

rq turtle/ttl

Wikidata properties representing VIAF source IDs, with number of items using them and number of values of them (only main values with best rank) - may sometimes timeout SELECT ?id ?idLabel ?cod ?items_with_property ?uses_of_property WHERE { { SELECT ?id ?cod (COUNT(DISTINCT(?item)) as ?items_with_property) (COUNT(?value) as ?uses_of_property) WHERE { ?id wdt:P31 wd:Q55586529 ; p:P1552 [ ps:P1552 wd:Q26921380; pq:P3295 ?cod ] . ?id wikibase:claim ?claim. ?item ?claim ?value. } GROUP BY ?id ?cod } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?cod

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#>
#Wikidata properties representing VIAF source IDs, with number of items using them and number of values of them (only main values with best rank) - may sometimes timeout
SELECT ?id ?idLabel ?cod ?items_with_property ?uses_of_property
WHERE
{
  {
    SELECT ?id ?cod
      (COUNT(DISTINCT(?item)) as ?items_with_property)
      (COUNT(?value) as ?uses_of_property)
    WHERE
    {
      ?id wdt:P31 wd:Q55586529 ;
          p:P1552 [ ps:P1552 wd:Q26921380; pq:P3295 ?cod ] .
      ?id wikibase:claim ?claim.
      ?item ?claim ?value.
    }
    GROUP BY ?id ?cod
  }
  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; v3("?claim") v1("?cod"):::projected v2("?id"):::projected v4("?item") v6("?items_with_property"):::projected v7("?uses_of_property"):::projected v5("?value") a1((" ")) c2(["wd:Q55586529"]):::iri c9(["bd:serviceParam"]):::iri c4(["wd:Q26921380"]):::iri c11(["#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 v2 --"wikibase:claim"--> v3 v4 -->v3--> v5 bind2[/"count(?item)"/] v4 --o bind2 bind2 --as--o v6 bind3[/"count(?value)"/] v5 --o bind3 bind3 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end