query-7f32b744f4f890832e3cabcc9bca3587
Séoul à faire
Use at
- https://query.wikidata.org/sparql
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?station ?stationLabel ?subwayLine ?line_number ?layer ?towards ?towardsLabel WHERE {
VALUES ?search {
wd:Q16950
#critère de recherche de système de métro
}
?search wdt:P527 ?lignes.#quelles sont les lignes de ce métro
?lignes wdt:P559 ?termini.#quels sont les terminus de ce métro
?station wdt:P31/wdt:P279* wd:Q928830; #station de métro
wdt:P361|wdt:P16 ?search;#qui font partie du réseau recherché
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. optional{?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 )
MINUS { ?station (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }#on ne veut pas les stations disparues
MINUS {
?station wdt:P5817|wdt:P5816 ?interdit.
VALUES ?interdit { wd:Q811683 wd:Q63065035 wd:Q12377751 wd:Q97317113 wd:Q55653430 wd:Q30108381 wd:Q55570340 wd:Q11639308 wd:Q104664889
}
}#on ne veut pas les cas particuliers, en construction etc
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr" .
?subwayLine rdfs:label ?layer.
?pred rdfs:label ?predLabel . ?towards rdfs:label ?towardsLabel.
?station rdfs:label ?stationLabel .
} } GROUP BY ?station ?stationLabel ?subwayLine ?rgb ?predLabel ?layer ?towards ?line_number ?towardsLabel order by asc( ?line_number ) ?subwayLine
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?coords_pred")
v12("?dispar")
v14("?interdit")
v14("?layer"):::projected
v5("?lignes")
v1("?line_number"):::projected
v11("?line_pq")
v9("?pred")
v15("?predLabel")
v7("?search")
v8("?station"):::projected
v17("?stationLabel"):::projected
v2("?subwayLine"):::projected
v6("?subwayLine_pred")
v4("?termini")
v3("?towards"):::projected
v16("?towardsLabel"):::projected
a2((" "))
a1((" "))
c26(["#91;AUTO_LANGUAGE#93;,en,fr"]):::literal
c5(["wd:Q928830"]):::iri
c24(["bd:serviceParam"]):::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:Q16950"])
bind30 --> 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
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"--> v9
v9 --"p:direct/P625"--> v10
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v9 --"p:direct/P1192"--> v6
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v9 --"p:direct/P81"--> v6
end
union2r <== or ==> union2l
end
v8 --"p:P197"--> a2
a2 --"p:statement/P197"--> v9
a2 --"p:qualifier/P5051"--> v3
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
a2 --"p:qualifier/P1192"--> v11
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
a2 --"p:qualifier/P81"--> v11
end
union3r <== or ==> union3l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P1671".-> v1
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
subgraph union4[" Union "]
subgraph union4l[" "]
style union4l fill:#abf,stroke-dasharray: 3 3;
subgraph union5[" Union "]
subgraph union5l[" "]
style union5l fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P3999"--> v12
end
subgraph union5r[" "]
style union5r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P582"--> v12
end
union5r <== or ==> union5l
end
end
subgraph union4r[" "]
style union4r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P576"--> v12
end
union4r <== or ==> union4l
end
end
subgraph minus5["MINUS"]
style minus5 stroke-width:6px,fill:pink,stroke:red;
subgraph union6[" Union "]
subgraph union6l[" "]
style union6l fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P5816"--> v14
end
subgraph union6r[" "]
style union6r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:direct/P5817"--> v14
end
union6r <== or ==> union6l
end
bind6[/VALUES ?interdit/]
bind6-->v14
bind60(["wd:Q811683"])
bind60 --> bind6
bind61(["wd:Q63065035"])
bind61 --> bind6
bind62(["wd:Q12377751"])
bind62 --> bind6
bind63(["wd:Q97317113"])
bind63 --> bind6
bind64(["wd:Q55653430"])
bind64 --> bind6
bind65(["wd:Q30108381"])
bind65 --> bind6
bind66(["wd:Q55570340"])
bind66 --> bind6
bind67(["wd:Q11639308"])
bind67 --> bind6
bind68(["wd:Q104664889"])
bind68 --> bind6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c24 --"wikibase:language"--> c26
v2 --"rdfs:label"--> v14
v9 --"rdfs:label"--> v15
v3 --"rdfs:label"--> v16
v8 --"rdfs:label"--> v17
end