Java Code Examples for org.eclipse.rdf4j.query.algebra.LeftJoin#getLeftArg()

The following examples show how to use org.eclipse.rdf4j.query.algebra.LeftJoin#getLeftArg() . 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(LeftJoin leftJoin) {
	super.meet(leftJoin);
	TupleExpr leftArg = leftJoin.getLeftArg();
	TupleExpr rightArg = leftJoin.getRightArg();
	ValueExpr condition = leftJoin.getCondition();
	if (leftArg instanceof EmptySet) {
		leftJoin.replaceWith(leftArg);
	} else if (rightArg instanceof EmptySet) {
		leftJoin.replaceWith(leftArg);
	} else if (rightArg instanceof SingletonSet) {
		leftJoin.replaceWith(leftArg);
	} else if (condition instanceof ValueConstant) {
		boolean conditionValue;
		try {
			conditionValue = QueryEvaluationUtil
					.getEffectiveBooleanValue(((ValueConstant) condition).getValue());
		} catch (ValueExprEvaluationException e) {
			conditionValue = false;
		}
		if (conditionValue) {
			leftJoin.setCondition(null);
		} else {
			// Constraint is always false
			leftJoin.replaceWith(leftArg);
		}
	}
}
 
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(LeftJoin leftJoin) {
	super.meet(leftJoin);

	TupleExpr leftArg = leftJoin.getLeftArg();
	TupleExpr rightArg = leftJoin.getRightArg();
	ValueExpr condition = leftJoin.getCondition();

	if (leftArg instanceof EmptySet) {
		leftJoin.replaceWith(leftArg);
	} else if (rightArg instanceof EmptySet) {
		leftJoin.replaceWith(leftArg);
	} else if (rightArg instanceof SingletonSet) {
		leftJoin.replaceWith(leftArg);
	} else if (condition instanceof ValueConstant) {
		boolean conditionValue;
		try {
			conditionValue = QueryEvaluationUtil
					.getEffectiveBooleanValue(((ValueConstant) condition).getValue());
		} catch (ValueExprEvaluationException e) {
			conditionValue = false;
		}

		if (conditionValue == false) {
			// Constraint is always false
			leftJoin.replaceWith(leftArg);
		} else {
			leftJoin.setCondition(null);
		}
	}
}
 
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(LeftJoin leftJoin) {
	super.meet(leftJoin);

	TupleExpr leftArg = leftJoin.getLeftArg();
	TupleExpr rightArg = leftJoin.getRightArg();
	ValueExpr condition = leftJoin.getCondition();

	if (leftArg instanceof EmptySet) {
		leftJoin.replaceWith(leftArg);
	} else if (rightArg instanceof EmptySet) {
		leftJoin.replaceWith(leftArg);
	} else if (rightArg instanceof SingletonSet) {
		leftJoin.replaceWith(leftArg);
	} else if (condition instanceof ValueConstant) {
		boolean conditionValue;
		try {
			conditionValue = QueryEvaluationUtil.getEffectiveBooleanValue(((ValueConstant) condition).getValue());
		} catch (ValueExprEvaluationException e) {
			conditionValue = false;
		}

		if (conditionValue == false) {
			// Constraint is always false
			leftJoin.replaceWith(leftArg);
		} else {
			leftJoin.setCondition(null);
		}
	}
}
 
Example 4
Source File: SparqlFluoQueryBuilder.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public void meet(final LeftJoin node) {
    // Extract the metadata that will be stored for the node.
    final String leftJoinNodeId = nodeIds.getOrMakeId(node);
    final QueryModelNode left = node.getLeftArg();
    final QueryModelNode right = node.getRightArg();

    // Update the metadata for the JoinMetadata.Builder.
    makeJoinMetadata(leftJoinNodeId, JoinType.LEFT_OUTER_JOIN, left, right);

    // Walk to the next node.
    super.meet(node);
}
 
Example 5
Source File: FedXLeftJoin.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FedXLeftJoin(LeftJoin leftJoin, QueryInfo queryInfo) {
	super(leftJoin.getLeftArg(), leftJoin.getRightArg(), leftJoin.getCondition());
	this.queryInfo = queryInfo;
}
 
Example 6
Source File: HashJoinIteration.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public HashJoinIteration(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings)
		throws QueryEvaluationException {
	this(strategy, join.getLeftArg(), join.getRightArg(), bindings, true);
	join.setAlgorithm(this);
}