#title: ?searchLabel
#defaultView:Map{"hide":["?coords", "?line_number", "?line", "?search","?logo", "?rgb"]}
SELECT ?station ?stationLabel ?coords ?line_number ?search ?searchLabel ?line ?rgb ?logo
(sample (?image) as ?imag) (sample(?image_panneau) as ?panneau) WHERE {
VALUES ?search {
wd:Q741818
}
?search wdt:P559 ?termini.
?station (wdt:P31/(wdt:P279*)) wd:Q548662;
wdt:P5817 wd:Q55654238;
wdt:P625 ?coords;
(wdt:P81|wdt:P1192) ?search;
wdt:P197 ?pred.
?pred wdt:P625 ?coords_pred;
(wdt:P81|wdt:P1192) ?subwayLine_pred.
?station p:P197 _:b1.
_:b1 ps:P197 ?pred;
pq:P5051 ?towards;
(pq:P81|pq:P1192) ?line_pq.
?pred wdt:P5817 wd:Q55654238.
OPTIONAL { ?search wdt:P1671 ?line_number. }
OPTIONAL { ?search wdt:P154 ?logo.}
optional {?station wdt:P18 ?image.}
optional {?station wdt:P1766 ?image_panneau.}
FILTER(?subwayLine_pred = ?search)
FILTER(?towards = ?termini)
?pred p:P625 ?node_pred.
?node_pred (psv:P625/wikibase:geoLatitude) ?lat1;
(psv:P625/wikibase:geoLongitude) ?lon1;
rdf:type wikibase:BestRank.
?station p:P625 ?node_station.
?node_station (psv:P625/wikibase:geoLatitude) ?lat2;
(psv:P625/wikibase:geoLongitude) ?lon2;
rdf:type wikibase:BestRank.
BIND(CONCAT("LINESTRING(", STR(?lon1), " ", STR(?lat1), ",", STR(?lon2), " ", STR(?lat2), ")") AS ?str)
BIND(STRDT(?str, geo:wktLiteral) AS ?line)
?search wdt:P465 ?rgb.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr".
?pred rdfs:label ?predLabel .
?search rdfs:label ?searchLabel.
?station rdfs:label ?stationLabel.
}
} group by ?station ?stationLabel ?coords ?line_number ?search ?searchLabel ?line ?rgb ?logo
ORDER BY ?coords