Java Code Examples for org.eclipse.rdf4j.query.algebra.Compare.CompareOp#EQ

The following examples show how to use org.eclipse.rdf4j.query.algebra.Compare.CompareOp#EQ . 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: SpinParser.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private CompareOp toCompareOp(IRI func) {
	if (SP.EQ.equals(func)) {
		return CompareOp.EQ;
	} else if (SP.NE.equals(func)) {
		return CompareOp.NE;
	} else if (SP.LT.equals(func)) {
		return CompareOp.LT;
	} else if (SP.LE.equals(func)) {
		return CompareOp.LE;
	} else if (SP.GE.equals(func)) {
		return CompareOp.GE;
	} else if (SP.GT.equals(func)) {
		return CompareOp.GT;
	} else {
		return null;
	}
}
 
Example 2
Source File: CompareOptimizer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void meet(Compare compare) {
	super.meet(compare);

	if (compare.getOperator() == CompareOp.EQ) {
		ValueExpr leftArg = compare.getLeftArg();
		ValueExpr rightArg = compare.getRightArg();

		boolean leftIsVar = isVar(leftArg);
		boolean rightIsVar = isVar(rightArg);
		boolean leftIsResource = isResource(leftArg);
		boolean rightIsResource = isResource(rightArg);

		if (leftIsVar && rightIsResource || leftIsResource && rightIsVar || leftIsResource && rightIsResource) {
			SameTerm sameTerm = new SameTerm(leftArg, rightArg);
			compare.replaceWith(sameTerm);
		}
	}
}
 
Example 3
Source File: QueryBlockBuilder.java    From semagrow with Apache License 2.0 5 votes vote down vote up
private CompareOp negateOp(CompareOp op) {
    switch (op) {
        case EQ : return CompareOp.NE;
        case NE : return CompareOp.EQ;
        case LE : return CompareOp.GT;
        case GE : return CompareOp.LT;
        case GT : return CompareOp.LE;
        case LT : return CompareOp.GE;
        default : throw new RuntimeException();
    }
}
 
Example 4
Source File: FilterExpr.java    From CostFed with GNU Affero General Public License v3.0 4 votes vote down vote up
public boolean isCompareEq() {
	return expr instanceof Compare && ((Compare)expr).getOperator()==CompareOp.EQ;
}
 
Example 5
Source File: FilterExpr.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public boolean isCompareEq() {
	return expr instanceof Compare && ((Compare) expr).getOperator() == CompareOp.EQ;
}