query-b826a87b4046b4245693e57fd7a92d41
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (URI(CONCAT('https://commons.wikimedia.org/wiki/', ?gallery)) AS ?gallery_url) ?cat ?catLabel ?ccat WHERE {
?item wdt:P935 ?gallery .
MINUS {?item wdt:P373 ?commonscat} .
OPTIONAL {
?item wdt:P910 ?cat .
OPTIONAL {
?cat wdt:P373 ?ccat .
}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?cat"):::projected
v5("?ccat"):::projected
v3("?commonscat")
v2("?gallery"):::projected
v6("?gallery_url")
v1("?item"):::projected
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P935"--> v2
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"wdt:P373"--> v3
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P910".-> v4
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P373".-> v5
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end
bind1[/"concat('https://commons.wikimedia.org/wiki/',?gallery)"/]
v2 --o bind1
bind1 --as--o v6