query-e812d6059a272d300e68eae18f34a13b
Bisherige TätigkeitenAnlage einiger Trambahn-Linien in München, (Q20084080)QuickStatements in alle Nationen mit (P11547)Happy Planet Index score Einpflegen des (P11547)Happy Planet Index score Beantragung einer neuen Property in alle Nationen(P1125)Gini coefficient Einpflegen des (Q15169668)Pywikibot Einarbeitung in (Q54871)SPARQL Einarbeitung in (Q2013)Wikidata Einarbeitung in
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 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#>
#defaultView:Map{"hide":["?coordinates", "?line", "?rgb"]}
SELECT DISTINCT ?coordinates ?line ?item ?itemLabel ?connectLabel ?image ?codeLabel ?rgb
WHERE {
{ {
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
}} UNION { {
SELECT ?line ?connect ("9B0058" as ?rgb) WHERE {
{
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
}.
{
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
}.
?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)
}
} } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?code")
v11("?connect")
v8("?coordinates"):::projected
v8("?image"):::projected
v1("?item"):::projected
v8("?lat1")
v10("?lat2")
v13("?line"):::projected
v8("?lon1")
v10("?lon2")
v7("?nextstation")
v10("?nextstationstatement")
v14("?rgb"):::projected
v12("?str")
a1((" "))
a2((" "))
a3((" "))
a4((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
a10((" "))
a11((" "))
a12((" "))
c2(["wd:Q2175765"]):::iri
c4(["wd:Q1726"]):::iri
c16(["bd:serviceParam"]):::iri
c18(["#91;AUTO_LANGUAGE#93;,en"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[["str(?item) < str(?nextstation)"]]
f0 --> v1
f0 --> v7
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P131"--> c4
v1 --"p:direct/P625"--> v8
v1 --"p:P625"--> a5
a5 --"p:statement/value/P625"--> a6
a6 --"wikibase:geoLatitude"--> v8
v1 --"p:P625"--> a7
a7 --"p:statement/value/P625"--> a8
a8 --"wikibase:geoLongitude"--> v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P18".-> v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P1192".-> v8
end
bind6[/"sample(?coordinates)"/]
v8 --o bind6
bind6 --as--o v8
bind7[/"sample(?image)"/]
v8 --o bind7
bind7 --as--o v8
bind8[/"sample(?lat1)"/]
v8 --o bind8
bind8 --as--o v8
bind9[/"sample(?lon1)"/]
v8 --o bind9
bind9 --as--o v8
bind10[/"sample(?code)"/]
v8 --o bind10
bind10 --as--o v8
v7 --"p:direct/P31"--> c2
v7 --"p:direct/P131"--> c4
v7 --"p:P625"--> a9
a9 --"p:statement/value/P625"--> a10
a10 --"wikibase:geoLatitude"--> v10
v7 --"p:P625"--> a11
a11 --"p:statement/value/P625"--> a12
a12 --"wikibase:geoLongitude"--> v10
bind13[/"sample(?lat2)"/]
v10 --o bind13
bind13 --as--o v10
bind14[/"sample(?lon2)"/]
v10 --o bind14
bind14 --as--o v10
v1 --"p:P197"--> v10
v10 --"p:statement/P197"--> v7
v10 --"p:qualifier/P81"--> v11
bind15[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/]
v8 --o bind15
v8 --o bind15
v10 --o bind15
v10 --o bind15
bind15 --as--o v12
bind16[/"STRDT(?str,'geo:wktLiteral')"/]
v12 --o bind16
bind16 --as--o v13
bind17[/"'9B0058'"/]
bind17 --as--o v14
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P131"--> c4
v1 --"p:direct/P625"--> v8
v1 --"p:P625"--> a1
a1 --"p:statement/value/P625"--> a2
a2 --"wikibase:geoLatitude"--> v8
v1 --"p:P625"--> a3
a3 --"p:statement/value/P625"--> a4
a4 --"wikibase:geoLongitude"--> v8
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P18".-> v8
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P1192".-> v8
end
bind23[/"sample(?coordinates)"/]
v8 --o bind23
bind23 --as--o v8
bind24[/"sample(?image)"/]
v8 --o bind24
bind24 --as--o v8
bind25[/"sample(?lat1)"/]
v8 --o bind25
bind25 --as--o v8
bind26[/"sample(?lon1)"/]
v8 --o bind26
bind26 --as--o v8
bind27[/"sample(?code)"/]
v8 --o bind27
bind27 --as--o v8
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
end