User talk:Smalyshev (WMF)/Archive 1

Latest comment: 8 years ago by Smalyshev (WMF) in topic wdqs SPARQL failing


wdqs SPARQL failing

Hi Smalyshev, I noticed you added many SPARQL examples to the new beta service. Maybe you can help me. I'm not too familiar with SPARQL, so why does this fail (the giant Java blurb of death isn't really helpful):

prefix wdt: <http://www.wikidata.org/prop/direct/>
prefix entity: <http://www.wikidata.org/entity/>
SELECT ?item WHERE {
  ?item wdt:P31 entity:Q5 .
  FILTER NOT EXISTS { ?item wdt:P18 ?dummy0 }
} limit 5

All I want is five items of humans without image. Thanks, Magnus Manske (talk) 11:52, 29 May 2015 (UTC)Reply

@Magnus Manske: It times out, probably because there's a lot of humans, and "not exists" probably is not indexed ("not" queries are usually bad in this regard). The queries on the beta service are limited by 30 seconds now (to keep one person from blocking the service) and the machine it runs on is not the fastest one, so this one may very well take the long time. I understand the "not exists" case is a frequent one, so I'll check with Blazegraph people if this can be improved somehow.
Ah yes, and the timeout message does suck. I'll add code to the GUI to make it clear what happened. Smalyshev (WMF) (talk) 18:05, 29 May 2015 (UTC)Reply
@Magnus Manske: I was just advised that it may be due to optimizer in Blazegraph being not smart, but there's a way to make it work much better:
SELECT ?item WHERE {
 ?item wdt:P31 entity:Q5 .
 OPTIONAL { ?item wdt:P18 ?dummy0 }
 FILTER(!bound(?dummy0))
} limit 5

That runs very fast for me. Smalyshev (WMF) (talk) 20:45, 29 May 2015 (UTC)Reply

Return to the user page of "Smalyshev (WMF)/Archive 1".