@Override protected void meetNode(QueryModelNode node) throws RepositoryException { super.meetNode(node); if (owner != null && patternNode != null && !(patternNode instanceof StatementPattern)) { StringBuilder builder = new StringBuilder(); builder.append("SELECT"); if (distinct) { builder.append(" DISTINCT"); } else if (reduced || reduce) { builder.append(" REDUCED"); } boolean mapping = false; Map<String, String> bindings = new HashMap<String, String>(); ProjectionElemList list = new ProjectionElemList(); for (String name : patternNode.getBindingNames()) { mapping = addBindingNames(builder, mapping, bindings, list, name); } builder.append("\nWHERE {\n").append(pattern).append("}"); meetNodeLocal(builder, mapping, bindings, list); } reduced = false; distinct = false; pattern = null; // NOPMD patternNode = null; // NOPMD }
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; } }
ProjectionElemList list = new ProjectionElemList(); for (String name : patternNode.getBindingNames()) { if (variables.containsKey(name)) {
private ParsedGraphQuery createGraphQuery(AugurStatementNode node) { TupleExpr tupleExpr = node.getTupleExpr(); String subjName = node.getSubjectName(); String predName = node.getPredicateName(); String objName = node.getObjectName(); String ctxName = node.getContextName(); ProjectionElem projSubj = new ProjectionElem(subjName, "subject"); ProjectionElem projPred = new ProjectionElem(predName, "predicate"); ProjectionElem projObj = new ProjectionElem(objName, "object"); ProjectionElem projCtx = new ProjectionElem(ctxName, "context"); ProjectionElemList projElemList = new ProjectionElemList(projSubj, projPred, projObj, projCtx); Projection proj = new Projection(tupleExpr, projElemList); ParsedGraphQuery query = new ParsedGraphQuery(proj); if (logger.isDebugEnabled()) { logger.debug(proj.toString()); } return query; }
@Override public TupleExpr visit(ASTDescribe node, Object data) throws VisitorException { TupleExpr tupleExpr = (TupleExpr)data; if (tupleExpr == null) { tupleExpr = new SingletonSet(); } Extension e = new Extension(); ProjectionElemList projectionElements = new ProjectionElemList(); for (int i = 0; i < node.jjtGetNumChildren(); i++) { ValueExpr resource = (ValueExpr)node.jjtGetChild(i).jjtAccept(this, null); if (resource instanceof Var) { projectionElements.addElement(new ProjectionElem(((Var)resource).getName())); } else { String alias = "_describe_" + UUID.randomUUID().toString().replaceAll("-", "_"); ExtensionElem elem = new ExtensionElem(resource, alias); e.addElement(elem); projectionElements.addElement(new ProjectionElem(alias)); } } if (!e.getElements().isEmpty()) { e.setArg(tupleExpr); tupleExpr = e; } Projection p = new Projection(tupleExpr, projectionElements); return new DescribeOperator(p); }
private ProjectionElemList visitTemplate(Resource r) throws OpenRDFException { ProjectionElemList projElems = new ProjectionElemList(); Value subj = Statements.singleValue(r, SP.SUBJECT_PROPERTY, store); projElems.addElement(createProjectionElem(subj, "subject")); Value pred = Statements.singleValue(r, SP.PREDICATE_PROPERTY, store); projElems.addElement(createProjectionElem(pred, "predicate")); Value obj = Statements.singleValue(r, SP.OBJECT_PROPERTY, store); projElems.addElement(createProjectionElem(obj, "object")); return projElems; }
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; }
ProjectionElemList projection = new ProjectionElemList(); List<ProjectionElemList> projectionElements = new ArrayList<ProjectionElemList>(); List<ExtensionElem> extensions = new ArrayList<ExtensionElem>(); ProjectionElemList p = new ProjectionElemList(); ValueExpr subject = toValue(pa.getSubject(), md); if (subject instanceof Var){
ProjectionElemList projElemList = new ProjectionElemList(); ProjectionElemList projElemList = new ProjectionElemList();
ProjectionElemList projElemList = new ProjectionElemList(); ProjectionElemList projElemList = new ProjectionElemList();
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; }
ProjectionElemList projElemList = new ProjectionElemList();
ProjectionElemList projection = new ProjectionElemList(); List<ProjectionElemList> projectionElements = new ArrayList<ProjectionElemList>(); List<ExtensionElem> extensions = new ArrayList<ExtensionElem>(); ProjectionElemList p = new ProjectionElemList(); ValueExpr subject = toValue(pa.getSubject(), md); if (subject instanceof Var) {
ProjectionElemList projection = new ProjectionElemList(); List<ProjectionElemList> projectionElements = new ArrayList<ProjectionElemList>(); List<ExtensionElem> extensions = new ArrayList<ExtensionElem>(); ProjectionElemList p = new ProjectionElemList(); ValueExpr subject = toValue(pa.getSubject(), md); if (subject instanceof Var) {
ProjectionElemList projElemList = new ProjectionElemList();
ProjectionElemList pelist = new ProjectionElemList(); for (String name : union.getAssuredBindingNames()) { ProjectionElem pe = new ProjectionElem(name);
ProjectionElemList projElemList = new ProjectionElemList();
ProjectionElemList aList = new ProjectionElemList();