query-a552cb645f54586a88ef2238d829366a
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
SELECT ?item ?commonscat ?commonspage
WHERE {
{
SELECT ?item ?commonscat WHERE {
?item wdt:P373 ?commonscat .
} LIMIT 10000 OFFSET 20000
}.
BIND(STRLANG(CONCAT("Category:", ?commonscat),"en") AS ?c1) .
OPTIONAL {
?commonspage schema:name ?c1 .
?commonspage schema:isPartOf <https://commons.wikimedia.org/> .
?commonspage schema:about [] .
}
FILTER (!bound(?commonspage))
FILTER NOT EXISTS {?item wdt:P31 wd:Q4167836}
OPTIONAL {
?item2 wdt:P373 ?commonscat .
?item2 wdt:P31 wd:Q4167836
}
FILTER NOT EXISTS {
?item3 wdt:P373 ?commonscat .
FILTER (?item3 != ?item) .
FILTER (!(bound(?item2) && ?item3 = ?item2))
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?c1")
v4("?commonscat"):::projected
v5("?commonspage"):::projected
v3("?item"):::projected
v1("?item2")
v2("?item3")
a1((" "))
c6([https://commons.wikimedia.org/]):::iri
c3(["wd:Q4167836"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["not bound(?item2)?item3 = ?item2"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0f1[["?item3 != ?item"]]
e0f1 --> e0v2
e0f1 --> e0v3
e0v2 --"wdt:P373"--> e0v4
e0v4("?commonscat"):::projected
e0v3("?item"):::projected
e0v1("?item2"):::projected
e0v2("?item3"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> v3
f0 --> c1
f0 --> v4
f1[["not bound(?item2)?item3 = ?item2"]]
f1 --> v1
f1 --> v2
f2[["?item3 != ?item"]]
f2 --> v2
f2 --> v3
v2 --"wdt:P373"--> v4
f3[["not "]]
subgraph f3e1["Exists Clause"]
e1v1 --"wdt:P31"--> e1c2
e1v1("?item"):::projected
e1c2(["wd:Q4167836"]):::iri
end
f3--EXISTS--> f3e1
f3 --> v3
f3 --> c2
f3 --> c3
v3 --"wdt:P31"--> c3
f4[["not bound(?commonspage)"]]
f4 --> v5
v3 --"wdt:P373"--> v4
bind5[/"STRLANG(concat('Category:',?commonscat),'en')"/]
v4 --o bind5
bind5 --as--o v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."schema:name".-> v6
v5 --"schema:isPartOf"--> c6
v5 --"schema:about"--> a1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P373".-> v4
v1 --"wdt:P31"--> c3
end