query-f76b4f6d6bf37700e8049f4e8bc2b304
Percentage completeness for some properties
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?collection ?collectionLabel ?total_objects ?proplabel (round(100*COUNT(DISTINCT ?i)/?total_objects) AS ?percentage)
WHERE {
{ SELECT ?collection (COUNT(?j) AS ?total_objects) WHERE
{?j wdt:P195 ?collection. ?collection wdt:P361 wd:Q63160499 }
GROUP BY ?collection }
?i wdt:P195 ?collection. # in Khalili Collections
{?i wdt:P186 ?value. BIND("Material" as ?proplabel)}
UNION {?i wdt:P571 ?value. BIND("Inception" as ?proplabel)}
UNION {?i wdt:P495 ?value. BIND("Country of origin" as ?proplabel)}
UNION {?i wdt:P1071 ?value. BIND("Location of creation" as ?proplabel)}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?collection ?collectionLabel ?proplabel ?total_objects
ORDER BY DESC(?total_objects) ?collectionLabel ?proplabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?collection"):::projected
v2("?collectionLabel"):::projected
v6("?i")
v4("?j")
v8("?percentage")
v8("?proplabel"):::projected
v6("?total_objects"):::projected
v7("?value")
c9(["bd:serviceParam"]):::iri
c3(["wd:Q63160499"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v4 --"wdt:P195"--> v5
v5 --"wdt:P361"--> c3
bind1[/"count(?j)"/]
v4 --o bind1
bind1 --as--o v6
v6 --"wdt:P195"--> v5
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P1071"--> v7
bind2[/"'Location of creation'"/]
bind2 --as--o v8
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P495"--> v7
bind3[/"'Country of origin'"/]
bind3 --as--o v8
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P571"--> v7
bind4[/"'Inception'"/]
bind4 --as--o v8
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P186"--> v7
bind5[/"'Material'"/]
bind5 --as--o v8
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind7[/"numeric-round('100^^xsd:integer' * / ?total_objects)"/]
null --o bind7
v6 --o bind7
bind7 --as--o v8