query-e19aaf8dc013e4a3e323dc9f1ae60dc8

rq turtle/ttl

) gives : }}Query no qualifier{{ by owner. Maybe the best way would be to put that in the owner item, I don’t know. Roughly filtering out the negative results and excluding qualified numbers (thanks to (Q248035)Siemens ES64U2 _in wikidata is far bigger than it should be, for example, and that there is cases where the number is splitted wrt. a criteria, for example see  (Q1054813)municipality of Japan The result are quite unexpected : it seem the number of

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
select (count(distinct ?instances) as ?count) ?class ?number_of_instances (?number_of_instances - ?count as ?missingnumber) {
  ?instances wdt:P31/wdt:P279* ?class .
  ?class wdt:P1114 ?number_of_instances .
   ?class p:P1114 ?class_number_statement .
 ?class_number_statement ps:P1114 ?number_of_instances .
 FILTER NOT EXISTS {
    ?class_number_statement ?classnumberpq_pred [] . # a triple involving our statement ...     
    [] wikibase:qualifier ?classnumberpq_pred .                                                        # ... with a predicate ?pq_pred that is a qualifier
}
} group by ?class ?number_of_instances having (?number_of_instances > ?count) order by ?missingnumber

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?class"):::projected v4("?class_number_statement") v5("?classnumberpq_pred") v8("?count"):::projected v6("?instances"):::projected v8("?missingnumber") v2("?number_of_instances"):::projected a1((" ")) a2((" ")) a3((" ")) f0[["?number_of_instances > ?count"]] f0 --> v2 f0 --> v8 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 -->e0v2--> e0a1 e0a2 --"wikibase:qualifier"--> e0v2 e0v1("?class_number_statement"):::projected e0v2("?classnumberpq_pred"):::projected e0a1((" ")):::projected e0a2((" ")):::projected end f1--EXISTS--> f1e0 f1 --> v4 f1 --> v5 f1 --> a1 f1 --> a2 f1 --> c1 v4 -->v5--> a1 a2 --"wikibase:qualifier"--> v5 v6 --"p:direct/P31"--> a3 a3 --"p:direct/P279"--> v7 v7 --"p:direct/P1114"--> v2 v7 --"p:P1114"--> v4 v4 --"p:statement/P1114"--> v2 bind3[/"count(?instances)"/] v6 --o bind3 bind3 --as--o v8 bind4[/"?number_of_instances - ?count"/] v2 --o bind4 v8 --o bind4 bind4 --as--o v8