query-216cefbac8966b68ad96a5fe854da95d
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Carte des réseaux d'Île-de-France avec en vert, les fonctionnels et en jaune les en cours de construction
#defaultView:Map{"hide":["?coords", "?line","?rgb"]}
SELECT ?station ?stationLabel ?subwayLine ?coords ?line ?layer ?rgb WHERE {
VALUES ?search { wd:Q1142114 wd:Q389554 wd:Q50716 wd:Q216125 #critère de recherche de système de tramway
}
?search wdt:P527 ?lignes.#quelles sont les lignes de ce tramway
?lignes wdt:P559 ?termini.#quels sont les terminus de ce tramway
?station wdt:P31/wdt:P279* wd:Q548662; #de type poteau d'arrêt ou plus précis
wdt:P361|wdt:P16 ?search;#qui font partie du réseau recherché
wdt:P625 ?coords;
wdt:P81|wdt:P1192 ?subwayLine;
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 .
?subwayLine wdt:P1671 ?line_number.
FILTER(?subwayLine_pred = ?lignes)#on ne prend les LIGNES que si la correspondance est sur la même ligne
FILTER(?subwayLine = ?lignes)
FILTER(?towards = ?termini)
?pred p:P625 ?node_pred .
?node_pred psv:P625/wikibase:geoLatitude ?lat1 ;psv:P625/wikibase:geoLongitude ?lon1 .
?node_pred a wikibase:BestRank.
?station p:P625 ?node_station.
?node_station psv:P625/wikibase:geoLatitude ?lat2 ;psv:P625/wikibase:geoLongitude ?lon2.
?node_station a wikibase:BestRank.
BIND(CONCAT("LINESTRING(", STR(?lon1), " ", STR(?lat1), ",", STR(?lon2), " ", STR(?lat2), ")") AS ?str)
BIND(STRDT(?str, geo:wktLiteral) AS ?line)
?subwayLine wdt:P5817 ?etat_ligne.
?etat_ligne wdt:P465 ?rgb_ligne.
?station wdt:P5817 ?etat_station.
?etat_station wdt:P465 ?rgb_station.
BIND(COALESCE(?rgb_station, ?rgb_ligne) AS ?rgb).
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?subwayLine rdfs:label ?layer.
?pred rdfs:label ?predLabel.
?station rdfs:label ?stationLabel .
} } GROUP BY ?station ?stationLabel ?subwayLine ?rgb ?predLabel ?layer ?coords ?line order by xsd:integer(?line_number) ?line_number ?subwayLine
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?coords"):::projected
v11("?coords_pred")
v21("?etat_ligne")
v23("?etat_station")
v14("?lat1")
v17("?lat2")
v26("?layer"):::projected
v5("?lignes")
v20("?line"):::projected
v1("?line_number")
v12("?line_pq")
v15("?lon1")
v18("?lon2")
v13("?node_pred")
v16("?node_station")
v10("?pred")
v27("?predLabel")
v25("?rgb"):::projected
v22("?rgb_ligne")
v24("?rgb_station")
v7("?search")
v8("?station"):::projected
v28("?stationLabel"):::projected
v19("?str")
v2("?subwayLine"):::projected
v6("?subwayLine_pred")
v4("?termini")
v3("?towards")
a2((" "))
a1((" "))
a3((" "))
a4((" "))
a5((" "))
a6((" "))
c27(["bd:serviceParam"]):::iri
c23(["wikibase:BestRank"]):::iri
c29(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c5(["wd:Q548662"]):::iri
f0[["?towards = ?termini"]]
f0 --> v3
f0 --> v4
f1[["?subwayLine = ?lignes"]]
f1 --> v2
f1 --> v5
f2[["?subwayLine_pred = ?lignes"]]
f2 --> v6
f2 --> v5
bind3[/VALUES ?search/]
bind3-->v7
bind30(["wd:Q1142114"])
bind30 --> bind3
bind31(["wd:Q389554"])
bind31 --> bind3
bind32(["wd:Q50716"])
bind32 --> bind3
bind33(["wd:Q216125"])
bind33 --> bind3
v7 --"p:direct/P527"--> v5
v5 --"p:direct/P559"--> v4
v8 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c5
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P16"--> v7
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P361"--> v7
end
union0r <== or ==> union0l
end
v8 --"p:direct/P625"--> v9
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P1192"--> v2
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P81"--> v2
end
union1r <== or ==> union1l
end
v8 --"p:direct/P197"--> v10
v10 --"p:direct/P625"--> v11
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v10 --"p:direct/P1192"--> v6
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v10 --"p:direct/P81"--> v6
end
union2r <== or ==> union2l
end
v8 --"p:P197"--> a2
a2 --"p:statement/P197"--> v10
a2 --"p:qualifier/P5051"--> v3
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
a2 --"p:qualifier/P1192"--> v12
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
a2 --"p:qualifier/P81"--> v12
end
union3r <== or ==> union3l
end
v2 --"p:direct/P1671"--> v1
v10 --"p:P625"--> v13
v13 --"p:statement/value/P625"--> a3
a3 --"wikibase:geoLatitude"--> v14
v13 --"p:statement/value/P625"--> a4
a4 --"wikibase:geoLongitude"--> v15
v13 --"a"--> c23
v8 --"p:P625"--> v16
v16 --"p:statement/value/P625"--> a5
a5 --"wikibase:geoLatitude"--> v17
v16 --"p:statement/value/P625"--> a6
a6 --"wikibase:geoLongitude"--> v18
v16 --"a"--> c23
bind4[/"concat('LINESTRING(',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/]
v15 --o bind4
v14 --o bind4
v18 --o bind4
v17 --o bind4
bind4 --as--o v19
bind5[/"STRDT(?str,'geo:wktLiteral')"/]
v19 --o bind5
bind5 --as--o v20
v2 --"p:direct/P5817"--> v21
v21 --"p:direct/P465"--> v22
v8 --"p:direct/P5817"--> v23
v23 --"p:direct/P465"--> v24
bind6[/"?rgb_station?rgb_ligne"/]
v24 --o bind6
v22 --o bind6
bind6 --as--o v25
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c27 --"wikibase:language"--> c29
v2 --"rdfs:label"--> v26
v10 --"rdfs:label"--> v27
v8 --"rdfs:label"--> v28
end