query-4d24534884b542b7b3fe2ce1c3c979e8

rq turtle/ttl

title:Qualifier and reference properies used in P1114 statements for class Q2140665 qualified by P642 with class Q2119531 SELECT ?prop ?propLabel ?count ?sample { { SELECT ?prop (COUNT(DISTINCT ?item) AS ?count) (SAMPLE(?st) AS ?sample) { ?item wdt:P279 wd:Q2140665 . ?item p:P1114 ?st . ?st pq:P642 ?obj . ?obj wdt:P279+ wd:Q2119531 . { ?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 wdt: <http://www.wikidata.org/prop/direct/>
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 for class Q2140665 qualified by P642 with class Q2119531
SELECT ?prop ?propLabel ?count ?sample {
  {
    SELECT ?prop (COUNT(DISTINCT ?item) AS ?count) (SAMPLE(?st) AS ?sample) {
      ?item wdt:P279 wd:Q2140665 .
      ?item p:P1114 ?st .
      ?st pq:P642 ?obj .
      ?obj wdt:P279+ wd:Q2119531 .
      {
        ?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; v12("?count"):::projected v3("?item") v5("?obj") v6("?pq") v7("?pq_val") v10("?pr") v11("?pr_val") v8("?prop"):::projected v2("?propLabel"):::projected v9("?refnode") v12("?sample"):::projected v4("?st") c2(["wd:Q2140665"]):::iri c10(["bd:serviceParam"]):::iri c5(["wd:Q2119531"]):::iri c12(["ja,en"]):::literal v3 --"p:direct/P279"--> c2 v3 --"p:P1114"--> v4 v4 --"p:qualifier/P642"--> v5 v5 --"p:direct/P279"--> c5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"prov:wasDerivedFrom"--> v9 v9 -->v10--> v11 v8 --"wikibase:reference"--> v10 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 -->v6--> v7 v8 --"wikibase:qualifier"--> v6 end union0r <== or ==> union0l end bind2[/"count(?item)"/] v3 --o bind2 bind2 --as--o v12 bind3[/"sample(?st)"/] v4 --o bind3 bind3 --as--o v12 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end