Package lupos.engine.operators.singleinput

Examples of lupos.engine.operators.singleinput.Projection


    }
  }

  private BasicOperator zeroPath(final Node node, final Item graphConstraint, final Variable subject, final Variable object, final Node subjectNode, final Node objectNode) {
    if (!getItem(subjectNode).isVariable() && !getItem(objectNode).isVariable()){
      final Projection projection = new Projection();
      projection.addProjectionElement(subject);
      projection.addProjectionElement(object);
      if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
        projection.addProjectionElement((Variable)graphConstraint);
      }
      // TODO consider graphConstraint!
      this.indexScanCreator.createEmptyIndexScanSubmittingQueryResultWithOneEmptyBindingsAndConnectWithRoot(new OperatorIDTuple(projection,0), graphConstraint);
      return projection;
    } else if (!getItem(subjectNode).isVariable()){
      final Bind firstBind = new Bind(object);
      firstBind.addProjectionElement(object, subjectNode);
      // TODO consider graphConstraint!
      this.indexScanCreator.createEmptyIndexScanSubmittingQueryResultWithOneEmptyBindingsAndConnectWithRoot(new OperatorIDTuple(firstBind,0), graphConstraint);
      return firstBind;
    } else if(!getItem(objectNode).isVariable()){
      final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
      final Item[] items = {subject, getItem(node.jjtGetChild(0)), object};
      temp.add(new TriplePattern(items));
      final Bind firstBind = new Bind(subject);
      firstBind.addProjectionElement(subject, objectNode);
      // TODO consider graphConstraint!
      this.indexScanCreator.createEmptyIndexScanSubmittingQueryResultWithOneEmptyBindingsAndConnectWithRoot(new OperatorIDTuple(firstBind,0), graphConstraint);
      return firstBind;
    } else {
      final Union union = new Union();
      final Variable intermediatePredicate = this.getVariable(subject.toString(),object.toString(),"intermediatePredicate");
      final Variable intermediateObject = this.getVariable(subject.toString(),object.toString(),"intermediateObject");
      final Item[] items = {subject, intermediatePredicate, intermediateObject};
      LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
      TriplePattern tp = new TriplePattern(items);
      temp.add(tp);
      this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,0), temp, graphConstraint);

      items[0] = intermediateObject;
      items[1] = intermediatePredicate;
      items[2] = subject;
      temp = new LinkedList<TriplePattern>();
      tp = new TriplePattern(items.clone());
      temp.add(tp);
      this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,1), temp, graphConstraint);

      final Projection projection = new Projection();
      projection.addProjectionElement(subject);
      projection.addProjectionElement(object);
      if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
        projection.addProjectionElement((Variable)graphConstraint);
      }
      final ASTVar n = new ASTVar(100);
      n.setName(subject.toString().substring(1));
      final Bind bind = new Bind(subject);
      bind.addProjectionElement(object,n);
      union.addSucceedingOperator(new OperatorIDTuple(bind,0));
      bind.addSucceedingOperator(new OperatorIDTuple(projection,0));
      final InMemoryDistinct memoryDistinct = new InMemoryDistinct();
      projection.addSucceedingOperator(new OperatorIDTuple(memoryDistinct,0));
      return memoryDistinct;
    }
  }
View Full Code Here


      // alternative way to evaluate (...)+ without using the Closure operator!
      final ReplaceVar replaceVar = new ReplaceVar();
      final ReplaceVar replaceVari = new ReplaceVar();
      final BasicOperator startingOperator = node.jjtGetChild(0).accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);

      final Projection projection = new Projection();
      projection.addProjectionElement(subject);
      projection.addProjectionElement(object);
      if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
        projection.addProjectionElement((Variable)graphConstraint);
      }

      final InMemoryDistinct memoryDistinct = new InMemoryDistinct();
      try {
        final Filter filter = new Filter("(" + subject + " != " + object + ")");
View Full Code Here

      this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,i), temp2, graphConstraint);
    }

    union.addSucceedingOperator(new OperatorIDTuple(minus,1));

    final Projection projection = new Projection();
    projection.addProjectionElement(subject);
    projection.addProjectionElement(object);
    if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
      projection.addProjectionElement((Variable)graphConstraint);
    }
    minus.addSucceedingOperator(new OperatorIDTuple(projection,0));

    return projection;
  }
View Full Code Here

    final BasicOperator leftSide=node.jjtGetChild(0).accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);
    final BasicOperator rightSide = node.jjtGetChild(1).accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);
    final Union union = new Union();
    leftSide.addSucceedingOperator(new OperatorIDTuple(union,0));
    rightSide.addSucceedingOperator(new OperatorIDTuple(union,1));
    final Projection projection = new Projection();
    projection.addProjectionElement(subject);
    projection.addProjectionElement(object);
    if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
      projection.addProjectionElement((Variable)graphConstraint);
    }
    union.addSucceedingOperator(new OperatorIDTuple(projection,0));
    return projection;
  }
View Full Code Here

      final BasicOperator startingOperator2 = node.jjtGetChild(0).accept(this, connection, graphConstraint, subject, v, subjectNode, objectNode);
      startingOperator2.addSucceedingOperator(new OperatorIDTuple(join, 0));
//    }
    final BasicOperator startingOperator = node.jjtGetChild(1).accept(this, connection, graphConstraint, v, object, subjectNode, objectNode);
    startingOperator.addSucceedingOperator(new OperatorIDTuple(join,1));
    final Projection projection = new Projection();
    projection.addProjectionElement(subject);
    projection.addProjectionElement(object);
    if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
      projection.addProjectionElement((Variable)graphConstraint);
    }
    join.addSucceedingOperator(new OperatorIDTuple(projection,0));
    return projection;
  }
View Full Code Here

    }

    // insert projection operator

    if (!(node instanceof ASTSelectQuery && ((ASTSelectQuery)node).isSelectAll())) {
      final Projection p = new Projection();
      final LinkedList<AddComputedBinding> listOfAddComputedBindings = new LinkedList<AddComputedBinding>();
      for (int i = 0; i < numberChildren; i++) {
        if (node.jjtGetChild(i) instanceof ASTVar) {
          final ASTVar variable = (ASTVar) node.jjtGetChild(i);
          p.addProjectionElement(new Variable(variable.getName()));
          onlyAggregations = false;
        } else if (node.jjtGetChild(i) instanceof ASTAs) {
          final ASTVar variable = (ASTVar) node.jjtGetChild(i)
              .jjtGetChild(1);
          final lupos.sparql1_1.Node constraint = node.jjtGetChild(i)
              .jjtGetChild(0);
          /*
           * Detecting Errors in SelectQuery if aggregations are used
           * and additional variables are not bound by a GROUP BY
           * statement
           */
          // this.prooveBoundedGroup(node.jjtGetChild(i));

          if (!(constraint instanceof ASTAggregation)) {
            onlyAggregations = false;
          }
          final Variable var2 = new Variable(variable.getName());
          p.addProjectionElement(var2);
          final AddComputedBinding acb = group ? new GroupByAddComputedBinding()
              : new AddComputedBinding();
          acb.addProjectionElement(var2, constraint);
          listOfAddComputedBindings.add(acb);
        }
      }
      // deleting of values if there is only an aggregation statement
      if (onlyAggregations || group) {
        connection.connectAndSetAsNewOperatorConnection(new Distinct());
      }
      listOACB = this.topologicalSorting(listOfAddComputedBindings);
      connection.connectAndSetAsNewOperatorConnection(p);
    }

    // insert sort operator
    for (int i = 0; i < numberChildren; i++) {
      if (node.jjtGetChild(i) instanceof ASTOrderConditions) {
        node.jjtGetChild(i).accept(this, connection);
      }
    }

    for (final AddComputedBinding acb : listOACB) {
      connection.connectAndSetAsNewOperatorConnection(acb);
    }

    // Dealing with the HAVING clause
    for (int i = 0; i < numberChildren; i++) {
      final Node childi = node.jjtGetChild(i);
      if (childi instanceof ASTHaving) {
        for (int k = 0; k < childi.jjtGetNumChildren(); k++) {
          if (childi.jjtGetChild(k) instanceof ASTFilterConstraint) {
            final Having filter = new Having((ASTFilterConstraint) childi
                .jjtGetChild(k));
            this.processExistChildren(node, graphConstraint, filter);
            filter.setEvaluator(this.evaluator);
            connection.connectAndSetAsNewOperatorConnection(filter);
          }
        }

      }
    }

    // Dealing with the GROUP clause
    for (int j = 0; j < numberChildren; j++) {
      final Projection p = new Projection();
      final LinkedList<AddComputedBinding> listOfAddComputedBindings = new LinkedList<AddComputedBinding>();
      ASTVar variable = null;
      final Node childi = node.jjtGetChild(j);
      onlyAggregations = true;
      if (childi instanceof ASTGroup) {
        for (int i = 0; i < childi.jjtGetNumChildren(); i++) {
          if (childi.jjtGetChild(i) instanceof ASTAdditionNode
              || childi.jjtGetChild(i) instanceof ASTSubtractionNode
              || childi.jjtGetChild(i) instanceof ASTMultiplicationNode
              || childi.jjtGetChild(i) instanceof ASTDivisionNode) {
            throw new Error(
                "Error in GROUP BY statement: AS not found");

          } else if (childi.jjtGetChild(i) instanceof ASTAs) {

            variable = (ASTVar) childi.jjtGetChild(i).jjtGetChild(1);
            final lupos.sparql1_1.Node constraint = childi.jjtGetChild(i).jjtGetChild(0);

            /*
             * Detecting Errors in SelectQuery if aggregations are
             * used and additional variables are not bound by a
             * GROUP BY statement
             */
            this.prooveBoundedGroup(constraint);

            if (!(constraint instanceof ASTAggregation)) {
              onlyAggregations = false;
            }
            final Variable var2 = new Variable(variable.getName());
            p.addProjectionElement(var2);

            final AddComputedBinding acb = new GroupByAddComputedBinding();
            acb.addProjectionElement(var2, constraint);
            listOfAddComputedBindings.add(acb);

View Full Code Here

          startingOperator.addSucceedingOperator(connection.getOperatorIDTuple());
        }
        else
          if(subjectIsALiteral && !objectIsALiteral){
            final Filter filter = new Filter("(" + subject + " = " + realSubject +")");
            final Projection projection = new Projection();
            projection.addProjectionElement(object);
            if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
              projection.addProjectionElement((Variable)graphConstraint);
            }

            filter.addSucceedingOperator(new OperatorIDTuple(projection,0));
            projection.addSucceedingOperator(connection.getOperatorIDTuple());
            startingOperator.addSucceedingOperator(new OperatorIDTuple(filter,0));

          }
          else
            if(!subjectIsALiteral && objectIsALiteral){
              final Filter filter = new Filter("(" + object + " = " + realObject + ")");
              final Projection projection = new Projection();
              projection.addProjectionElement(subject);
              if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
                projection.addProjectionElement((Variable)graphConstraint);
              }

              filter.addSucceedingOperator(new OperatorIDTuple(projection,0));
              projection.addSucceedingOperator(connection.getOperatorIDTuple());
              startingOperator.addSucceedingOperator(new OperatorIDTuple(filter,0));

            }
            else
              if(subjectIsALiteral && objectIsALiteral){
                final Filter firstFilter = new Filter("(" + object + " = " + realObject + ")");
                final Filter secondFilter = new Filter("(" + subject + " = " + realSubject + ")");
                final Projection firstProjection = new Projection();
                firstProjection.addProjectionElement(subject);
                if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
                  firstProjection.addProjectionElement((Variable)graphConstraint);
                }
                final Projection secondProjection = new Projection();
                secondProjection.addProjectionElement(object);
                if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
                  secondProjection.addProjectionElement((Variable)graphConstraint);
                }

                firstFilter.addSucceedingOperator(new OperatorIDTuple(firstProjection,0));
                firstProjection.addSucceedingOperator(new OperatorIDTuple(secondFilter, 0));
                secondFilter.addSucceedingOperator(new OperatorIDTuple(secondProjection,0));
                secondProjection.addSucceedingOperator(connection.getOperatorIDTuple());
                startingOperator.addSucceedingOperator(new OperatorIDTuple(firstFilter,0));
              }
      }
      catch( final Exception e){
        e.printStackTrace();
        System.out.println(e);
      }
    } else {
      // alternative way to evaluate (...)?, (...)* and (...)+ without using the Closure and PathLengthZero operators!
      try{
        Variable subject;
        Variable object;
        Item realSubject = null;
        Item realObject = null;
        boolean subjectIsALiteral = false;
        boolean objectIsALiteral = false;
        Item itm = getItem(tripleSet.jjtGetChild(0));
        if (!itm.isVariable()){
          subject = this.getVariable(getItem(tripleSet.jjtGetChild(0)).toString(), getItem(tripleSet.jjtGetChild(2)).toString(), "interimSubject");
          realSubject = itm;
          subjectIsALiteral = true;
        } else {
          subject = (Variable) itm;
        }
        final Node subjectNode = tripleSet.jjtGetChild(0);
        itm = getItem(tripleSet.jjtGetChild(2));
        if (!itm.isVariable()){
          object = this.getVariable(getItem(tripleSet.jjtGetChild(0)).toString(), getItem(tripleSet.jjtGetChild(2)).toString(), "interimObject");
          realObject = itm;
          objectIsALiteral = true;
        } else {
          object = (Variable) itm;
        }
        final Node objectNode = tripleSet.jjtGetChild(2);
        final ReplaceVar replaceVar = new ReplaceVar();
        replaceVar.addSubstitution(object, subject);
        final Variable variable = this.getVariable(subject.toString(), object.toString(), "interimVariable");
        replaceVar.addSubstitution(variable, object);
        if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
          replaceVar.addSubstitution((Variable)graphConstraint, (Variable)graphConstraint);
        }
        final ReplaceVar replaceVari = new ReplaceVar();
        replaceVari.addSubstitution(subject, subject);
        replaceVari.addSubstitution(object, variable);
        if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
          replaceVari.addSubstitution((Variable)graphConstraint, (Variable)graphConstraint);
        }

        final BasicOperator startingOperator =tripleSet.jjtGetChild(1).jjtGetChild(0).accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);

        final InMemoryDistinct memoryDistinct = new InMemoryDistinct();
        final Filter filter = new Filter("(" + subject + " != " + object + ")");

        startingOperator.addSucceedingOperator(new OperatorIDTuple(filter,0));
        startingOperator.addSucceedingOperator(connection.getOperatorIDTuple());
        final Join intermediateJoinOperator = new Join();
        replaceVar.addSucceedingOperator(new OperatorIDTuple(memoryDistinct,0));
        memoryDistinct.addSucceedingOperator(new OperatorIDTuple(intermediateJoinOperator,1));
        filter.addSucceedingOperator(new OperatorIDTuple(intermediateJoinOperator,0));
        filter.addSucceedingOperator(new OperatorIDTuple(replaceVar,0));
        intermediateJoinOperator.addSucceedingOperator(new OperatorIDTuple(replaceVari,0));
        replaceVari.addSucceedingOperator(new OperatorIDTuple(replaceVar,0));
        replaceVari.addSucceedingOperator(connection.getOperatorIDTuple());

        if(subjectIsALiteral && !objectIsALiteral){
          final Filter firstFilter = new Filter("(" + subject + " = " + realSubject +")");
          final Filter secondFilter = new Filter("(" + subject + " = " + realSubject +")");
          final Projection firstProjection = new Projection();
          firstProjection.addProjectionElement(object);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            firstProjection.addProjectionElement((Variable)graphConstraint);
          }
          final Projection secondProjection = new Projection();
          secondProjection.addProjectionElement(object);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            secondProjection.addProjectionElement((Variable)graphConstraint);
          }

          firstFilter.addSucceedingOperator(new OperatorIDTuple(firstProjection,0));
          secondFilter.addSucceedingOperator(new OperatorIDTuple(secondProjection,0));

          firstProjection.addSucceedingOperator(connection.getOperatorIDTuple());
          secondProjection.addSucceedingOperator(connection.getOperatorIDTuple());

          replaceVari.addSucceedingOperator(new OperatorIDTuple(secondFilter,0));
          replaceVari.removeSucceedingOperator(connection.getOperatorIDTuple().getOperator());

          startingOperator.addSucceedingOperator(new OperatorIDTuple(firstFilter,0));
          startingOperator.removeSucceedingOperator(connection.getOperatorIDTuple().getOperator());

        }

        if(!subjectIsALiteral && objectIsALiteral){
          final Filter firstFilter = new Filter("(" + object + " = " + realObject + ")");
          final Filter secondFilter = new Filter("(" + object + " = " + realObject + ")");
          final Projection firstProjection = new Projection();
          firstProjection.addProjectionElement(subject);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            firstProjection.addProjectionElement((Variable)graphConstraint);
          }
          final Projection secondProjection = new Projection();
          secondProjection.addProjectionElement(subject);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            secondProjection.addProjectionElement((Variable)graphConstraint);
          }

          firstFilter.addSucceedingOperator(new OperatorIDTuple(firstProjection,0));
          secondFilter.addSucceedingOperator(new OperatorIDTuple(secondProjection,0));

          firstProjection.addSucceedingOperator(connection.getOperatorIDTuple());
          secondProjection.addSucceedingOperator(connection.getOperatorIDTuple());

          replaceVari.addSucceedingOperator(new OperatorIDTuple(secondFilter,0));
          replaceVari.removeSucceedingOperator(connection.getOperatorIDTuple().getOperator());

          startingOperator.addSucceedingOperator(new OperatorIDTuple(firstFilter,0));
          startingOperator.removeSucceedingOperator(connection.getOperatorIDTuple().getOperator());

        }
        if(subjectIsALiteral && objectIsALiteral){
          final Filter firstFilter = new Filter("(" + object + " = " + realObject + ")");
          final Filter secondFilter = new Filter("(" + subject + " = " + realSubject + ")");
          final Filter thirdFilter = new Filter("(" + object + " = " + realObject + ")");
          final Filter fourthFilter = new Filter("(" + subject + " = " + realSubject + ")");
          final Projection firstProjection = new Projection();
          firstProjection.addProjectionElement(subject);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            firstProjection.addProjectionElement((Variable)graphConstraint);
          }
          final Projection secondProjection = new Projection();
          secondProjection.addProjectionElement(object);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            secondProjection.addProjectionElement((Variable)graphConstraint);
          }
          final Projection thirdProjection = new Projection();
          thirdProjection.addProjectionElement(subject);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            thirdProjection.addProjectionElement((Variable)graphConstraint);
          }
          final Projection fourthProjection = new Projection();
          fourthProjection.addProjectionElement(object);
          if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
            fourthProjection.addProjectionElement((Variable)graphConstraint);
          }

          firstFilter.addSucceedingOperator(new OperatorIDTuple(firstProjection,0));
          secondFilter.addSucceedingOperator(new OperatorIDTuple(secondProjection,0));
          thirdFilter.addSucceedingOperator(new OperatorIDTuple(thirdProjection,0));
          fourthFilter.addSucceedingOperator(new OperatorIDTuple(fourthProjection,0));

          firstProjection.addSucceedingOperator(new OperatorIDTuple(secondFilter, 0));
          secondProjection.addSucceedingOperator(connection.getOperatorIDTuple());
          thirdProjection.addSucceedingOperator(new OperatorIDTuple(fourthFilter, 0));
          fourthProjection.addSucceedingOperator(connection.getOperatorIDTuple());

          replaceVari.addSucceedingOperator(new OperatorIDTuple(thirdFilter,0));
          replaceVari.removeSucceedingOperator(connection.getOperatorIDTuple().getOperator());

          startingOperator.addSucceedingOperator(new OperatorIDTuple(firstFilter,0));
View Full Code Here

public class RuleMergeTwoProjection extends Rule {

  @Override
  protected void init() {
    final Projection proj1 = new Projection();
    final Projection proj2 = new Projection();

    proj1.setSucceedingOperator(new OperatorIDTuple(proj2, -1));
    proj2.setPrecedingOperator(proj1);

    subGraphMap = new HashMap<BasicOperator, String>();
    subGraphMap.put(proj1, "proj1");
    subGraphMap.put(proj2, "proj2");
View Full Code Here

  public Tuple<Collection<BasicOperator>, Collection<BasicOperator>> transformOperatorGraph(
      final Map<String, BasicOperator> mso,
      final BasicOperator rootOperator) {
    final Collection<BasicOperator> deleted = new LinkedList<BasicOperator>();
    final Collection<BasicOperator> added = new LinkedList<BasicOperator>();
    final Projection proj1 = (Projection) mso.get("proj1");
    final Projection proj2 = (Projection) mso.get("proj2");

    final Object[] proj1Vars = proj1.getProjectedVariables().toArray();
    final Object[] proj2Vars = proj2.getProjectedVariables().toArray();

    final Projection proj_new = new Projection();
    for (int i = 0; i < proj2Vars.length; i++) {
      // Only intersection variables go into the new projection
      if (arrayContains(proj1Vars, (Variable) proj2Vars[i])) {
        proj_new.addProjectionElement((Variable) proj2Vars[i]);
      }
    }

    final LinkedList<BasicOperator> pres = (LinkedList<BasicOperator>) proj1
        .getPrecedingOperators();
    BasicOperator pre;
    for (int i = 0; i < pres.size(); i++) {
      pre = pres.get(i);
      pre.addSucceedingOperator(new OperatorIDTuple(proj_new, pre
          .getOperatorIDTuple(proj1).getId()));
      pre.removeSucceedingOperator(proj1);
    }

    proj_new.setPrecedingOperators(proj1.getPrecedingOperators());
    proj_new.setSucceedingOperators(proj2.getSucceedingOperators());

    final LinkedList<OperatorIDTuple> succs = (LinkedList<OperatorIDTuple>) proj2
        .getSucceedingOperators();
    for (int i = 0; i < succs.size(); i++) {
      succs.get(i).getOperator().addPrecedingOperator(proj_new);
View Full Code Here

TOP

Related Classes of lupos.engine.operators.singleinput.Projection

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.