query-8c833ff152a9e5cce41ba195d36e1980

rq turtle/ttl

And part completeness and the statement is qualified by the number : (P2670)has part(s) of the class A similar query, but for parts instead of instances if we know type of its parts with

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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?item ?itemLabel ?type ?typeLabel ?number (count(distinct ?part) as ?numpart){
  ?item p:P2670 [ps:P2670 ?type ; pq:P1114 ?number ] .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item (wdt:P527|^wdt:P361) ?part .
  ?part wdt:P31/wdt:P279* ?type .
} group by ?item ?type ?number ?itemLabel ?typeLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v2("?number"):::projected v5("?numpart") v4("?part"):::projected v1("?type"):::projected a1((" ")) a2((" ")) c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal a1 --"p:statement/P2670"--> v1 a1 --"p:qualifier/P1114"--> v2 v3 --"p:P2670"--> a1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"p:direct/P361"--> v3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P527"--> v4 end union0r <== or ==> union0l end v4 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> v1 bind1[/"count(?part)"/] v4 --o bind1 bind1 --as--o v5