query-e46bc44be0ec760da71bf7365cbf7754

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?prop ?propLabel ?count ?qualifiers WHERE {
  {
    SELECT ?p (COUNT(DISTINCT ?item) AS ?count) (GROUP_CONCAT(DISTINCT ?q; separator=', ') AS ?qualifiers) WHERE {
      ?item wdt:P31 wd:Q276; ?p [] .
      ?p ^wikibase:claim [] .
      OPTIONAL {
        {
          SELECT ?p (CONCAT(STRAFTER(STR(?qualifier), STR(pq:)), ': ', STR(COUNT(DISTINCT ?statement))) AS ?q) WHERE {
            [] wdt:P31 wd:Q276; ?p ?statement .
            ?p ^wikibase:claim [] .
            ?statement ?qualifier [] .
            ?qualifier ^wikibase:qualifier [] .
          } GROUP BY ?p ?qualifier
        } .
      } .
    } GROUP BY ?p
  } .
  ?prop wikibase:claim ?p .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
} ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?_anon_42b5416610844a34809f33a099ae9de127140") v8("?count"):::projected v2("?item") v3("?p") v9("?prop"):::projected v7("?q") v5("?qualifier") v8("?qualifiers"):::projected v4("?statement") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) c6(["bd:serviceParam"]):::iri c8(["en"]):::literal c2(["wd:Q276"]):::iri v2 --"wdt:P31"--> c2 v2 -->v3--> a1 a2 --"wikibase:claim"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; a3 -."wdt:P31".-> c2 a3 -->v3--> v4 a4 --"wikibase:claim"--> v3 v4 -->v5--> a5 a6 --"wikibase:qualifier"--> v5 bind1[/"count(?statement)"/] v4 --o bind1 bind1 --as--o v6 bind2[/"concat(substring-after(str(?qualifier),str('pq:')),': ',str())"/] v5 --o bind2 null --o bind2 bind2 --as--o v7 end bind5[/"count(?item)"/] v2 --o bind5 bind5 --as--o v8 bind6[/"?q"/] v7 --o bind6 bind6 --as--o v8 v9 --"wikibase:claim"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end