Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.Extension


        }
      }
    }

    if (!extElemMap.isEmpty()) {
      result = new Extension(result, extElemMap.values());
    }

    // Create a Projection for each StatementPattern in the constructor
    List<ProjectionElemList> projections = new ArrayList<ProjectionElemList>();
View Full Code Here


  public TupleExpr visit(ASTSelect node, Object data)
    throws VisitorException
  {
    TupleExpr result = (TupleExpr)data;

    Extension extension = new Extension();
    ProjectionElemList projElemList = new ProjectionElemList();

    for (ASTProjectionElem projElemNode : node.getProjectionElemList()) {
      ValueExpr valueExpr = (ValueExpr)projElemNode.getValueExpr().jjtAccept(this, null);

      String alias = projElemNode.getAlias();
      if (alias != null) {
        // aliased projection element
        extension.addElement(new ExtensionElem(valueExpr, alias));
        projElemList.addElement(new ProjectionElem(alias));
      }
      else if (valueExpr instanceof Var) {
        // unaliased variable
        Var projVar = (Var)valueExpr;
        projElemList.addElement(new ProjectionElem(projVar.getName()));
      }
      else {
        throw new IllegalStateException("required alias for non-Var projection elements not found");
      }
    }

    if (!extension.getElements().isEmpty()) {
      extension.setArg(result);
      result = extension;
    }

    result = new Projection(result, projElemList);
View Full Code Here

      filter.getArg().visit(new VarRenamer(oldVar.getName(), newVar.getName()));

      // TODO: skip this step if old variable name is not used
      // Replace SameTerm-filter with an Extension, the old variable name
      // might still be relevant to nodes higher in the tree
      Extension extension = new Extension(filter.getArg());
      extension.addElement(new ExtensionElem(new Var(newVar.getName()), oldVar.getName()));
      filter.replaceWith(extension);
    }
View Full Code Here

        extElemMap.put(var, new ExtensionElem(valueExpr, var.getName()));
      }
    }

    if (!extElemMap.isEmpty()) {
      result = new Extension(result, extElemMap.values());
    }

    // Create a Projection for each StatementPattern in the constructor
    List<ProjectionElemList> projList = new ArrayList<ProjectionElemList>();
View Full Code Here

        }
      }
    }

    if (!extElemMap.isEmpty()) {
      result = new Extension(result, extElemMap.values());
    }

    // Create a Projection for each StatementPattern in the constructor
    List<ProjectionElemList> projections = new ArrayList<ProjectionElemList>();
View Full Code Here

  public TupleExpr visit(ASTSelect node, Object data)
    throws VisitorException
  {
    TupleExpr result = (TupleExpr)data;

    Extension extension = new Extension();
    ProjectionElemList projElemList = new ProjectionElemList();

    for (ASTProjectionElem projElemNode : node.getProjectionElemList()) {
      ValueExpr valueExpr = (ValueExpr)projElemNode.getValueExpr().jjtAccept(this, null);

      String alias = projElemNode.getAlias();
      if (alias != null) {
        // aliased projection element
        extension.addElement(new ExtensionElem(valueExpr, alias));
        projElemList.addElement(new ProjectionElem(alias));
      }
      else if (valueExpr instanceof Var) {
        // unaliased variable
        Var projVar = (Var)valueExpr;
        projElemList.addElement(new ProjectionElem(projVar.getName()));
      }
      else {
        throw new IllegalStateException("required alias for non-Var projection elements not found");
      }
    }

    if (!extension.getElements().isEmpty()) {
      extension.setArg(result);
      result = extension;
    }

    result = new Projection(result, projElemList);
View Full Code Here

    private void renameVar(Var oldVar, Var newVar, Filter filter) {
      filter.getArg().visit(new VarRenamer(oldVar.getName(), newVar.getName()));

      // Replace SameTerm-filter with an Extension, the old variable name
      // might still be relevant to nodes higher in the tree
      Extension extension = new Extension(filter.getArg());
      extension.addElement(new ExtensionElem(new Var(newVar.getName()), oldVar.getName()));
      filter.replaceWith(extension);
    }
View Full Code Here

        extElemMap.put(var, new ExtensionElem(valueExpr, var.getName()));
      }
    }

    if (!extElemMap.isEmpty()) {
      result = new Extension(result, extElemMap.values());
    }

    // Create a Projection for each StatementPattern in the constructor
    List<ProjectionElemList> projList = new ArrayList<ProjectionElemList>();
View Full Code Here

TOP

Related Classes of org.openrdf.query.algebra.Extension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.