constant = (ConstantEx) e1;
}
logger.debug("isEqual(" + variable + ", " + constant + ")");
NodeMaker nm = variable.getNodeMaker();
if (nm instanceof TypedNodeMaker) {
ValueMaker vm = ((TypedNodeMaker) nm).valueMaker();
Node node = constant.getNode();
logger.debug("checking " + node + " with " + nm);
boolean empty = nm.selectNode(node, RelationalOperators.DUMMY).equals(NodeMaker.EMPTY);
logger.debug("result " + new Boolean(empty));
if (!empty) {
if (node.isURI())
expression.push(vm.valueExpression(node.getURI()));
else if (node.isLiteral())
expression.push(vm.valueExpression(constant.value()));
else
conversionFailed(expr); // TODO blank nodes?
return;
} else {
expression.push(Expression.FALSE);
return;
}
} else {
logger.warn("nm is not a TypedNodemaker");
}
} else if (e1 instanceof ConstantEx && e2 instanceof ConstantEx) {
logger.debug("isEqual(" + e1 + ", " + e2 + ")");
ConstantEx constant1 = (ConstantEx) e1;
ConstantEx constant2 = (ConstantEx) e2;
boolean equals = NodeFunctions.sameTerm(constant1.getNode(), constant2.getNode());
logger.debug("constants same? " + new Boolean(equals));
expression.push(equals ? Expression.TRUE : Expression.FALSE);
return;
} else if (e1 instanceof AttributeExprEx && e2 instanceof AttributeExprEx) {
logger.debug("isEqual(" + e1 + ", " + e2 + ")");
AttributeExprEx variable1 = (AttributeExprEx) e1;
AttributeExprEx variable2 = (AttributeExprEx) e2;
NodeMaker nm1 = variable1.getNodeMaker();
NodeMaker nm2 = variable2.getNodeMaker();
NodeSetConstraintBuilder nodeSet = new NodeSetConstraintBuilder();
nm1.describeSelf(nodeSet);
nm2.describeSelf(nodeSet);
if (nodeSet.isEmpty()) {
logger.debug("nodes " + nm1 + " " + nm2 + " incompatible");
expression.push(Expression.FALSE);
return;