@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, IQTree child) { return iqFactory.createUnaryIQTree(this, child.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution)); }
@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, IQTree child) { return iqFactory.createUnaryIQTree(this, child.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution)); }
private ImmutableList<IQTree> updateJoinChildren(ImmutableList<InjectiveVar2VarSubstitution> substitutions, ImmutableList<IQTree> children) { Iterator<IQTree> it = children.iterator(); return substitutions.stream().sequential() .map(s -> it.next().applyDescendingSubstitutionWithoutOptimizing(s)) .collect(ImmutableCollectors.toList()); }
@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, ImmutableList<IQTree> children) { InnerJoinNode newJoinNode = getOptionalFilterCondition() .map(descendingSubstitution::applyToBooleanExpression) .map(iqFactory::createInnerJoinNode) .orElseGet(iqFactory::createInnerJoinNode); ImmutableList<IQTree> newChildren = children.stream() .map(c -> c.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution)) .collect(ImmutableCollectors.toList()); return iqFactory.createNaryIQTree(newJoinNode, newChildren); }
@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, IQTree leftChild, IQTree rightChild) { if (containsEqualityRightSpecificVariable(descendingSubstitution, leftChild, rightChild)) return transformIntoInnerJoinTree(leftChild, rightChild) .applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution); IQTree newLeftChild = leftChild.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution); IQTree newRightChild = rightChild.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution); LeftJoinNode newLJNode = getOptionalFilterCondition() .map(descendingSubstitution::applyToBooleanExpression) .map(iqFactory::createLeftJoinNode) .orElse(this); return iqFactory.createBinaryNonCommutativeIQTree(newLJNode, newLeftChild, newRightChild); }
@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, IQTree child) { OrderByNode newOrderByTree = applySubstitution(descendingSubstitution); IQTree newChild = child.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution); return iqFactory.createUnaryIQTree(newOrderByTree, newChild); }
@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, ImmutableList<IQTree> children) { ImmutableSet<Variable> updatedProjectedVariables = constructionTools.computeNewProjectedVariables( descendingSubstitution, projectedVariables); ImmutableList<IQTree> updatedChildren = children.stream() .map(c -> c.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution)) .collect(ImmutableCollectors.toList()); UnionNode newRootNode = iqFactory.createUnionNode(updatedProjectedVariables); return iqFactory.createNaryIQTree(newRootNode, updatedChildren); }
@Override public IQTree applyDescendingSubstitutionWithoutOptimizing( ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution, IQTree child) { FilterNode newFilterNode = iqFactory.createFilterNode( descendingSubstitution.applyToBooleanExpression(getFilterCondition())); return iqFactory.createUnaryIQTree(newFilterNode, child.applyDescendingSubstitutionWithoutOptimizing(descendingSubstitution)); }