Package org.openrdf.query.parser.serql.ast

Examples of org.openrdf.query.parser.serql.ast.Node


    // Iterate over all projection elements to retrieve the defined aliases
    Set<String> aliases = new HashSet<String>();
    List<Node> unaliasedNodes = new ArrayList<Node>();

    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      Node projElem = node.jjtGetChild(i);

      assert projElem instanceof ASTProjectionElem : "child node is not a projection element";

      Object result = projElem.jjtAccept(this, aliases);

      if (result instanceof String) {
        String alias = (String)result;

        boolean isUnique = aliases.add(alias);

        if (!isUnique) {
          throw new VisitorException("Duplicate projection element aliases: '" + alias + "'");
        }
      }
      else {
        unaliasedNodes.add(projElem);
      }
    }

    // Iterate over the unaliased nodes and generate aliases for them
    int aliasNo = 1;
    for (Node projElem : unaliasedNodes) {
      Node exprNode = projElem.jjtGetChild(0);

      if (exprNode instanceof ASTVar) {
        String varName = ((ASTVar)exprNode).getName();
       
        if (!aliases.contains(varName)) {
View Full Code Here

TOP

Related Classes of org.openrdf.query.parser.serql.ast.Node

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.