use of org.apache.jena.sparql.expr.VariableNotBoundException in project jena by apache.
the class BindingComparator method compare.
// Compare bindings by iterating.
// Node comparsion is:
// Compare by
@Override
public int compare(Binding bind1, Binding bind2) {
for (SortCondition sc : conditions) {
if (sc.expression == null) {
throw new QueryExecException("Broken sort condition");
}
NodeValue nv1 = null;
NodeValue nv2 = null;
try {
nv1 = sc.expression.eval(bind1, env);
} catch (VariableNotBoundException ex) {
} catch (ExprEvalException ex) {
Log.warn(this, ex.getMessage());
}
try {
nv2 = sc.expression.eval(bind2, env);
} catch (VariableNotBoundException ex) {
} catch (ExprEvalException ex) {
Log.warn(this, ex.getMessage());
}
Node n1 = NodeValue.toNode(nv1);
Node n2 = NodeValue.toNode(nv2);
int x = compareNodes(nv1, nv2, sc.direction);
if (x != Expr.CMP_EQUAL) {
return x;
}
}
// Same by the SortConditions - now do any extra tests to make sure they are unique.
return compareBindingsSyntactic(bind1, bind2);
//return 0 ;
}
Aggregations