query-6665003b40361b74af492499d7322a91

rq turtle/ttl

Hillforts linked to a Commons category

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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
#defaultView:Map
SELECT ?label (SAMPLE(?coord) AS ?where) ?subj (?typeLabel AS ?layer) ?commons WHERE
{  ?subj wdt:P31/wdt:P279? ?type ;
      wdt:P625 ?coord ;
      wdt:P31 ?type ;
      wdt:P373 ?commons ;
      rdfs:label ?label filter (lang(?label) = "en").
?type wdt:P279? wd:Q744099 ;
    rdfs:label ?typeLabel filter (lang(?typeLabel) = "en").
?subj p:P625/psv:P625 ?loc. # coordinate-location statement
  ?loc wikibase:geoLatitude ?lat .
  ?loc wikibase:geoLongitude ?long .
   FILTER (?lat > 49) FILTER (?lat < 63)
   FILTER (?long > -10.5) FILTER (?long < 2.02) 
} GROUP BY ?label ?subj ?typeLabel ?commons

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?commons"):::projected v7("?coord"):::projected v4("?label"):::projected v2("?lat") v11("?layer") v9("?loc") v1("?long") v5("?subj"):::projected v6("?type") v3("?typeLabel"):::projected v10("?where") a1((" ")) a2((" ")) c11(["wd:Q744099"]):::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 > '49^^xsd:integer'"]] f3 --> v2 f4[["?typeLabel = 'en'"]] f4 --> v3 f5[["?label = 'en'"]] f5 --> v4 v5 --"p:direct/P31"--> a1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; a1 --"p:direct/P279"--> v6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end v5 --"p:direct/P625"--> v7 v5 --"p:direct/P31"--> v6 v5 --"p:direct/P373"--> v8 v5 --"rdfs:label"--> v4 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v6 --"p:direct/P279"--> c11 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; end union1r <== or ==> union1l end v6 --"rdfs:label"--> v3 v5 --"p:P625"--> a2 a2 --"p:statement/value/P625"--> v9 v9 --"wikibase:geoLatitude"--> v2 v9 --"wikibase:geoLongitude"--> v1 bind7[/"sample(?coord)"/] v7 --o bind7 bind7 --as--o v10 bind8[/"?typeLabel"/] v3 --o bind8 bind8 --as--o v11