query-9a130cec8fe498b5ca636010e2214048

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Nearest cultural heritage sites
#defaultView:Map
SELECT DISTINCT ?site ?siteDescription ?geo ?distance (GROUP_CONCAT(DISTINCT ?classLabel_;separator="; ") AS ?classLabel) (SAMPLE(?image_) AS ?image) ?siteLabel
    WHERE
    {
      {?site wdt:P31/wdt:P279* wd:Q839954 .} # archaeological site
      UNION {?site wdt:P31/wdt:P279* wd:Q916475 .} # historical monument
      UNION {?site wdt:P31/wdt:P279* wd:Q676050 .} # historical city centre
      UNION {?site wdt:P31/wdt:P279* wd:Q1081138 .} # historic site
      UNION {?site wdt:P31/wdt:P279* wd:Q358 .} # heritage site
      UNION {?site wdt:P31/wdt:P279* wd:Q15243209 .} # historic district
      UNION {?site wdt:P31/wdt:P279* wd:Q4895508 .} # battlefield
      UNION {?site wdt:P31/wdt:P279* wd:Q22674925 .} # former populated place
      UNION {?site wdt:P31/wdt:P279* wd:Q35112127 .} # historic building
      UNION {?site wdt:P31/wdt:P279* wd:Q5773747 .} # historic house
      UNION {?site wdt:P31/wdt:P279* wd:Q15661340 .} # ancient city
      UNION {?site wdt:P31/wdt:P279* wd:Q2434238 .} # heritage property
      ?site wdt:P31 ?class.
      SERVICE wikibase:around { 
        ?site wdt:P625 ?geo . 
         bd:serviceParam wikibase:center "Point(-3.564224203100305 52.241980731490386)"^^geo:wktLiteral . # Option: Specify location
       # bd:serviceParam wikibase:center "[AUTO_COORDINATES]". # Option: User's location
        bd:serviceParam wikibase:radius "25" . 
        bd:serviceParam wikibase:distance ?distance .
      }
      # Retrieve site names in English (default) or Welsh
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en,cy" .
                             ?class rdfs:label ?classLabel_ . 
                             ?site rdfs:label ?siteLabel . 
                             ?site schema:description ?siteDescription . }
      OPTIONAL { ?site wdt:P18 ?image. }
    } GROUP BY ?site ?siteDescription ?geo ?distance ?siteLabel
ORDER BY ASC(?distance)
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?class") v10("?classLabel") v5("?classLabel_"):::projected v1("?distance"):::projected v4("?geo"):::projected v11("?image") v9("?image_"):::projected v2("?site"):::projected v7("?siteDescription"):::projected v6("?siteLabel"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) a9((" ")) a10((" ")) a11((" ")) a12((" ")) c21(["25"]):::literal c6(["wd:Q1081138"]):::iri c12(["wd:Q5773747"]):::iri c3(["wd:Q839954"]):::iri c7(["wd:Q358"]):::iri c17(["bd:serviceParam"]):::iri c9(["wd:Q4895508"]):::iri c25(["en,cy"]):::literal c5(["wd:Q676050"]):::iri c14(["wd:Q2434238"]):::iri c11(["wd:Q35112127"]):::iri c13(["wd:Q15661340"]):::iri c19([sPoint(-3.564224203100305 52.241980731490386)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c10(["wd:Q22674925"]):::iri c8(["wd:Q15243209"]):::iri c4(["wd:Q916475"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; subgraph union5[" Union "] subgraph union5l[" "] style union5l fill:#abf,stroke-dasharray: 3 3; subgraph union6[" Union "] subgraph union6l[" "] style union6l fill:#abf,stroke-dasharray: 3 3; subgraph union7[" Union "] subgraph union7l[" "] style union7l fill:#abf,stroke-dasharray: 3 3; subgraph union8[" Union "] subgraph union8l[" "] style union8l fill:#abf,stroke-dasharray: 3 3; subgraph union9[" Union "] subgraph union9l[" "] style union9l fill:#abf,stroke-dasharray: 3 3; subgraph union10[" Union "] subgraph union10l[" "] style union10l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a12 a12 --"wdt:P279"--> c14 end subgraph union10r[" "] style union10r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a11 a11 --"wdt:P279"--> c13 end union10r <== or ==> union10l end end subgraph union9r[" "] style union9r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a10 a10 --"wdt:P279"--> c12 end union9r <== or ==> union9l end end subgraph union8r[" "] style union8r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a9 a9 --"wdt:P279"--> c11 end union8r <== or ==> union8l end end subgraph union7r[" "] style union7r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a8 a8 --"wdt:P279"--> c10 end union7r <== or ==> union7l end end subgraph union6r[" "] style union6r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a7 a7 --"wdt:P279"--> c9 end union6r <== or ==> union6l end end subgraph union5r[" "] style union5r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a6 a6 --"wdt:P279"--> c8 end union5r <== or ==> union5l end end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a5 a5 --"wdt:P279"--> c7 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a4 a4 --"wdt:P279"--> c6 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c5 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c4 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 end union0r <== or ==> union0l end v2 --"wdt:P31"--> v3 subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v2 --"wdt:P625"--> v4 c17 --"wikibase:center"--> c19 c17 --"wikibase:radius"--> c21 c17 --"wikibase:distance"--> v1 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c17 --"wikibase:language"--> c25 v3 --"rdfs:label"--> v5 v2 --"rdfs:label"--> v6 v2 --"schema:description"--> v7 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v11 end bind2[/"?classLabel_"/] v5 --o bind2 bind2 --as--o v10 bind3[/"sample(?image_)"/] v9 --o bind3 bind3 --as--o v11