User:Ladon

From Wikidata
Jump to navigation Jump to search
Babel user information
de-N Dieser Benutzer spricht Deutsch als Muttersprache.
en-3 This user has advanced knowledge of English.
This user has basic understanding of the Pywikibot software library.
Users by language


Bisherige Tätigkeiten[edit]

#defaultView:Map{"hide":["?coordinates", "?line", "?rgb"]}
SELECT DISTINCT ?coordinates ?line ?item ?itemLabel ?connectLabel ?image ?codeLabel ?rgb

WITH {
  SELECT ?item (SAMPLE(?coordinates) AS ?coordinates) (SAMPLE(?image) AS ?image) (sample(?lat1) as ?lat1) (sample(?lon1) as ?lon1) (sample(?code) as ?code) WHERE {
    ?item wdt:P31 wd:Q2175765.
    ?item wdt:P131 wd:Q1726.
    ?item wdt:P625 ?coordinates  .
    ?item p:P625 / psv:P625 / wikibase:geoLatitude ?lat1 .
    ?item p:P625 / psv:P625 / wikibase:geoLongitude ?lon1 .
    OPTIONAL { ?item wdt:P18 ?image }.
    OPTIONAL { ?item wdt:P1192 ?code }.
  } GROUP BY ?item
} AS %stations

WITH {
  SELECT ?nextstation (sample(?lat2) as ?lat2) (sample(?lon2) as ?lon2) WHERE {
    ?nextstation wdt:P31 wd:Q2175765 .
    ?nextstation wdt:P131 wd:Q1726 .
    ?nextstation p:P625 / psv:P625 / wikibase:geoLatitude ?lat2 .
    ?nextstation p:P625 / psv:P625 / wikibase:geoLongitude ?lon2 .
  } GROUP BY ?nextstation
} AS %nextstations

WITH {
  SELECT ?line ?connect ("9B0058" as ?rgb) WHERE {
    INCLUDE %stations .
    INCLUDE %nextstations .
    ?item p:P197 ?nextstationstatement .
    ?nextstationstatement ps:P197 ?nextstation .
    ?nextstationstatement pq:P81 ?connect . 
    FILTER(STR(?item) < STR(?nextstation)) .    
    BIND(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) .
    BIND(STRDT(?str, geo:wktLiteral) AS ?line) 
  }
} AS %lines 
 
WHERE {
  { INCLUDE %stations }  UNION { INCLUDE %lines  } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!