}
public SelectBuilder orderBy(Resource condition)
{
if (condition == null) throw new IllegalArgumentException("ORDER BY condition cannot be null");
Variable var = SPINFactory.asVariable(condition);
if (var != null && !isWhereVariable(var))
{
if (log.isErrorEnabled()) log.error("Variable var: {} not in the WHERE pattern", var);
throw new IllegalArgumentException("Cannot ORDER BY variable '" + var + "' that is not specified in the WHERE pattern");
}
if (condition.hasProperty(SP.expression))
{
Variable exprVar = SPINFactory.asVariable(condition.getPropertyResourceValue(SP.expression));
if (exprVar != null && !isWhereVariable(exprVar)) throw new IllegalArgumentException("Cannot ORDER BY variable that is not specified in the WHERE pattern");
}
if (log.isTraceEnabled()) log.trace("Setting ORDER BY condition: {}", condition);
if (hasProperty(SP.orderBy))