Variables introduced by AS in a SELECT clause must not already be in-scope.
See also https://www.w3.org/TR/sparql12-query/#variableScope
The variable v must not be in-scope at the point of the (expr AS v) form.
In-scope are the variables bound by the WHERE clause (including subquery projections), or, in a grouped query,
the GROUP BY keys (v and (expr AS v)), and the trailing VALUES clause (joined before the projection, 18.2.4.3).
The variable may also not be used in an earlier SELECT expression.
Grammar note 11 of https://www.w3.org/TR/sparql12-query/#sparqlGrammar (note 12 in SPARQL 1.1)