query-c4fef432c9041afc0fd7c5904b77d37c

rq turtle/ttl

Viewpoint (St.-Jakobus.-Kirche)by Matthias Erfurth

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#>
#-----------------------------------------------------
#Viewpoint
#-----------------------------------------------------
PREFIX schema: <http://schema.org/>
#defaultView:Map{"hide":["?coordinate", "?line", "?rgb", "?lon1", "?lat1", "?lon2", "?lat2"]}
SELECT distinct ?item ?itemLabel ?coordinate ?coordinate2 ?image ?lon1 ?lat1 ?lon2 ?lat2 ?line ?distNum ?sitelink

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

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

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

WHERE {

  # jetzt Punkte und Linien für Ausgabe auf Karte ausgeben
 {  {
  # Liste der POIs, die man vom Aussichtspunkt sehen kann
SELECT ?item

       (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(?sitelink) AS ?sitelink)
       (SAMPLE(?itemLabel) AS ?itemLabel) 
       (SAMPLE(?image) AS ?image)

  WHERE {
  VALUES (?poi) {
    (wd:Q277572)     # Fernsehturm Dresden
    (wd:Q322853)     # Meißner Dom
    (wd:Q866559)    # Bismarckturm Radebeul
    (wd:Q894173)     # Borsberg
    (wd:Q881976)     # Großer Winterberg 
    (wd:Q700562)     # Festung Königstein
    (wd:Q227259)     # Zschirnsteine 
    (wd:Q453233)     # Pfaffenstein  
    (wd:Q6811)    # Windberg
    (wd:Q1272672)    # Hoher Schneeberg 
    (wd:Q1136672)    # Cottaer Spitzberg 
    (wd:Q880766)     # Geisingberg 
    (wd:Q31310959)   # Lugstein  
    (wd:Q1720762)    # Kahleberg  
    (wd:Q1867648)    # Lockwitztalbrücke
    (wd:Q1600678)    # Wilisch 
    (wd:Q797717)     # Babisnauer Pappel 
    (wd:Q1248323)    # Gohlig 
    (wd:Q1679651)    # Panometer Dresden  
    (wd:Q1231293)    # Marienschacht  
    (wd:Q1087301)    # Christuskirche Strehlen 
    (wd:Q2358380)    # Studentenwohnheime Wundtstraße
    (wd:Q22949130)   # Tunnel Altfranken
    (wd:Q2409158)    # Tharandter Wald
    (wd:Q827406)     # Forstbotanischer Garten Tharandt
    (wd:Q1801966)    # Landberg




  }     
  BIND(?poi as ?item) .

    # Koordinate von POIs auseinander nehmen
  ?item wdt:P625 ?coordinate  .
  OPTIONAL{?item p:P625 / psv:P625 / wikibase:geoLatitude ?lat2 . }
  OPTIONAL{?item p:P625 / psv:P625 / wikibase:geoLongitude ?lon2 . }
  OPTIONAL{?item wdt:P18 ?image }.

  ?sitelink schema:about ?item.
  FILTER(REGEX(STR(?sitelink), "de.wikipedia.org/wiki/"))    


  # Koordinate vom Ausgangspunkt (manuelle Eingabe)
  #BIND("51.03402" as ?lat1) . 
  #BIND("13.80267" as ?lon1) .
  #BIND(CONCAT("Point(",str(?lon1)," ",str(?lat1),")") AS ?string1) .
  #BIND(STRDT(?string1, geo:wktLiteral) AS ?coordinate2).

  # Koordinate vom Ausgangspunkt (per Wikidata-Objekt) Mimosa AG ()  
  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 . }
  OPTIONAL { ?viewpoint wdt:P18 ?image }.

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

  #Entfernung berechnen (geht aktuell nicht bei manueller Koordinateneingabe, unklar warum)
  BIND(geof:distance(?coordinate, ?coordinate2) AS ?distNum).

}    
GROUP BY ?item

}}
 union
 {  {
  # Linien generieren 
  SELECT ?line ?item ("9B0058" as ?rgb) 
          WHERE {
     {
  # Liste der POIs, die man vom Aussichtspunkt sehen kann
SELECT ?item

       (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(?sitelink) AS ?sitelink)
       (SAMPLE(?itemLabel) AS ?itemLabel) 
       (SAMPLE(?image) AS ?image)

  WHERE {
  VALUES (?poi) {
    (wd:Q277572)     # Fernsehturm Dresden
    (wd:Q322853)     # Meißner Dom
    (wd:Q866559)    # Bismarckturm Radebeul
    (wd:Q894173)     # Borsberg
    (wd:Q881976)     # Großer Winterberg 
    (wd:Q700562)     # Festung Königstein
    (wd:Q227259)     # Zschirnsteine 
    (wd:Q453233)     # Pfaffenstein  
    (wd:Q6811)    # Windberg
    (wd:Q1272672)    # Hoher Schneeberg 
    (wd:Q1136672)    # Cottaer Spitzberg 
    (wd:Q880766)     # Geisingberg 
    (wd:Q31310959)   # Lugstein  
    (wd:Q1720762)    # Kahleberg  
    (wd:Q1867648)    # Lockwitztalbrücke
    (wd:Q1600678)    # Wilisch 
    (wd:Q797717)     # Babisnauer Pappel 
    (wd:Q1248323)    # Gohlig 
    (wd:Q1679651)    # Panometer Dresden  
    (wd:Q1231293)    # Marienschacht  
    (wd:Q1087301)    # Christuskirche Strehlen 
    (wd:Q2358380)    # Studentenwohnheime Wundtstraße
    (wd:Q22949130)   # Tunnel Altfranken
    (wd:Q2409158)    # Tharandter Wald
    (wd:Q827406)     # Forstbotanischer Garten Tharandt
    (wd:Q1801966)    # Landberg




  }     
  BIND(?poi as ?item) .

    # Koordinate von POIs auseinander nehmen
  ?item wdt:P625 ?coordinate  .
  OPTIONAL{?item p:P625 / psv:P625 / wikibase:geoLatitude ?lat2 . }
  OPTIONAL{?item p:P625 / psv:P625 / wikibase:geoLongitude ?lon2 . }
  OPTIONAL{?item wdt:P18 ?image }.

  ?sitelink schema:about ?item.
  FILTER(REGEX(STR(?sitelink), "de.wikipedia.org/wiki/"))    


  # Koordinate vom Ausgangspunkt (manuelle Eingabe)
  #BIND("51.03402" as ?lat1) . 
  #BIND("13.80267" as ?lon1) .
  #BIND(CONCAT("Point(",str(?lon1)," ",str(?lat1),")") AS ?string1) .
  #BIND(STRDT(?string1, geo:wktLiteral) AS ?coordinate2).

  # Koordinate vom Ausgangspunkt (per Wikidata-Objekt) Mimosa AG ()  
  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 . }
  OPTIONAL { ?viewpoint wdt:P18 ?image }.

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

  #Entfernung berechnen (geht aktuell nicht bei manueller Koordinateneingabe, unklar warum)
  BIND(geof:distance(?coordinate, ?coordinate2) AS ?distNum).

}    
GROUP BY ?item

}
    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; v16("?_anon_42b5416610844a34809f33a099ae9de191790") v17("?_anon_42b5416610844a34809f33a099ae9de191808") v18("?coordinate"):::projected v9("?coordinate2"):::projected v18("?distNum"):::projected v18("?image"):::projected v17("?item"):::projected v18("?itemLabel"):::projected v18("?lat1"):::projected v18("?lat2"):::projected v18("?line"):::projected v18("?lon1"):::projected v18("?lon2"):::projected v17("?poi") v18("?rgb") v18("?sitelink"):::projected v18("?str") v17("?viewpoint") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) a9((" ")) a10((" ")) a11((" ")) a12((" ")) a13((" ")) a14((" ")) a15((" ")) a16((" ")) c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,de,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["regex(str(?sitelink),'de.wikipedia.org/wiki/')"]] f0 --> v18 bind1[/VALUES ?poi/] bind1-->v17 bind10(["wd:Q277572"]) bind10 --> bind1 bind11(["wd:Q322853"]) bind11 --> bind1 bind12(["wd:Q866559"]) bind12 --> bind1 bind13(["wd:Q894173"]) bind13 --> bind1 bind14(["wd:Q881976"]) bind14 --> bind1 bind15(["wd:Q700562"]) bind15 --> bind1 bind16(["wd:Q227259"]) bind16 --> bind1 bind17(["wd:Q453233"]) bind17 --> bind1 bind18(["wd:Q6811"]) bind18 --> bind1 bind19(["wd:Q1272672"]) bind19 --> bind1 bind110(["wd:Q1136672"]) bind110 --> bind1 bind111(["wd:Q880766"]) bind111 --> bind1 bind112(["wd:Q31310959"]) bind112 --> bind1 bind113(["wd:Q1720762"]) bind113 --> bind1 bind114(["wd:Q1867648"]) bind114 --> bind1 bind115(["wd:Q1600678"]) bind115 --> bind1 bind116(["wd:Q797717"]) bind116 --> bind1 bind117(["wd:Q1248323"]) bind117 --> bind1 bind118(["wd:Q1679651"]) bind118 --> bind1 bind119(["wd:Q1231293"]) bind119 --> bind1 bind120(["wd:Q1087301"]) bind120 --> bind1 bind121(["wd:Q2358380"]) bind121 --> bind1 bind122(["wd:Q22949130"]) bind122 --> bind1 bind123(["wd:Q2409158"]) bind123 --> bind1 bind124(["wd:Q827406"]) bind124 --> bind1 bind125(["wd:Q1801966"]) bind125 --> bind1 bind2[/"?poi"/] v17 --o bind2 bind2 --as--o v17 v17 --"p:direct/P625"--> v18 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a9 a9 --"p:statement/value/P625"--> a10 a10 --"wikibase:geoLatitude"--> v18 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a11 a11 --"p:statement/value/P625"--> a12 a12 --"wikibase:geoLongitude"--> v18 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:direct/P18".-> v18 end v18 --"schema:about"--> v17 bind3[/"'wd:Q15296697'"/] bind3 --as--o v17 v17 --"p:direct/P625"--> v9 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a13 a13 --"p:statement/value/P625"--> a14 a14 --"wikibase:geoLatitude"--> v18 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a15 a15 --"p:statement/value/P625"--> a16 a16 --"wikibase:geoLongitude"--> v18 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:direct/P18".-> v18 end bind4[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v18 --o bind4 v18 --o bind4 v18 --o bind4 v18 --o bind4 bind4 --as--o v18 bind5[/"STRDT(?str,'geo:wktLiteral')"/] v18 --o bind5 bind5 --as--o v18 bind6[/"http://www.opengis.net/def/function/geosparql/distance(?coordinate,?coordinate2)"/] v18 --o bind6 v9 --o bind6 bind6 --as--o v18 bind16[/"sample(?distNum)"/] v18 --o bind16 bind16 --as--o v17 bind17[/"sample(?coordinate)"/] v18 --o bind17 bind17 --as--o v18 bind18[/"sample(?lon1)"/] v18 --o bind18 bind18 --as--o v18 bind19[/"sample(?lat1)"/] v18 --o bind19 bind19 --as--o v18 bind20[/"sample(?lon2)"/] v18 --o bind20 bind20 --as--o v18 bind21[/"sample(?lat2)"/] v18 --o bind21 bind21 --as--o v18 bind22[/"concat(str(numeric-round( * '100^^xsd:integer') / '100^^xsd:integer'),' km')"/] null --o bind22 bind22 --as--o v18 bind23[/"sample(?sitelink)"/] v18 --o bind23 bind23 --as--o v18 bind24[/"sample(?itemLabel)"/] v18 --o bind24 bind24 --as--o v18 bind25[/"sample(?image)"/] v18 --o bind25 bind25 --as--o v18 bind26[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v18 --o bind26 v18 --o bind26 v18 --o bind26 v18 --o bind26 bind26 --as--o v18 bind27[/"STRDT(?str,'geo:wktLiteral')"/] v18 --o bind27 bind27 --as--o v18 bind28[/"'9B0058'"/] bind28 --as--o v18 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f29[["regex(str(?sitelink),'de.wikipedia.org/wiki/')"]] f29 --> v18 bind30[/VALUES ?poi/] bind30-->v17 bind300(["wd:Q277572"]) bind300 --> bind30 bind301(["wd:Q322853"]) bind301 --> bind30 bind302(["wd:Q866559"]) bind302 --> bind30 bind303(["wd:Q894173"]) bind303 --> bind30 bind304(["wd:Q881976"]) bind304 --> bind30 bind305(["wd:Q700562"]) bind305 --> bind30 bind306(["wd:Q227259"]) bind306 --> bind30 bind307(["wd:Q453233"]) bind307 --> bind30 bind308(["wd:Q6811"]) bind308 --> bind30 bind309(["wd:Q1272672"]) bind309 --> bind30 bind3010(["wd:Q1136672"]) bind3010 --> bind30 bind3011(["wd:Q880766"]) bind3011 --> bind30 bind3012(["wd:Q31310959"]) bind3012 --> bind30 bind3013(["wd:Q1720762"]) bind3013 --> bind30 bind3014(["wd:Q1867648"]) bind3014 --> bind30 bind3015(["wd:Q1600678"]) bind3015 --> bind30 bind3016(["wd:Q797717"]) bind3016 --> bind30 bind3017(["wd:Q1248323"]) bind3017 --> bind30 bind3018(["wd:Q1679651"]) bind3018 --> bind30 bind3019(["wd:Q1231293"]) bind3019 --> bind30 bind3020(["wd:Q1087301"]) bind3020 --> bind30 bind3021(["wd:Q2358380"]) bind3021 --> bind30 bind3022(["wd:Q22949130"]) bind3022 --> bind30 bind3023(["wd:Q2409158"]) bind3023 --> bind30 bind3024(["wd:Q827406"]) bind3024 --> bind30 bind3025(["wd:Q1801966"]) bind3025 --> bind30 bind31[/"?poi"/] v17 --o bind31 bind31 --as--o v17 v17 --"p:direct/P625"--> v18 subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a1 a1 --"p:statement/value/P625"--> a2 a2 --"wikibase:geoLatitude"--> v18 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a3 a3 --"p:statement/value/P625"--> a4 a4 --"wikibase:geoLongitude"--> v18 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:direct/P18".-> v18 end v18 --"schema:about"--> v17 bind32[/"'wd:Q15296697'"/] bind32 --as--o v17 v17 --"p:direct/P625"--> v9 subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a5 a5 --"p:statement/value/P625"--> a6 a6 --"wikibase:geoLatitude"--> v18 end subgraph optional10["(optional)"] style optional10 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:P625".-> a7 a7 --"p:statement/value/P625"--> a8 a8 --"wikibase:geoLongitude"--> v18 end subgraph optional11["(optional)"] style optional11 fill:#bbf,stroke-dasharray: 5 5; v17 -."p:direct/P18".-> v18 end bind33[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v18 --o bind33 v18 --o bind33 v18 --o bind33 v18 --o bind33 bind33 --as--o v18 bind34[/"STRDT(?str,'geo:wktLiteral')"/] v18 --o bind34 bind34 --as--o v18 bind35[/"http://www.opengis.net/def/function/geosparql/distance(?coordinate,?coordinate2)"/] v18 --o bind35 v9 --o bind35 bind35 --as--o v18 bind45[/"sample(?distNum)"/] v18 --o bind45 bind45 --as--o v16 bind46[/"sample(?coordinate)"/] v18 --o bind46 bind46 --as--o v18 bind47[/"sample(?lon1)"/] v18 --o bind47 bind47 --as--o v18 bind48[/"sample(?lat1)"/] v18 --o bind48 bind48 --as--o v18 bind49[/"sample(?lon2)"/] v18 --o bind49 bind49 --as--o v18 bind50[/"sample(?lat2)"/] v18 --o bind50 bind50 --as--o v18 bind51[/"concat(str(numeric-round( * '100^^xsd:integer') / '100^^xsd:integer'),' km')"/] null --o bind51 bind51 --as--o v18 bind52[/"sample(?sitelink)"/] v18 --o bind52 bind52 --as--o v18 bind53[/"sample(?itemLabel)"/] v18 --o bind53 bind53 --as--o v18 bind54[/"sample(?image)"/] v18 --o bind54 bind54 --as--o v18 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end