query-91b52d4bbeb46bcd4aeaaa25abde5cb2

rq turtle/ttl

Straßenkarte zur Wartung der Eigenschaft "physisch verbunden mit"

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 geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map;Table
#------------------------------------------------------------------------------------
# Straßenkarte zur Wartung der Eigenschaft "physisch verbunden mit"
#------------------------------------------------------------------------------------

SELECT  ?item ?itemLabel ?coord ?line 

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

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


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

WHERE {
  # jetzt Punkte und Linien für Ausgabe auf Karte ausgeben
 {  {
    SELECT ?item  ?coord #("9B0058" as ?rgb) 
    WHERE {
        ?item wdt:P131 wd:Q1731 .      # Objekt liegt in Verwaltungseinheit Dresden (oder Subklasse)
        VALUES ?instance_of { 
            wd:Q34442      # Straße
            wd:Q79007      # Innerortstraße
            wd:Q21000333   # Einkaufsstraße 
            wd:Q174782     # Platz
            wd:Q537127     # Straßenbrücke
            wd:Q3397519    # Spannbetonbrücke 
            wd:Q1055465    # Balkenbrücke  
        } 
        ?item wdt:P31 ?instance_of .   # Objekt ist eine Instanz von Verkehrsobjekt (Straße, Platz,...)
        ?item wdt:P625 ?coord .        # Objekt hat Koordinate
    }
}}
 union
 {  {
    # Linien generieren 
    SELECT ?line #("009b0d" as ?rgb) 
    WHERE {
         {
    SELECT ?item  ?coord #("9B0058" as ?rgb) 
    WHERE {
        ?item wdt:P131 wd:Q1731 .      # Objekt liegt in Verwaltungseinheit Dresden (oder Subklasse)
        VALUES ?instance_of { 
            wd:Q34442      # Straße
            wd:Q79007      # Innerortstraße
            wd:Q21000333   # Einkaufsstraße 
            wd:Q174782     # Platz
            wd:Q537127     # Straßenbrücke
            wd:Q3397519    # Spannbetonbrücke 
            wd:Q1055465    # Balkenbrücke  
        } 
        ?item wdt:P31 ?instance_of .   # Objekt ist eine Instanz von Verkehrsobjekt (Straße, Platz,...)
        ?item wdt:P625 ?coord .        # Objekt hat Koordinate
    }
}.               # Gefundenen Punkte von oberen Abfrage übernehmen
        ?item wdt:P2789 ?item2 .        # Objekt1 ist physisch verbunden mit Objekt2
        ?item2 wdt:P625 ?coord2 .       # Objekt2 hat Koordinate

        # Koordinate von Objekt1 auseinander nehmen
        OPTIONAL{?item p:P625 / psv:P625 / wikibase:geoLatitude ?lat1 . }
        OPTIONAL{?item p:P625 / psv:P625 / wikibase:geoLongitude ?lon1 . }

        # Koordinate von Objekt2 auseinander nehmen 
        OPTIONAL{?item2 p:P625 / psv:P625 / wikibase:geoLatitude ?lat2 . }
        OPTIONAL{?item2 p:P625 / psv:P625 / wikibase:geoLongitude ?lon2 . }

        # String für die Linie zusammenbauen
        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; v3("?coord"):::projected v5("?coord2") v4("?instance_of") v1("?item"):::projected v4("?item2") v6("?lat1") v8("?lat2") v11("?line"):::projected v7("?lon1") v9("?lon2") v10("?str") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,de,en"]):::literal c2(["wd:Q1731"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P131"--> c2 bind0[/VALUES ?instance_of/] bind0-->v4 bind00(["wd:Q34442"]) bind00 --> bind0 bind01(["wd:Q79007"]) bind01 --> bind0 bind02(["wd:Q21000333"]) bind02 --> bind0 bind03(["wd:Q174782"]) bind03 --> bind0 bind04(["wd:Q537127"]) bind04 --> bind0 bind05(["wd:Q3397519"]) bind05 --> bind0 bind06(["wd:Q1055465"]) bind06 --> bind0 v1 --"p:direct/P31"--> v4 v1 --"p:direct/P625"--> v3 v1 --"p:direct/P2789"--> v4 v4 --"p:direct/P625"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> a1 a1 --"p:statement/value/P625"--> a2 a2 --"wikibase:geoLatitude"--> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> a3 a3 --"p:statement/value/P625"--> a4 a4 --"wikibase:geoLongitude"--> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:P625".-> a5 a5 --"p:statement/value/P625"--> a6 a6 --"wikibase:geoLatitude"--> v8 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:P625".-> a7 a7 --"p:statement/value/P625"--> a8 a8 --"wikibase:geoLongitude"--> v9 end bind1[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/] v7 --o bind1 v6 --o bind1 v9 --o bind1 v8 --o bind1 bind1 --as--o v10 bind2[/"STRDT(?str,'geo:wktLiteral')"/] v10 --o bind2 bind2 --as--o v11 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P131"--> c2 bind3[/VALUES ?instance_of/] bind3-->v4 bind30(["wd:Q34442"]) bind30 --> bind3 bind31(["wd:Q79007"]) bind31 --> bind3 bind32(["wd:Q21000333"]) bind32 --> bind3 bind33(["wd:Q174782"]) bind33 --> bind3 bind34(["wd:Q537127"]) bind34 --> bind3 bind35(["wd:Q3397519"]) bind35 --> bind3 bind36(["wd:Q1055465"]) bind36 --> bind3 v1 --"p:direct/P31"--> v4 v1 --"p:direct/P625"--> v3 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end