query-f11c5f427ebec9e26779e99a3c796b5e
Federation with correlation - Get byline for Commons images
Run this from WCQS - https://commons-query.wikimedia.org/
SELECT ?exoplanet ?label_en ?image ?file ?abutt WHERE { hint:Query hint:optimizer "None" . SERVICE https://query.wikidata.org/sparql { ?exoplanet wdt:P31 wd:Q44559 ; wdt:P18 ?image . OPTIONAL { ?exoplanet rdfs:label ?label_en . FILTER(LANG(?label_en)="en") } } ?file schema:url ?image . OPTIONAL { ?file wdt:P8264 ?abutt } }
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/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
# Federation with correlation - Get byline for Commons images
# Run this from WCQS - https://commons-query.wikimedia.org/
SELECT ?exoplanet ?label_en ?image ?file ?abutt
WHERE {
SERVICE <https://query.wikidata.org/sparql> {
?exoplanet wdt:P31 wd:Q44559 ;
wdt:P18 ?image .
OPTIONAL { ?exoplanet rdfs:label ?label_en . FILTER(LANG(?label_en)="en") }
}
?file schema:url ?image .
OPTIONAL { ?file wdt:P8264 ?abutt }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?abutt"):::projected
v2("?exoplanet"):::projected
v4("?file"):::projected
v3("?image"):::projected
v1("?label_en"):::projected
c4(["wd:Q44559"]):::iri
subgraph s1["https://query.wikidata.org/sparql"]
style s1 stroke-width:4px;
v2 --"wdt:P31"--> c4
v2 --"wdt:P18"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."rdfs:label".-> v1
end
end
v4 --"schema:url"--> v3
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P8264".-> v5
end