query-29ceef12b545e99d043a14254e21b7c0

rq turtle/ttl

title:Qualifier and reference properies used in P1114 statements qualified with P805:Q18204 SELECT ?prop ?propLabel ?count ?sample { { SELECT ?prop (COUNT(DISTINCT ?item) AS ?count) (SAMPLE(?st) AS ?sample) { ?item p:P1114 ?st . ?st pq:P805 wd:Q18204 . { ?st ?pq ?pq_val . ?prop wikibase:qualifier ?pq . } UNION { ?st prov:wasDerivedFrom ?refnode . ?refnode ?pr ?pr_val . ?prop wikibase:reference ?pr . } } GROUP BY ?prop }. SERVICE wikibase:label { bd:serviceParam wikibase:language "ja,en" } } ORDER BY DESC(?count) ASC(?propLabel)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Qualifier and reference properies used in P1114 statements qualified with P805:Q18204
SELECT ?prop ?propLabel ?count ?sample {
  {
    SELECT ?prop (COUNT(DISTINCT ?item) AS ?count) (SAMPLE(?st) AS ?sample) {
      ?item p:P1114 ?st .
      ?st pq:P805 wd:Q18204 .
      {
        ?st ?pq ?pq_val .
        ?prop wikibase:qualifier ?pq .
      } UNION {
        ?st prov:wasDerivedFrom ?refnode .
        ?refnode ?pr ?pr_val .
        ?prop wikibase:reference ?pr .
      }
    } GROUP BY ?prop
  }.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ja,en"  }
}
ORDER BY DESC(?count) ASC(?propLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?count"):::projected v3("?item") v5("?pq") v6("?pq_val") v9("?pr") v10("?pr_val") v7("?prop"):::projected v2("?propLabel"):::projected v8("?refnode") v11("?sample"):::projected v4("?st") c8(["bd:serviceParam"]):::iri c10(["ja,en"]):::literal c3(["wd:Q18204"]):::iri v3 --"p:P1114"--> v4 v4 --"p:qualifier/P805"--> c3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"prov:wasDerivedFrom"--> v8 v8 -->v9--> v10 v7 --"wikibase:reference"--> v9 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 -->v5--> v6 v7 --"wikibase:qualifier"--> v5 end union0r <== or ==> union0l end bind2[/"count(?item)"/] v3 --o bind2 bind2 --as--o v11 bind3[/"sample(?st)"/] v4 --o bind3 bind3 --as--o v11 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end