private static void checkExprVarUse(Query query)
{
if ( query.hasGroupBy() )
{
VarExprList groupKey = query.getGroupBy() ;
// Copy - we need to add variables
// SELECT (count(*) AS ?C) (?C+1 as ?D)
List<Var> inScopeVars = new ArrayList<Var>(groupKey.getVars()) ;
VarExprList exprList = query.getProject() ;
for ( Iterator<Var> iter = exprList.getVars().iterator() ; iter.hasNext() ; )
{
// In scope?
Var v = iter.next();
Expr e = exprList.getExpr(v) ;
if ( e == null )
{
if ( ! inScopeVars.contains(v) )
throw new QueryParseException("Non-group key variable in SELECT: "+v, -1 , -1) ;
}