query-bcd98c1ece7c186f3e63c794f5420d46
Map query on ancient locations in ScotlandForts (filtered by map location)
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
#defaultView:Map
SELECT (?typeLabel AS ?layer) ?label ?loc ?subj
WHERE
{
?subj wdt:P31/wdt:P279* wd:Q839954 ; # site or subtype
wdt:P625 ?loc ; # location to plot on map
p:P625/psv:P625 ?coord; # coordinate-location statement
rdfs:label ?label filter (lang(?label) = "en"). #Place name
?type wdt:P279? wd:Q744099 ; rdfs:label ?typeLabel filter (lang(?typeLabel) = "en"). #Type of fort (Q744099)
?coord wikibase:geoLatitude ?lat .
?coord wikibase:geoLongitude ?long .
FILTER (?lat > 54.7) FILTER (?lat < 63)
FILTER (?long > -10.5) FILTER (?long < 2.02)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?coord")
v4("?label"):::projected
v2("?lat")
v9("?layer")
v6("?loc"):::projected
v1("?long")
v5("?subj"):::projected
v8("?type")
v3("?typeLabel"):::projected
a1((" "))
a2((" "))
c13(["wd:Q744099"]):::iri
c8(["wd:Q839954"]):::iri
f0[["?long < '2.02^^xsd:decimal'"]]
f0 --> v1
f1[["?long > '-10.5^^xsd:decimal'"]]
f1 --> v1
f2[["?lat < '63^^xsd:integer'"]]
f2 --> v2
f3[["?lat > '54.7^^xsd:decimal'"]]
f3 --> v2
f4[["?typeLabel = 'en'"]]
f4 --> v3
f5[["?label = 'en'"]]
f5 --> v4
v5 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c8
v5 --"p:direct/P625"--> v6
v5 --"p:P625"--> a2
a2 --"p:statement/value/P625"--> v7
v5 --"rdfs:label"--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P279"--> c13
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
end
union0r <== or ==> union0l
end
v8 --"rdfs:label"--> v3
v7 --"wikibase:geoLatitude"--> v2
v7 --"wikibase:geoLongitude"--> v1
bind6[/"?typeLabel"/]
v3 --o bind6
bind6 --as--o v9