query-c8458426a2c9d54a7d70a9d2104f45a4

rq turtle/ttl

All places in the Great Catalan Encyclopedia that are not part of the Catalan CountriesHello! I want to search for all the items in the Great Catalan Encyclopedia that are not part or their cultural area. The query is done, but it seems heavy it can't be run. Is there a way to make it more economical?

Use at

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 (COUNT(?item) as ?count) ?herrialdeaLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P17 ?herrialdea.
  ?item wdt:P1296 ?cat
  MINUS{?item wdt:P131*/wdt:P706* wd:Q5765.} 
  MINUS{?item wdt:P131*/wdt:P706* wd:Q5705.} 
  MINUS {?item wdt:P131*/wdt:P706* wd:Q5720.} 
  MINUS {?item wdt:P131*/wdt:P706* wd:Q228.} 
  MINUS {?item wdt:P131*/wdt:P706* wd:Q166282.} 
  MINUS {?item wdt:P131*/wdt:P706* wd:Q15580.}
}
GROUP by ?herrialdeaLabel
ORDER by DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?cat") v5("?count") v3("?herrialdea") v2("?item"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) c10(["wd:Q5705"]):::iri c14(["wd:Q15580"]):::iri c13(["wd:Q166282"]):::iri c2(["bd:serviceParam"]):::iri c12(["wd:Q228"]):::iri c11(["wd:Q5720"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal c9(["wd:Q5765"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v2 --"wdt:P17"--> v3 v2 --"wdt:P1296"--> v4 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P131"--> a1 a1 --"wdt:P706"--> c9 end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P131"--> a2 a2 --"wdt:P706"--> c10 end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P131"--> a3 a3 --"wdt:P706"--> c11 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P131"--> a4 a4 --"wdt:P706"--> c12 end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P131"--> a5 a5 --"wdt:P706"--> c13 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P131"--> a6 a6 --"wdt:P706"--> c14 end bind7[/"count(?item)"/] v2 --o bind7 bind7 --as--o v5