query-6f8a4d9a86907cdc5faea614222264ca

rq turtle/ttl

If several ?fmt exist for the same prop, I think we should use all of them, not only the best-ranked ?fmt . Here are some counts:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
select (count(*) as ?props) (sum(?pat) as ?pats) (sum(?fmt_re) as ?fmt_res) {
  ?x wikibase:propertyType wikibase:ExternalId
  bind(if(exists {?x wdt:P8966 []},1,0) as ?pat)
  bind(if(exists {?x wdt:P1630 []} && exists {?x p:P2302/pq:P1793 []},1,0) as ?fmt_re)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?fmt_re"):::projected v6("?fmt_res") v2("?pat"):::projected v5("?pats") v4("?props") v1("?x") c2(["wikibase:ExternalId"]):::iri v1 --"wikibase:propertyType"--> c2 v1 --"p:direct/P8966"--> null bind0[/"if( ,'1^^xsd:integer','0^^xsd:integer')"/] subgraph bind0e0["Exists Clause"] e0v1 --"p:direct/P8966"--> e0a1 e0v1("?x"):::projected e0a1((" ")):::projected end bind0--EXISTS--> bind0e0 v1 --o bind0 null --o bind0 null --o bind0 bind0 --as--o v2 v1 --"p:direct/P1630"--> null v1 --"p:P2302"--> null null --"p:qualifier/P1793"--> null bind1[/"if( ,'1^^xsd:integer','0^^xsd:integer')"/] subgraph bind1e1["Exists Clause"] e1v1 --"p:direct/P1630"--> e1a1 e1v1("?x"):::projected e1a1((" ")):::projected end bind1--EXISTS--> bind1e1 subgraph bind1e2["Exists Clause"] e2v1 --"p:P2302"--> e2a1 e2a1 --"p:qualifier/P1793"--> e2a2 e2v1("?x"):::projected e2a2((" ")):::projected e2a1((" ")):::projected end bind1--EXISTS--> bind1e2 v1 --o bind1 null --o bind1 null --o bind1 null --o bind1 null --o bind1 null --o bind1 null --o bind1 bind1 --as--o v3 bind5[/"count(*)"/] bind5 --as--o v4 bind6[/"sum(?pat)"/] v2 --o bind6 bind6 --as--o v5 bind7[/"sum(?fmt_re)"/] v3 --o bind7 bind7 --as--o v6