query-01ed829c19ef766639a295e54041df64

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), total number of IDs and Mix'n'match catalog - may sometimes timeout SELECT ?id ?idLabel ?cod ?items_with_property ?uses_of_property ?number_of_ids (URI(CONCAT("https://mix-n-match.toolforge.org/#/catalog/",?MnMid)) AS ?MnM) 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. OPTIONAL { ?p wdt:P4876 ?number_of_ids . } OPTIONAL { ?p wdt:P2264 ?MnMid . } } 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), total number of IDs and Mix'n'match catalog - may sometimes timeout
SELECT ?id ?idLabel ?cod ?items_with_property ?uses_of_property ?number_of_ids (URI(CONCAT("https://mix-n-match.toolforge.org/#/catalog/",?MnMid)) AS ?MnM)
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.
      OPTIONAL { ?p wdt:P4876 ?number_of_ids . }
      OPTIONAL { ?p wdt:P2264 ?MnMid . }
    }
    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; v11("?MnM") v8("?MnMid"):::projected v3("?claim") v1("?cod"):::projected v2("?id"):::projected v4("?item") v9("?items_with_property"):::projected v7("?number_of_ids"):::projected v6("?p") v10("?uses_of_property"):::projected v5("?value") a1((" ")) c4(["wd:Q26921380"]):::iri c2(["wd:Q55586529"]):::iri c11(["bd:serviceParam"]):::iri c13(["#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 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:direct/P4876".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:direct/P2264".-> v8 end bind2[/"count(?item)"/] v4 --o bind2 bind2 --as--o v9 bind3[/"count(?value)"/] v5 --o bind3 bind3 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind4[/"concat('https://mix-n-match.toolforge.org/#/catalog/',?MnMid)"/] v8 --o bind4 bind4 --as--o v11