public Set<String> getBindingNames() { Set<String> bindingNames = new LinkedHashSet<String>(16); bindingNames.addAll(getLeftArg().getBindingNames()); bindingNames.addAll(getRightArg().getBindingNames()); return bindingNames; }
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)); }
@Override public Set<String> getBindingNames() { Set<String> bindingNames = new LinkedHashSet<>(16); bindingNames.addAll(getLeftArg().getBindingNames()); bindingNames.addAll(getRightArg().getBindingNames()); return bindingNames; }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { binaryOpMeet(theJoin, theJoin.getLeftArg(), theJoin.getRightArg()); }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { binaryOpMeet(theJoin, theJoin.getLeftArg(), theJoin.getRightArg()); }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { binaryOpMeet(theJoin, theJoin.getLeftArg(), theJoin.getRightArg()); }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { theJoin.getLeftArg().visit(this); mJoinBuffer.append(" ["); theJoin.getRightArg().visit(this); if (theJoin.getCondition() != null) { mJoinBuffer.append(renderValueExpr(theJoin.getCondition())); } mJoinBuffer.setCharAt(mJoinBuffer.lastIndexOf(","), ' '); mJoinBuffer.append("], "); }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { theJoin.getLeftArg().visit(this); mJoinBuffer.append(" ["); theJoin.getRightArg().visit(this); if (theJoin.getCondition() != null) { mJoinBuffer.append(renderValueExpr(theJoin.getCondition())); } mJoinBuffer.setCharAt(mJoinBuffer.lastIndexOf(","), ' '); mJoinBuffer.append("], "); }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { theJoin.getLeftArg().visit(this); mJoinBuffer.append(" ["); theJoin.getRightArg().visit(this); if (theJoin.getCondition() != null) { mJoinBuffer.append(renderValueExpr(theJoin.getCondition())); } mJoinBuffer.setCharAt(mJoinBuffer.lastIndexOf(","), ' '); mJoinBuffer.append("], "); }
@Override public void meet(LeftJoin node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality *= leftArgCost; }
@Override public void meet(LeftJoin node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality *= leftArgCost; }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
@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); }
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)); }
public HashJoinIteration(EvaluationStrategy strategy, TupleExpr left, TupleExpr right, BindingSet bindings, boolean leftJoin) throws QueryEvaluationException { this(strategy, strategy.evaluate(left, bindings), left.getBindingNames(), strategy.evaluate(right, bindings), right.getBindingNames(), leftJoin); }
public HashJoinIteration(EvaluationStrategy strategy, TupleExpr left, TupleExpr right, BindingSet bindings, boolean leftJoin) throws QueryEvaluationException { this(strategy, strategy.evaluate(left, bindings), left.getBindingNames(), strategy.evaluate(right, bindings), right.getBindingNames(), leftJoin); }
@Override public void meet(LeftJoin node) throws RDFHandlerException { node.getLeftArg().visit(this); listEntry(); handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.OPTIONAL_CLASS)); Resource elementsList = valueFactory.createBNode(); handler.handleStatement( valueFactory.createStatement(subject, SP.ELEMENTS_PROPERTY, elementsList)); ListContext elementsCtx = newList(elementsList); node.getRightArg().visit(this); endList(elementsCtx); }