query-ef678f4ec91a10e88d878ee288edb084
Query timing out with a long VALUES listHi folks! I'm trying to create a search for a list of cultural institutions in a group of 24 counties in Georgia. I did this in SPARQL by creating a VALUES array for those counties, but of course it's timing out. I know it should work logically, but is there any way to do this that's more efficient so it won't time out?
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#>
SELECT DISTINCT ?library ?libraryLabel ?located_at_street_address ?coordinate_location ?phone_number ?e_mail_address ?countyLabel WHERE {
VALUES (?located_in_the_administrative_territorial_entity ?countyLabel) { (wd:Q491547 "Union County") (wd:Q503538 "Towns County") (wd:Q503546 "Rabun County") (wd:Q492040 "Lumpkin County") (wd:Q389365 "White County") (wd:Q501096 "Habersham County") (wd:Q498362 "Stephens County") (wd:Q492012 "Hall County") (wd:Q488201 "Banks County") (wd:Q385931 "Franklin County") (wd:Q491301 "Hart County") (wd:Q486838 "Barrow County") (wd:Q486137 "Jackson County") (wd:Q156387 "Madison County") (wd:Q492016 "Elbert County") (wd:Q498312 "Walton County") (wd:Q492026 "Oconee County") (wd:Q112061 "Clarke County") (wd:Q491525 "Oglethorpe County") (wd:Q491759 "Wilkes County") (wd:Q491519 "Lincoln County") (wd:Q501101 "Newton County") (wd:Q493083 "Morgan County") (wd:Q486765 "Greene County") }
FILTER NOT EXISTS { ?library wdt:P576 []}
?library (wdt:P31/(wdt:P279*)) wd:Q5193377; wdt:P131 ?located_in_the_administrative_territorial_entity.
OPTIONAL { ?library wdt:P6375 ?located_at_street_address. }
OPTIONAL { ?library wdt:P625 ?coordinate_location. }
OPTIONAL { ?library wdt:P1329 ?phone_number. }
OPTIONAL { ?library wdt:P968 ?e_mail_address. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} ORDER BY ?library LIMIT 10000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?coordinate_location"):::projected
v3("?countyLabel"):::projected
v7("?e_mail_address"):::projected
v1("?library"):::projected
v4("?located_at_street_address"):::projected
v2("?located_in_the_administrative_territorial_entity")
v6("?phone_number"):::projected
a1((" "))
a2((" "))
c13(["en"]):::literal
c4(["wd:Q5193377"]):::iri
c11(["bd:serviceParam"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P576"--> e0a1
e0v1("?library"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
v1 --"wdt:P576"--> a1
bind1[/VALUES ?countyLabel ?located_in_the_administrative_territorial_entity/]
bind1-->v2
bind1-->v3
bind10(["wd:Q491547"])
bind10 --> bind1
bind11(["Union County"])
bind11 --> bind1
bind12(["wd:Q503538"])
bind12 --> bind1
bind13(["Towns County"])
bind13 --> bind1
bind14(["wd:Q503546"])
bind14 --> bind1
bind15(["Rabun County"])
bind15 --> bind1
bind16(["wd:Q492040"])
bind16 --> bind1
bind17(["Lumpkin County"])
bind17 --> bind1
bind18(["wd:Q389365"])
bind18 --> bind1
bind19(["White County"])
bind19 --> bind1
bind110(["wd:Q501096"])
bind110 --> bind1
bind111(["Habersham County"])
bind111 --> bind1
bind112(["wd:Q498362"])
bind112 --> bind1
bind113(["Stephens County"])
bind113 --> bind1
bind114(["wd:Q492012"])
bind114 --> bind1
bind115(["Hall County"])
bind115 --> bind1
bind116(["wd:Q488201"])
bind116 --> bind1
bind117(["Banks County"])
bind117 --> bind1
bind118(["wd:Q385931"])
bind118 --> bind1
bind119(["Franklin County"])
bind119 --> bind1
bind120(["wd:Q491301"])
bind120 --> bind1
bind121(["Hart County"])
bind121 --> bind1
bind122(["wd:Q486838"])
bind122 --> bind1
bind123(["Barrow County"])
bind123 --> bind1
bind124(["wd:Q486137"])
bind124 --> bind1
bind125(["Jackson County"])
bind125 --> bind1
bind126(["wd:Q156387"])
bind126 --> bind1
bind127(["Madison County"])
bind127 --> bind1
bind128(["wd:Q492016"])
bind128 --> bind1
bind129(["Elbert County"])
bind129 --> bind1
bind130(["wd:Q498312"])
bind130 --> bind1
bind131(["Walton County"])
bind131 --> bind1
bind132(["wd:Q492026"])
bind132 --> bind1
bind133(["Oconee County"])
bind133 --> bind1
bind134(["wd:Q112061"])
bind134 --> bind1
bind135(["Clarke County"])
bind135 --> bind1
bind136(["wd:Q491525"])
bind136 --> bind1
bind137(["Oglethorpe County"])
bind137 --> bind1
bind138(["wd:Q491759"])
bind138 --> bind1
bind139(["Wilkes County"])
bind139 --> bind1
bind140(["wd:Q491519"])
bind140 --> bind1
bind141(["Lincoln County"])
bind141 --> bind1
bind142(["wd:Q501101"])
bind142 --> bind1
bind143(["Newton County"])
bind143 --> bind1
bind144(["wd:Q493083"])
bind144 --> bind1
bind145(["Morgan County"])
bind145 --> bind1
bind146(["wd:Q486765"])
bind146 --> bind1
bind147(["Greene County"])
bind147 --> bind1
v1 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c4
v1 --"wdt:P131"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P6375".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P625".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P1329".-> v6
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P968".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end