query-499e76c8bc02ed5d010e88c987a490a6
Federation with correlation - Get height and width for Commons images
Run this from WCQS - https://commons-query.wikimedia.org/
SELECT ?item ?id ?image ?file ?width ?height WHERE { hint:Query hint:optimizer "None" . SERVICE https://query.wikidata.org/sparql { ?item p:P1433 [ ps:P1433 wd:Q114189701; pq:P1545 ?id_ ] ; wdt:P18 ?image . BIND(xsd:integer(?id_) as ?id) . } ?file schema:url ?image ; schema:height ?height ; schema:width ?width . } ORDER BY (?width * ?height)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
# Federation with correlation - Get height and width for Commons images
# Run this from WCQS - https://commons-query.wikimedia.org/
SELECT ?item ?id ?image ?file ?width ?height
WHERE {
SERVICE <https://query.wikidata.org/sparql> {
?item p:P1433 [ ps:P1433 wd:Q114189701; pq:P1545 ?id_ ] ;
wdt:P18 ?image .
BIND(xsd:integer(?id_) as ?id) .
}
?file schema:url ?image ;
schema:height ?height ;
schema:width ?width .
}
ORDER BY (?width * ?height)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?file"):::projected
v2("?height"):::projected
v6("?id"):::projected
v3("?id_")
v5("?image"):::projected
v4("?item"):::projected
v1("?width"):::projected
a1((" "))
c3(["wd:Q114189701"]):::iri
subgraph s1["https://query.wikidata.org/sparql"]
style s1 stroke-width:4px;
a1 --"p:statement/P1433"--> c3
a1 --"p:qualifier/P1545"--> v3
v4 --"p:P1433"--> a1
v4 --"p:direct/P18"--> v5
bind0[/"http://www.w3.org/2001/XMLSchema#integer(?id_)"/]
v3 --o bind0
bind0 --as--o v6
end
v7 --"schema:url"--> v5
v7 --"schema:height"--> v2
v7 --"schema:width"--> v1