query-20cbaa65f5f021419bd6c05420b9da04
Bryan's example
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"layer":"?instance_ofLabel"}
SELECT ?book ?bookLabel ?person ?personLabel ?birthplace ?birthplaceLabel ?image ?coordinate_location
WHERE {
SERVICE wikibase:around {
?birthplace wdt:P625 ?coordinate_location.
bd:serviceParam wikibase:center "[AUTO_COORDINATES]".
bd:serviceParam wikibase:radius "150".
bd:serviceParam wikibase:distance ?dist.
}
?person wdt:P19 ?birthplace .
?book wdt:P31/wdt:P279* wd:Q571;
wdt:P50 ?person .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL { ?book wdt:P18 ?image. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?birthplace"):::projected
v5("?book"):::projected
v2("?coordinate_location"):::projected
v3("?dist")
v6("?image"):::projected
v4("?person"):::projected
a1((" "))
c7(["150"]):::literal
c3(["bd:serviceParam"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c5(["#91;AUTO_COORDINATES#93;"]):::literal
c12(["wd:Q571"]):::iri
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v1 --"wdt:P625"--> v2
c3 --"wikibase:center"--> c5
c3 --"wikibase:radius"--> c7
c3 --"wikibase:distance"--> v3
end
v4 --"wdt:P19"--> v1
v5 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c12
v5 --"wdt:P50"--> v4
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c3 --"wikibase:language"--> c16
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P18".-> v6
end