@Override public int hashCode() { int result = super.hashCode() ^ "LeftJoin".hashCode(); if (hasCondition()) { result ^= getCondition().hashCode(); } return result; }
@Override public int hashCode() { int result = super.hashCode() ^ "LeftJoin".hashCode(); if (hasCondition()) { result ^= getCondition().hashCode(); } return result; }
@Override public void meet(LeftJoin node) throws RuntimeException { super.meet(node); if (node.hasCondition()) { meetNode(node.getCondition()); } } }.meetOther(root);
@Override public LeftJoin clone() { LeftJoin clone = (LeftJoin)super.clone(); if (hasCondition()) { clone.setCondition(getCondition().clone()); } return clone; } }
@Override public LeftJoin clone() { LeftJoin clone = (LeftJoin)super.clone(); if (hasCondition()) { clone.setCondition(getCondition().clone()); } return clone; } }
/** * Checks whether the left join is "well designed" as defined in section 4.2 of * "Semantics and Complexity of SPARQL", 2006, Jorge Pérez et al. */ private boolean isWellDesigned(LeftJoin leftJoin) { VarNameCollector optionalVarCollector = new VarNameCollector(); leftJoin.getRightArg().visit(optionalVarCollector); if (leftJoin.hasCondition()) { leftJoin.getCondition().visit(optionalVarCollector); } Set<String> problemVars = optionalVarCollector.getVarNames(); problemVars.removeAll(leftJoin.getLeftArg().getBindingNames()); if (problemVars.isEmpty()) { return true; } // If any of the problematic variables are bound in the parent // expression then the left join is not well designed BindingCollector bindingCollector = new BindingCollector(); QueryModelNode node = leftJoin; QueryModelNode parent; while ((parent = node.getParentNode()) != null) { bindingCollector.setNodeToIgnore(node); parent.visitChildren(bindingCollector); node = parent; } problemVars.retainAll(bindingCollector.getBindingNames()); return problemVars.isEmpty(); }
/** * Checks whether the left join is "well designed" as defined in section 4.2 of * "Semantics and Complexity of SPARQL", 2006, Jorge Pérez et al. */ private boolean isWellDesigned(LeftJoin leftJoin) { VarNameCollector optionalVarCollector = new VarNameCollector(); leftJoin.getRightArg().visit(optionalVarCollector); if (leftJoin.hasCondition()) { leftJoin.getCondition().visit(optionalVarCollector); } Set<String> problemVars = optionalVarCollector.getVarNames(); problemVars.removeAll(leftJoin.getLeftArg().getBindingNames()); if (problemVars.isEmpty()) { return true; } // If any of the problematic variables are bound in the parent // expression then the left join is not well designed BindingCollector bindingCollector = new BindingCollector(); QueryModelNode node = leftJoin; QueryModelNode parent; while ((parent = node.getParentNode()) != null) { bindingCollector.setNodeToIgnore(node); parent.visitChildren(bindingCollector); node = parent; } problemVars.retainAll(bindingCollector.getBindingNames()); return problemVars.isEmpty(); }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(LeftJoin leftJoin, final BindingSet bindings) throws QueryEvaluationException { if (TupleExprs.containsSubquery(leftJoin.getRightArg())) { return new HashJoinIteration(this, leftJoin, bindings); } // Check whether optional join is "well designed" as defined in section // 4.2 of "Semantics and Complexity of SPARQL", 2006, Jorge Pérez et al. VarNameCollector optionalVarCollector = new VarNameCollector(); leftJoin.getRightArg().visit(optionalVarCollector); if (leftJoin.hasCondition()) { leftJoin.getCondition().visit(optionalVarCollector); } Set<String> problemVars = optionalVarCollector.getVarNames(); problemVars.removeAll(leftJoin.getLeftArg().getBindingNames()); problemVars.retainAll(bindings.getBindingNames()); if (problemVars.isEmpty()) { // left join is "well designed" return new LeftJoinIterator(this, leftJoin, bindings); } else { return new BadlyDesignedLeftJoinIterator(this, leftJoin, bindings, problemVars); } }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(LeftJoin leftJoin, final BindingSet bindings) throws QueryEvaluationException { if (TupleExprs.containsSubquery(leftJoin.getRightArg())) { return new HashJoinIteration(this, leftJoin, bindings); } // Check whether optional join is "well designed" as defined in section // 4.2 of "Semantics and Complexity of SPARQL", 2006, Jorge Pérez et al. VarNameCollector optionalVarCollector = new VarNameCollector(); leftJoin.getRightArg().visit(optionalVarCollector); if (leftJoin.hasCondition()) { leftJoin.getCondition().visit(optionalVarCollector); } Set<String> problemVars = optionalVarCollector.getVarNames(); problemVars.removeAll(leftJoin.getLeftArg().getBindingNames()); problemVars.retainAll(bindings.getBindingNames()); if (problemVars.isEmpty()) { // left join is "well designed" return new LeftJoinIterator(this, leftJoin, bindings); } else { return new BadlyDesignedLeftJoinIterator(this, leftJoin, bindings, problemVars); } }
if (leftJoin.hasCondition()) { leftJoin.getCondition().visit(optionalVarCollector);