query-1100a8d53a9886881c43a8752d0c3a9b
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 ?id ?idLabel (SAMPLE(?img) AS ?img) ?continent ?capitalLabel ?continentLabel
WHERE
{
{
SELECT ?id ?idLabel ?img ?capitalLabel ?continentLabel (SAMPLE(?capital) AS ?capital) (SAMPLE(?continent) AS ?continent) WHERE {
{
?id wdt:P36 ?capital.
?capital wdt:P30 ?continent.
}
OPTIONAL { ?id wdt:P41 ?img. }
}
GROUP BY ?id ?capitalLabel ?img ?idLabel ?continentLabel
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?id ?idLabel ?continent ?capitalLabel ?continentLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?capital")
v5("?continent"):::projected
v1("?id"):::projected
v5("?img"):::projected
c5(["bd:serviceParam"]):::iri
c7(["en"]):::literal
v1 --"wdt:P36"--> v5
v5 --"wdt:P30"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P41".-> v5
end
bind2[/"sample(?capital)"/]
v5 --o bind2
bind2 --as--o v5
bind3[/"sample(?continent)"/]
v5 --o bind3
bind3 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end
bind5[/"sample(?img)"/]
v5 --o bind5
bind5 --as--o v5