Java Code Examples for org.eclipse.rdf4j.query.algebra.Union#replaceWith()
The following examples show how to use
org.eclipse.rdf4j.query.algebra.Union#replaceWith() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnionOptimizer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void meet(Union union) { // retrieve the union arguments, also those of nested unions List<TupleExpr> args = new ArrayList<>(); handleUnionArgs(union, args); // remove any tuple expressions that do not produce any result List<TupleExpr> filtered = new ArrayList<>(args.size()); for (TupleExpr arg : args) { if (arg instanceof EmptyResult) { continue; } filtered.add(arg); } // create a NUnion having the arguments in one layer // however, check if we only have zero or one argument first if (filtered.isEmpty()) { union.replaceWith(new EmptyNUnion(args, queryInfo)); } else if (filtered.size() == 1) { union.replaceWith(filtered.get(0)); } else { union.replaceWith(new NUnion(filtered, queryInfo)); } }
Example 2
Source File: IterativeEvaluationOptimizer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof Join && rightArg instanceof Join) { Join leftJoinArg = (Join) leftArg; Join rightJoin = (Join) rightArg; if (leftJoinArg.getLeftArg().equals(rightJoin.getLeftArg())) { // factor out the left-most join argument Join newJoin = new Join(); union.replaceWith(newJoin); newJoin.setLeftArg(leftJoinArg.getLeftArg()); newJoin.setRightArg(union); union.setLeftArg(leftJoinArg.getRightArg()); union.setRightArg(rightJoin.getRightArg()); union.visit(this); } } }
Example 3
Source File: UnionOptimizer.java From CostFed with GNU Affero General Public License v3.0 | 5 votes |
@Override public void meet(Union union) { // retrieve the union arguments, also those of nested unions List<TupleExpr> args = new ArrayList<TupleExpr>(); handleUnionArgs(union, args); // remove any tuple expressions that do not produce any result List<TupleExpr> filtered = new ArrayList<TupleExpr>(args.size()); for (TupleExpr arg : args) { if (arg instanceof EmptyResult) continue; filtered.add(arg); } // create a NUnion having the arguments in one layer // however, check if we only have zero or one argument first if (filtered.size()==0) { union.replaceWith(new EmptyNUnion(args, queryInfo)); } else if (filtered.size()==1) { union.replaceWith(filtered.get(0)); } else { union.replaceWith( new NUnion(filtered, queryInfo) ); } }
Example 4
Source File: QueryModelPruner.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) { union.replaceWith(leftArg); } }
Example 5
Source File: QueryModelPruner.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) { union.replaceWith(leftArg); } }
Example 6
Source File: QueryModelNormalizer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } }