Java Code Examples for org.eclipse.rdf4j.query.algebra.Difference#replaceWith()

The following examples show how to use org.eclipse.rdf4j.query.algebra.Difference#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: QueryModelPruner.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(Difference difference) {
	super.meet(difference);
	TupleExpr leftArg = difference.getLeftArg();
	TupleExpr rightArg = difference.getRightArg();
	if (leftArg instanceof EmptySet) {
		difference.replaceWith(leftArg);
	} else if (rightArg instanceof EmptySet) {
		difference.replaceWith(leftArg);
	} else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) {
		difference.replaceWith(new EmptySet());
	}
}
 
Example 2
Source File: QueryModelPruner.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(Difference difference) {
	super.meet(difference);

	TupleExpr leftArg = difference.getLeftArg();
	TupleExpr rightArg = difference.getRightArg();

	if (leftArg instanceof EmptySet) {
		difference.replaceWith(leftArg);
	} else if (rightArg instanceof EmptySet) {
		difference.replaceWith(leftArg);
	} else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) {
		difference.replaceWith(new EmptySet());
	}
}
 
Example 3
Source File: QueryModelNormalizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(Difference difference) {
	super.meet(difference);

	TupleExpr leftArg = difference.getLeftArg();
	TupleExpr rightArg = difference.getRightArg();

	if (leftArg instanceof EmptySet) {
		difference.replaceWith(leftArg);
	} else if (rightArg instanceof EmptySet) {
		difference.replaceWith(leftArg);
	} else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) {
		difference.replaceWith(new EmptySet());
	}
}