query-9f0866beeb51ca18649d1baba8e23bf0

rq turtle/ttl

Map of castles in the United Kingdom

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Castles on a map (must have coordinates!)
#defaultView:Map{"hide": ["?coords", "?layer"]}
SELECT DISTINCT ?library ?libraryLabel ?coords ?layer WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr". 
                          ?type rdfs:label ?layer.
                          ?library rdfs:label ?libraryLabel }
  ?library wdt:P31 ?type .
OPTIONAL { ?library wdt:P18 ?image }.
  ?type wdt:P279* wd:Q23413.
  ?library wdt:P17 wd:Q145.
  ?library wdt:P625 ?coords.
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?coords"):::projected v5("?image") v2("?layer"):::projected v3("?library"):::projected v4("?libraryLabel"):::projected v1("?type") c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en,fr"]):::literal c11(["wd:Q145"]):::iri c9(["wd:Q23413"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 v1 --"rdfs:label"--> v2 v3 --"rdfs:label"--> v4 end v3 --"wdt:P31"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P18".-> v5 end v1 --"wdt:P279"--> c9 v3 --"wdt:P17"--> c11 v3 --"wdt:P625"--> v6