query-660d07fe225ba6bbc3232c789e499de8
Federation with correlation - Get "depicts" for Commons images
Run this from WCQS - https://commons-query.wikimedia.org/
PREFIX commons: http://commons.wikimedia.org/wiki/Special:FilePath/ PREFIX sdc: https://commons.wikimedia.org/entity/
SELECT ?exoplanet ?label_en ?image ?sdc ?depicts 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") } } ?sdc schema:url ?image . OPTIONAL { ?sdc wdt:P180 ?depicts . } }
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 "depicts" for Commons images
# Run this from WCQS - https://commons-query.wikimedia.org/
PREFIX commons: <http://commons.wikimedia.org/wiki/Special:FilePath/>
PREFIX sdc: <https://commons.wikimedia.org/entity/>
SELECT ?exoplanet ?label_en ?image ?sdc ?depicts
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") }
}
?sdc schema:url ?image .
OPTIONAL { ?sdc wdt:P180 ?depicts . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?depicts"):::projected
v2("?exoplanet"):::projected
v3("?image"):::projected
v1("?label_en"):::projected
v4("?sdc"):::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:P180".-> v5
end