Java Code Examples for org.eclipse.rdf4j.query.algebra.LeftJoin#getRightArg()
The following examples show how to use
org.eclipse.rdf4j.query.algebra.LeftJoin#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: FilterFunctionOptimizer.java From rya with Apache License 2.0 | 6 votes |
private void buildQuery(final TupleExpr tupleExpr, final StatementPattern matchStatement) { //If our IndexerExpr (to be) is the rhs-child of LeftJoin, we can safely make that a Join: // the IndexerExpr will (currently) not return results that can deliver unbound variables. //This optimization should probably be generalized into a LeftJoin -> Join optimizer under certain conditions. Until that // has been done, this code path at least takes care of queries generated by OpenSahara SparqTool that filter on OPTIONAL // projections. E.g. summary~'full text search' (summary is optional). See #379 if (matchStatement.getParentNode() instanceof LeftJoin) { final LeftJoin leftJoin = (LeftJoin)matchStatement.getParentNode(); if (leftJoin.getRightArg() == matchStatement && leftJoin.getCondition() == null) { matchStatement.getParentNode().replaceWith(new Join(leftJoin.getLeftArg(), leftJoin.getRightArg())); } } final FilterFunction fVisitor = new FilterFunction(matchStatement.getObjectVar().getName()); tupleExpr.visit(fVisitor); final List<IndexingExpr> results = Lists.newArrayList(); for(int i = 0; i < fVisitor.func.size(); i++){ results.add(new IndexingExpr(fVisitor.func.get(i), matchStatement, Arrays.stream(fVisitor.args.get(i)).toArray())); } removeMatchedPattern(tupleExpr, matchStatement, new IndexerExprReplacer(results)); }
Example 2
Source File: GeoEnabledFilterFunctionOptimizer.java From rya with Apache License 2.0 | 6 votes |
private void buildQuery(final TupleExpr tupleExpr, final StatementPattern matchStatement) { //If our IndexerExpr (to be) is the rhs-child of LeftJoin, we can safely make that a Join: // the IndexerExpr will (currently) not return results that can deliver unbound variables. //This optimization should probably be generalized into a LeftJoin -> Join optimizer under certain conditions. Until that // has been done, this code path at least takes care of queries generated by OpenSahara SparqTool that filter on OPTIONAL // projections. E.g. summary~'full text search' (summary is optional). See #379 if (matchStatement.getParentNode() instanceof LeftJoin) { final LeftJoin leftJoin = (LeftJoin)matchStatement.getParentNode(); if (leftJoin.getRightArg() == matchStatement && leftJoin.getCondition() == null) { matchStatement.getParentNode().replaceWith(new Join(leftJoin.getLeftArg(), leftJoin.getRightArg())); } } final FilterFunction fVisitor = new FilterFunction(matchStatement.getObjectVar().getName()); tupleExpr.visit(fVisitor); final List<IndexingExpr> results = Lists.newArrayList(); for(int i = 0; i < fVisitor.func.size(); i++){ results.add(new IndexingExpr(fVisitor.func.get(i), matchStatement, fVisitor.args.get(i))); } removeMatchedPattern(tupleExpr, matchStatement, new IndexerExprReplacer(results)); }
Example 3
Source File: ControlledWorkerLeftJoin.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
public ControlledWorkerLeftJoin(ControlledWorkerScheduler<BindingSet> scheduler, FederationEvalStrategy strategy, CloseableIteration<BindingSet, QueryEvaluationException> leftIter, LeftJoin join, BindingSet bindings, QueryInfo queryInfo) throws QueryEvaluationException { super(strategy, leftIter, join.getRightArg(), bindings, queryInfo); this.scheduler = scheduler; this.join = join; }
Example 4
Source File: QueryModelPruner.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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 5
Source File: QueryModelPruner.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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 6
Source File: QueryModelNormalizer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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 7
Source File: SparqlFluoQueryBuilder.java From rya with Apache License 2.0 | 5 votes |
@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 8
Source File: FlattenedOptional.java From rya with Apache License 2.0 | 5 votes |
public FlattenedOptional(LeftJoin node) { rightArgs = getJoinArgs(node.getRightArg(), new HashSet<TupleExpr>()); boundVars = setWithOutConstants( Sets.intersection(node.getLeftArg().getAssuredBindingNames(), node.getRightArg().getBindingNames())); unboundVars = setWithOutConstants(Sets.difference(node.getRightArg().getBindingNames(), boundVars)); condition = node.getCondition(); rightArg = node.getRightArg(); getVarCounts(node); assuredBindingNames = new HashSet<>(leftArgVarCounts.keySet()); bindingNames = new HashSet<>(Sets.union(assuredBindingNames, unboundVars)); }
Example 9
Source File: FedXLeftJoin.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 4 votes |
public FedXLeftJoin(LeftJoin leftJoin, QueryInfo queryInfo) { super(leftJoin.getLeftArg(), leftJoin.getRightArg(), leftJoin.getCondition()); this.queryInfo = queryInfo; }
Example 10
Source File: HashJoinIteration.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 4 votes |
public HashJoinIteration(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings) throws QueryEvaluationException { this(strategy, join.getLeftArg(), join.getRightArg(), bindings, true); join.setAlgorithm(this); }