@Override public Set<String> getAssuredBindingNames() { Set<String> bindingNames = new HashSet<String>(); if (projections.size() >= 1) { Set<String> assuredSourceNames = getArg().getAssuredBindingNames(); bindingNames.addAll(projections.get(0).getTargetNamesFor(assuredSourceNames)); for (int i = 1; i < projections.size(); i++) { bindingNames.retainAll(projections.get(i).getTargetNamesFor(assuredSourceNames)); } } return bindingNames; }
@Override public void meet(MultiProjection node) throws QueryEvaluationException { TupleExpr arg = node.getArg(); if (arg instanceof Extension) { Extension extension = (Extension) arg; TupleExpr arg2 = extension.getArg(); if (arg2 instanceof SingletonSet) { evaluate(node); } } }
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(MultiProjection multiProjection, BindingSet bindings) throws QueryEvaluationException { CloseableIteration<BindingSet, QueryEvaluationException> result; result = this.evaluate(multiProjection.getArg(), bindings); result = new MultiProjectionIterator(multiProjection, result, bindings); return result; }
@Override public void meet(MultiProjection projectionNode) throws Exception { projectionNode.visitChildren(this); if (projectionNode.getArg() instanceof AggregationPipelineQueryNode && projectionNode.getParentNode() != null) { AggregationPipelineQueryNode pipelineNode = (AggregationPipelineQueryNode) projectionNode.getArg(); if (pipelineNode.project(projectionNode.getProjections())) { projectionNode.replaceWith(pipelineNode); } } }
/** * Make a {@link MultiProjectionEvaluator} that processes the logic of a {@link MultiProjection}. * * @param multiProjection - Defines the projections that will be processed. (not null) * @param bNodeIdFactory - Creates the IDs for Blank Nodes. (not null) * @return A {@link MultiProjectionEvaluator} for the provided {@link MultiProjection}. */ public static MultiProjectionEvaluator make(final MultiProjection multiProjection, final BNodeIdFactory bNodeIdFactory) { requireNonNull(multiProjection); // Figure out if there are extensions. final TupleExpr arg = multiProjection.getArg(); final Optional<Extension> extension = (arg instanceof Extension) ? Optional.of((Extension)arg): Optional.empty(); // If there are, iterate through them and find any blank node source names. final Set<String> blankNodeSourceNames = new HashSet<>(); if(extension.isPresent()) { for(final ExtensionElem elem : extension.get().getElements()) { if(elem.getExpr() instanceof BNodeGenerator) { blankNodeSourceNames.add( elem.getName() ); } } } // Create a ProjectionEvaluator for each projection that is part of the multi. final Set<ProjectionEvaluator> projections = new HashSet<>(); for(final ProjectionElemList projectionElemList : multiProjection.getProjections()) { projections.add( new ProjectionEvaluator(projectionElemList, extension) ); } return new MultiProjectionEvaluator(projections, blankNodeSourceNames, bNodeIdFactory); }
@Override public void meet(MultiProjection node) throws RDFHandlerException { ExtensionContext oldInlineBindings = meetExtension(node.getArg()); ListContext ctx = startTemplateList(); isMultiProjection = true; for (ProjectionElemList proj : node.getProjections()) { proj.visit(this); } endTemplateList(ctx); isMultiProjection = false; visitWhere(node.getArg()); inlineBindings = oldInlineBindings; }