query-a7fd029cf3863319b743ba05c38a587c
Why is this so slow?What am I doing wrong here?
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 bd: <http://www.bigdata.com/rdf#>
# defaultView:Map
SELECT ?url ?item ?itemLabel ?itemDescription (SAMPLE(?coords) AS ?point)
WHERE {
{
SELECT ?item ?id WHERE {
?item wdt:P1343 wd:Q105770461 .
# ?item wdt:P31 wd:Q2116450 .
?item wdt:P3029 ?id
}
}.
OPTIONAL { {
SELECT ?item ?id WHERE {
?item wdt:P1343 wd:Q105770461 .
# ?item wdt:P31 wd:Q2116450 .
?item wdt:P3029 ?id
}
}. ?item wdt:P276 ?loc . ?loc wdt:P625 ?coords} .
OPTIONAL { {
SELECT ?item ?id WHERE {
?item wdt:P1343 wd:Q105770461 .
# ?item wdt:P31 wd:Q2116450 .
?item wdt:P3029 ?id
}
}. ?item wdt:P131 ?par . ?par wdt:P625 ?coords} .
FILTER (BOUND(?coords)) .
wd:P3029 wdt:P1630 ?fmt .
BIND(IRI(REPLACE(?id, '(^.*)', ?fmt)) AS ?url) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?url ?item ?itemLabel ?itemDescription
ORDER BY ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?coords"):::projected
v6("?fmt")
v3("?id")
v1("?item"):::projected
v4("?loc")
v5("?par")
v8("?point")
v7("?url"):::projected
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c7(["wd:P3029"]):::iri
c2(["wd:Q105770461"]):::iri
f0[["bound(?coords)"]]
f0 --> v2
v1 --"wdt:P1343"--> c2
v1 --"wdt:P3029"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P1343".-> c2
v1 --"wdt:P3029"--> v3
v1 --"wdt:P276"--> v4
v4 --"wdt:P625"--> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P1343".-> c2
v1 --"wdt:P3029"--> v3
v1 --"wdt:P131"--> v5
v5 --"wdt:P625"--> v2
end
c7 --"wdt:P1630"--> v6
bind1[/"replace(?id,'(^.*)',?fmt)"/]
v3 --o bind1
v6 --o bind1
bind1 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
bind3[/"sample(?coords)"/]
v2 --o bind3
bind3 --as--o v8