@Override public void meet(MultiProjection projection) { List<ExtensionElem> bindings; if (projection.getArg() instanceof Extension) { bindings = ((Extension) projection.getArg()).getElements(); } else { bindings = Arrays.asList(); } for (ProjectionElemList template : projection.getProjections()) { recordConsequent(template, bindings); } }
@Override public MultiProjection clone() { MultiProjection clone = (MultiProjection)super.clone(); clone.projections = new ArrayList<ProjectionElemList>(getProjections().size()); for (ProjectionElemList pe : getProjections()) { clone.addProjection(pe.clone()); } return clone; } }
public MultiProjection(TupleExpr arg, Iterable<ProjectionElemList> projections) { this(arg); addProjections(projections); }
@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); } } }
public MultiProjectionIterator(MultiProjection multiProjection, CloseableIteration<BindingSet, QueryEvaluationException> iter, BindingSet bindings) { this.projections = multiProjection.getProjections(); this.iter = iter; this.parentBindings = bindings; this.previousBindings = new BindingSet[projections.size()]; // initialize out-of-range to enforce a fetch of the first result upon // first use nextProjectionIdx = -1; }
@Override public Set<String> getAssuredBindingNames() { Set<String> bindingNames = new HashSet<>(); 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; }
private UnaryTupleOperator multiProjection() { MultiProjection aProjection = new MultiProjection(); aProjection.addProjection(aList); aProjection.setArg(aExt);
result = new MultiProjection(result, projList);
private UnaryTupleOperator visitTemplates(Resource templates) throws RDF4JException { List<ProjectionElemList> projElemLists = new ArrayList<ProjectionElemList>(); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources(templates, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElemList projElems = visitTemplate(r); projElemLists.add(projElems); } UnaryTupleOperator expr; if (projElemLists.size() > 1) { MultiProjection proj = new MultiProjection(); proj.setProjections(projElemLists); expr = proj; } else { Projection proj = new Projection(); proj.setProjectionElemList(projElemLists.get(0)); expr = proj; } Reduced reduced = new Reduced(); reduced.setArg(expr); tupleRoot = reduced; return expr; }
public void addProjections(Iterable<ProjectionElemList> projections) { for (ProjectionElemList projection : projections) { addProjection(projection); } }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (replaceNodeInList(projections, current, replacement)) { return; } super.replaceChildNode(current, replacement); }
public MultiProjectionIterator(MultiProjection multiProjection, CloseableIteration<BindingSet, QueryEvaluationException> iter, BindingSet bindings) { this.projections = multiProjection.getProjections(); this.iter = iter; this.parentBindings = bindings; this.previousBindings = new BindingSet[projections.size()]; // initialize out-of-range to enforce a fetch of the first result upon // first use nextProjectionIdx = -1; }
@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; }
private UnaryTupleOperator multiProjection() { MultiProjection aProjection = new MultiProjection(); aProjection.addProjection(aList); aProjection.setArg(aExt);
result = new MultiProjection(result, projList);
public void addProjections(Iterable<ProjectionElemList> projections) { for (ProjectionElemList projection : projections) { addProjection(projection); } }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (replaceNodeInList(projections, current, replacement)) { return; } super.replaceChildNode(current, replacement); }
final List<ProjectionElemList> projections = multiProjection.getProjections(); final BindingSet prev[] = new BindingSet[projections.size()]; evaluateTupleExpr(new BindingSetPipe(parent) { }, multiProjection.getArg(), bindings);
@Override public boolean equals(Object other) { if (other instanceof MultiProjection && super.equals(other)) { MultiProjection o = (MultiProjection)other; return projections.equals(o.getProjections()); } return false; }
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; }