Java Code Examples for org.eclipse.rdf4j.query.algebra.Union#getRightArg()

The following examples show how to use org.eclipse.rdf4j.query.algebra.Union#getRightArg() . 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: IterativeEvaluationOptimizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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 2
Source File: UnionOptimizer.java    From CostFed with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Add the union arguments to the args list, includes a recursion 
 * step for nested unions.
 * 
 * @param union
 * @param args
 */
protected void handleUnionArgs(Union union, List<TupleExpr> args) {
	
	if (union.getLeftArg() instanceof Union) {
		handleUnionArgs((Union)union.getLeftArg(), args);
	} else {
		args.add(union.getLeftArg());
	}
	
	if (union.getRightArg() instanceof Union) {
		handleUnionArgs((Union)union.getRightArg(), args);
	} else {
		args.add(union.getRightArg());
	}
}
 
Example 3
Source File: UnionOptimizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Add the union arguments to the args list, includes a recursion step for nested unions.
 *
 * @param union
 * @param args
 */
protected void handleUnionArgs(Union union, List<TupleExpr> args) {

	if (union.getLeftArg() instanceof Union) {
		handleUnionArgs((Union) union.getLeftArg(), args);
	} else {
		args.add(union.getLeftArg());
	}

	if (union.getRightArg() instanceof Union) {
		handleUnionArgs((Union) union.getRightArg(), args);
	} else {
		args.add(union.getRightArg());
	}
}
 
Example 4
Source File: QueryModelPruner.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 vote down vote up
@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 vote down vote up
@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);
	}
}