query-8221417ee9da376f286a94d2392f6e76
number of items in named private collections
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT (count(?item) as ?count) WHERE {
?item wdt:P170 wd:Q381238 .
?item p:P195 ?statement .
?statement ps:P195 ?collection .
?collection wdt:P31 wd:Q768717 .
FILTER NOT EXISTS { ?statement pq:P518 wd:Q114187913} # exclude if P1001 for USA present
FILTER (!wikibase:isSomeValue(?collection))
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?collection")
v4("?count")
v3("?item"):::projected
v2("?statement")
c4(["wd:Q381238"]):::iri
c2(["wd:Q114187913"]):::iri
c8(["wd:Q768717"]):::iri
f0[["not http://wikiba.se/ontology#isSomeValue(?collection)"]]
f0 --> v1
f1[["not "]]
subgraph f1e0["Exists Clause"]
e0v1 --"p:qualifier/P518"--> e0c2
e0v1("?statement"):::projected
e0c2(["wd:Q114187913"]):::iri
end
f1--EXISTS--> f1e0
f1 --> v2
f1 --> c1
f1 --> c2
v2 --"p:qualifier/P518"--> c2
v3 --"p:direct/P170"--> c4
v3 --"p:P195"--> v2
v2 --"p:statement/P195"--> v1
v1 --"p:direct/P31"--> c8
bind3[/"count(?item)"/]
v3 --o bind3
bind3 --as--o v4