query-5d095587fcc6a19a9d5413332f1811c1

rq turtle/ttl

Viewpoint St. Jakobus Kirche (wikibase:around 2 km)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":["?coordinate", "?line", "?rgb", "?lon1", "?lat1", "?lon2", "?lat2"]}

SELECT distinct ?place ?placeLabel ?coordinate ?coordinate2 ?lon1 ?lat1 ?lon2 ?lat2 ?line ?distNum

#####################################################################
##########################################

#########################################

WHERE {

  # jetzt Punkte und Linien für Ausgabe auf Karte ausgeben
 {  {
  # Liste der POIs, die man vom Aussichtspunkt sehen kann
SELECT ?place
              (SAMPLE(?coordinate) AS ?coordinate)
       #(SAMPLE(?coordinate2) AS ?coordinate2)
       (SAMPLE(?lon1) AS ?lon1)
       (SAMPLE(?lat1) AS ?lat1)
       (SAMPLE(?lon2) AS ?lon2)
       (SAMPLE(?lat2) AS ?lat2)
       (CONCAT(STR(ROUND(SAMPLE(?distNum)*100)/100),' km') AS ?distNum)  # Entfernung runden
       (SAMPLE(?placeLabel) AS ?placeLabel) 

  WHERE {
  {
    BIND(wd:Q15296697 AS ?viewpoint)
    ?viewpoint wdt:P625 ?coordinate2.
    OPTIONAL { ?viewpoint (p:P625/psv:P625/wikibase:geoLatitude) ?lat1. }
    OPTIONAL { ?viewpoint (p:P625/psv:P625/wikibase:geoLongitude) ?lon1. }
    SERVICE wikibase:around {
      ?place wdt:P625 ?coordinate.
      bd:serviceParam wikibase:center ?coordinate2;
        wikibase:radius "2".
    }
    BIND("im Umkreis" AS ?layer)
    FILTER(?place != wd:Q15296697)
    OPTIONAL { ?place (p:P625/psv:P625/wikibase:geoLatitude) ?lat2. }
    OPTIONAL { ?place (p:P625/psv:P625/wikibase:geoLongitude) ?lon2. }
    BIND(CONCAT("LINESTRING (", STR(?lon1), " ", STR(?lat1), ",", STR(?lon2), " ", STR(?lat2), ")") AS ?str)
    BIND(STRDT(?str, geo:wktLiteral) AS ?line)
    BIND(geof:distance(?coordinate, ?coordinate2) AS ?distNum)
  }

  }   
GROUP BY ?place

}}
 union
 {  {
  # Linien generieren 
  SELECT ?line ?place ("9B0058" as ?rgb) 
          WHERE {
     {
  # Liste der POIs, die man vom Aussichtspunkt sehen kann
SELECT ?place
              (SAMPLE(?coordinate) AS ?coordinate)
       #(SAMPLE(?coordinate2) AS ?coordinate2)
       (SAMPLE(?lon1) AS ?lon1)
       (SAMPLE(?lat1) AS ?lat1)
       (SAMPLE(?lon2) AS ?lon2)
       (SAMPLE(?lat2) AS ?lat2)
       (CONCAT(STR(ROUND(SAMPLE(?distNum)*100)/100),' km') AS ?distNum)  # Entfernung runden
       (SAMPLE(?placeLabel) AS ?placeLabel) 

  WHERE {
  {
    BIND(wd:Q15296697 AS ?viewpoint)
    ?viewpoint wdt:P625 ?coordinate2.
    OPTIONAL { ?viewpoint (p:P625/psv:P625/wikibase:geoLatitude) ?lat1. }
    OPTIONAL { ?viewpoint (p:P625/psv:P625/wikibase:geoLongitude) ?lon1. }
    SERVICE wikibase:around {
      ?place wdt:P625 ?coordinate.
      bd:serviceParam wikibase:center ?coordinate2;
        wikibase:radius "2".
    }
    BIND("im Umkreis" AS ?layer)
    FILTER(?place != wd:Q15296697)
    OPTIONAL { ?place (p:P625/psv:P625/wikibase:geoLatitude) ?lat2. }
    OPTIONAL { ?place (p:P625/psv:P625/wikibase:geoLongitude) ?lon2. }
    BIND(CONCAT("LINESTRING (", STR(?lon1), " ", STR(?lat1), ",", STR(?lon2), " ", STR(?lat2), ")") AS ?str)
    BIND(STRDT(?str, geo:wktLiteral) AS ?line)
    BIND(geof:distance(?coordinate, ?coordinate2) AS ?distNum)
  }

  }   
GROUP BY ?place

}
    BIND(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) .
    BIND(STRDT(?str, geo:wktLiteral) AS ?line) 

  }
}}

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v14("?_anon_42b5416610844a34809f33a099ae9de1148333") v15("?_anon_42b5416610844a34809f33a099ae9de1148354") v16("?coordinate"):::projected v3("?coordinate2"):::projected v16("?distNum"):::projected v16("?lat1"):::projected v16("?lat2"):::projected v15("?layer") v16("?line"):::projected v16("?lon1"):::projected v16("?lon2"):::projected v1("?place"):::projected v16("?placeLabel"):::projected v16("?rgb") v16("?str") v15("?viewpoint") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) a9((" ")) a10((" ")) a11((" ")) a12((" ")) a13((" ")) a14((" ")) a15((" ")) a16((" ")) c11(["2"]):::literal c8(["bd:serviceParam"]):::iri c14(["#91;AUTO_LANGUAGE#93;,de,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["?place != 'wd:Q15296697'"]] f0 --> v1 bind1[/"'wd:Q15296697'"/] bind1 --as--o v15 v15 --"p:direct/P625"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v15 -."p:P625".-> a9 a9 --"p:statement/value/P625"--> a10 a10 --"wikibase:geoLatitude"--> v16 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v15 -."p:P625".-> a11 a11 --"p:statement/value/P625"--> a12 a12 --"wikibase:geoLongitude"--> v16 end subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v1 --"p:direct/P625"--> v16 c8 --"wikibase:center"--> v3 c8 --"wikibase:radius"--> c11 end bind2[/"'im Umkreis'"/] bind2 --as--o v15 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> a13 a13 --"p:statement/value/P625"--> a14 a14 --"wikibase:geoLatitude"--> v16 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> a15 a15 --"p:statement/value/P625"--> a16 a16 --"wikibase:geoLongitude"--> v16 end bind3[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v16 --o bind3 v16 --o bind3 v16 --o bind3 v16 --o bind3 bind3 --as--o v16 bind4[/"STRDT(?str,'geo:wktLiteral')"/] v16 --o bind4 bind4 --as--o v16 bind5[/"http://www.opengis.net/def/function/geosparql/distance(?coordinate,?coordinate2)"/] v16 --o bind5 v3 --o bind5 bind5 --as--o v16 bind13[/"sample(?distNum)"/] v16 --o bind13 bind13 --as--o v15 bind14[/"sample(?coordinate)"/] v16 --o bind14 bind14 --as--o v16 bind15[/"sample(?lon1)"/] v16 --o bind15 bind15 --as--o v16 bind16[/"sample(?lat1)"/] v16 --o bind16 bind16 --as--o v16 bind17[/"sample(?lon2)"/] v16 --o bind17 bind17 --as--o v16 bind18[/"sample(?lat2)"/] v16 --o bind18 bind18 --as--o v16 bind19[/"concat(str(numeric-round( * '100^^xsd:integer') / '100^^xsd:integer'),' km')"/] null --o bind19 bind19 --as--o v16 bind20[/"sample(?placeLabel)"/] v16 --o bind20 bind20 --as--o v16 bind21[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v16 --o bind21 v16 --o bind21 v16 --o bind21 v16 --o bind21 bind21 --as--o v16 bind22[/"STRDT(?str,'geo:wktLiteral')"/] v16 --o bind22 bind22 --as--o v16 bind23[/"'9B0058'"/] bind23 --as--o v16 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f24[["?place != 'wd:Q15296697'"]] f24 --> v1 bind25[/"'wd:Q15296697'"/] bind25 --as--o v15 v15 --"p:direct/P625"--> v3 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v15 -."p:P625".-> a1 a1 --"p:statement/value/P625"--> a2 a2 --"wikibase:geoLatitude"--> v16 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v15 -."p:P625".-> a3 a3 --"p:statement/value/P625"--> a4 a4 --"wikibase:geoLongitude"--> v16 end subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v1 --"p:direct/P625"--> v16 c8 --"wikibase:center"--> v3 c8 --"wikibase:radius"--> c11 end bind26[/"'im Umkreis'"/] bind26 --as--o v15 subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> a5 a5 --"p:statement/value/P625"--> a6 a6 --"wikibase:geoLatitude"--> v16 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> a7 a7 --"p:statement/value/P625"--> a8 a8 --"wikibase:geoLongitude"--> v16 end bind27[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v16 --o bind27 v16 --o bind27 v16 --o bind27 v16 --o bind27 bind27 --as--o v16 bind28[/"STRDT(?str,'geo:wktLiteral')"/] v16 --o bind28 bind28 --as--o v16 bind29[/"http://www.opengis.net/def/function/geosparql/distance(?coordinate,?coordinate2)"/] v16 --o bind29 v3 --o bind29 bind29 --as--o v16 bind37[/"sample(?distNum)"/] v16 --o bind37 bind37 --as--o v14 bind38[/"sample(?coordinate)"/] v16 --o bind38 bind38 --as--o v16 bind39[/"sample(?lon1)"/] v16 --o bind39 bind39 --as--o v16 bind40[/"sample(?lat1)"/] v16 --o bind40 bind40 --as--o v16 bind41[/"sample(?lon2)"/] v16 --o bind41 bind41 --as--o v16 bind42[/"sample(?lat2)"/] v16 --o bind42 bind42 --as--o v16 bind43[/"concat(str(numeric-round( * '100^^xsd:integer') / '100^^xsd:integer'),' km')"/] null --o bind43 bind43 --as--o v16 bind44[/"sample(?placeLabel)"/] v16 --o bind44 bind44 --as--o v16 end union0r <== or ==> union0l end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c8 --"wikibase:language"--> c14 end