Change prefix entity: http://www.wikidata.org/entity/ to prefix wd: http://www.wikidata.org/entity/ to use same prefix as suggested by query.wikidata.org
This is a copy from https://github.com/smalyshev/wdq2sparql/issues/3 because nothing seems to be happening on that side and this is wasting time. I'm not sure if it's just a matter of changing https://github.com/smalyshev/wdq2sparql/blob/master/Sparql/Syntax/Wikidata.php