I can confirm that, just had a chat at RDF4JUsers where I was told that:

"In terms of getting the query to parse, why not just reorder the
BIND() to the front of the group?  This is what blazegraph is doing
internally. "

So you guessed right (and we are going to treat those queries the same way).

Thanks and greetings,

Adrian
Hi!

On 1/14/17 9:23 AM, Adrian Bielefeldt wrote:
I was wondering if anybody could help me understand why (and how) this
query:

SELECT DISTINCT ?item
WHERE
{ ?tree0 wdt:P31 ?item . BIND (wd:Q146 AS ?tree0) }

is being accepted by query.wikidata.org.
Probably Blazegraph engine considers it analogous with the query having
the bind in front, or maybe optimization reorders it.

At the moment we are parsing them using OpenRDF, which fails (as far
as I can see understandably) at parsing this query.

Well, the standard does say you can not use a variable in BIND that was
previously used, and I guess OpenRDF parser chooses to be more strict
than Blazegraph.