query-6497be5da01e1cc9a31402ff0bf1da02

rq turtle/ttl

Optimize query but it takes too many time so it can be displayed. this pageHello, is it possible to optimize the above query? I use it to generate graph on

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?type ?count { {
  SELECT ("Avec" as ?type) (COUNT(DISTINCT ?item) as ?count)
  WHERE {
    ?item (wdt:P131/wdt:P131) wd:Q3131.
    ?item (wdt:P31/wdt:P279*) wd:Q16970.
    ?item wdt:P625 ?coor.} }
UNION {
  SELECT ("Sans" as ?type) (COUNT(DISTINCT ?item) as ?count)
  WHERE {
    ?item (wdt:P131/wdt:P131) wd:Q3131.
    ?item (wdt:P31/wdt:P279*) wd:Q16970.
  MINUS { ?item wdt:P625 [].} } }
}
ORDER BY ?type

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?coor") v5("?count"):::projected v2("?item") v5("?type"):::projected a5((" ")) a1((" ")) a2((" ")) a3((" ")) a4((" ")) c2(["wd:Q3131"]):::iri c5(["wd:Q16970"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P131"--> a3 a3 --"wdt:P131"--> c2 v2 --"wdt:P31"--> a4 a4 --"wdt:P279"--> c5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P625"--> a5 end bind2[/"'Sans'"/] bind2 --as--o v5 bind3[/"count(?item)"/] v2 --o bind3 bind3 --as--o v5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P131"--> a1 a1 --"wdt:P131"--> c2 v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c5 v2 --"wdt:P625"--> v3 bind5[/"'Avec'"/] bind5 --as--o v5 bind6[/"count(?item)"/] v2 --o bind6 bind6 --as--o v5 end union0r <== or ==> union0l end