User:Cmuelle8

From Wikidata
Jump to navigation Jump to search

Endpoints of cycling routes that run through Saxony-Anhalt grouped into map layers[edit]

The following query uses these:

Features: map (Q24515275)  View with Reasonator View with SQID

#defaultView:Map
SELECT ?coord (CONCAT(IF(BOUND(?d),?d,""),
                      IF(BOUND(?s),CONCAT(" ",?s),""),
                      IF(BOUND(?c),CONCAT(" ",?c),"")) AS ?desc1Label)
       ?desc2 ?desc2Label ?layer ?layerLabel ?pic
WHERE {
  BIND(?l AS ?layer).
  { SELECT ?l WHERE { ?l wdt:P31/wdt:P279* wd:Q353027. } } ?l wdt:P131+ wd:Q1206.
  OPTIONAL { ?l (p:P559|p:P609) [ ?ps1 ?desc2; pq:P625 ?coord ].  [] wikibase:statementProperty ?ps1. }.
  OPTIONAL { ?l ?__             [ ?ps2 ?desc1; pq:P131 ?desc2 ].  [] wikibase:statementProperty ?ps2. }. 
  OPTIONAL { ?l ?__             [ ?ps2 ?desc1; ?_pq    ?pqv   ].  [] wikibase:statementProperty ?ps2.
                                        FILTER(?_pq != pq:P131). ?pq wikibase:qualifier         ?_pq. }.
  OPTIONAL { ?l wdt:P625 ?coord. }.
  OPTIONAL { ?l wdt:P18 ?pic. }.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de".
    ?desc1 rdfs:label ?d. ?pq rdfs:label ?s. ?pqv rdfs:label ?c.
    ?desc2 rdfs:label ?desc2Label. ?layer rdfs:label ?layerLabel.
  }
}