public Projection(TupleExpr arg, ProjectionElemList elements) { this(arg); setProjectionElemList(elements); }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (projElemList == current) { setProjectionElemList((ProjectionElemList)replacement); } else { super.replaceChildNode(current, replacement); } }
@Override public void meet(Projection node) { if (predicate.equals(SeRQO.ELEMENT)) { node.setProjectionElemList((ProjectionElemList) model.get(object)); } else { super.meet(node); } }
@Override public Projection clone() { Projection clone = (Projection)super.clone(); clone.setProjectionElemList(getProjectionElemList().clone()); return clone; }
private UnaryTupleOperator projection() { if (!mProjectionPatterns.isEmpty()) { return multiProjection(); } else { Extension aExt = null; ProjectionElemList aList = new ProjectionElemList(); for (String aVar : mProjectionVars) { aList.addElement(new ProjectionElem(aVar)); } Projection aProjection = new Projection(); aProjection.setProjectionElemList(aList); if (aExt != null) { aProjection.setArg(aExt); } return aProjection; } }
private UnaryTupleOperator visitTemplates(Resource templates) throws OpenRDFException { List<ProjectionElemList> projElemLists = new ArrayList<ProjectionElemList>(); Iteration<? extends Resource, QueryEvaluationException> iter = Statements.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; SingletonSet stub = new SingletonSet(); expr.setArg(stub); tupleNode = stub; return expr; }
private Projection visitResultVariables(Resource resultVars) throws OpenRDFException { ProjectionElemList projElemList = new ProjectionElemList(); Iteration<? extends Resource, QueryEvaluationException> iter = Statements.listResources(resultVars, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElem projElem = visitResultVariable(r); projElemList.addElement(projElem); } Projection proj = new Projection(); proj.setProjectionElemList(projElemList); tupleRoot = proj; SingletonSet stub = new SingletonSet(); proj.setArg(stub); tupleNode = stub; return proj; }
private Projection visitResultNodes(Resource resultNodes) throws OpenRDFException { ProjectionElemList projElemList = new ProjectionElemList(); Iteration<? extends Resource, QueryEvaluationException> iter = Statements.listResources(resultNodes, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElem projElem = visitResultNode(r); projElemList.addElement(projElem); } Projection proj = new Projection(); proj.setProjectionElemList(projElemList); tupleRoot = new DescribeOperator(proj); SingletonSet stub = new SingletonSet(); proj.setArg(stub); tupleNode = stub; return proj; }