Package lupos.datastructures.queryresult

Examples of lupos.datastructures.queryresult.QueryResult


  @Override
  public Message preProcessMessageDebug(final EndOfEvaluationMessage msg, final DebugStep debugstep) {
    if(!this.operands[0].isEmpty() && ! this.operands[1].isEmpty()){
      final Map<String, QueryResult> leftOperandsData = this.createDatastructure();
      final QueryResult cartesianProduct = QueryResult.createInstance();

      IndexOnLeftOperandJoin.indexQueryResult(this.operands[0].getQueryResult(), this.intersectionVariables, leftOperandsData, cartesianProduct);

      final QueryResult result = QueryResult.createInstance(new JoinIterator(this.intersectionVariables, this.operands[1].getQueryResult(), leftOperandsData, cartesianProduct));

      if(this.succeedingOperators.size()>1){
        result.materialize();
      }

      for (final OperatorIDTuple opId : this.succeedingOperators) {
        opId.processAllDebug(new QueryResultDebug(result, debugstep, this, opId.getOperator(), true), debugstep);
      }
View Full Code Here


      if (keyJoin == null){
        cartesianProduct.add(bindings);
        continue;
      }

      QueryResult lb = index.get(keyJoin);
      if (lb == null){
        lb = QueryResult.createInstance();
      }
      lb.add(bindings);
      index.put(keyJoin, lb);
    }
    if(itbindings instanceof ParallelIterator){
      ((ParallelIterator<Bindings>)itbindings).close();
    }
View Full Code Here

  }

  @Override
  public Message preProcessMessage(final EndOfEvaluationMessage msg) {
    if (!this.operands[0].isEmpty() && !this.operands[1].isEmpty()) {
      final QueryResult result = QueryResult.createInstance();
      this.operands[0].materialize();
      this.operands[1].materialize();
      this.oldResultsOfLeftOperand.add(this.operands[0].getQueryResult());
      final Iterator<Bindings> iteratorLeftChild = this.operands[0].getQueryResult().oneTimeIterator();
      while (iteratorLeftChild.hasNext()) {
        final Bindings leftItem = iteratorLeftChild.next();
        boolean found = false;
        for(final Bindings rightItem : this.operands[1].getQueryResult()) {
          if(this.rightAndLeftBindingsIsMinusEqual(leftItem, rightItem)){
            found = true;
            break;
          }
        }
        if (!found){
          result.add(leftItem);
        }
      }

      // if the operator is in a cycle: it is no problem if the left operand gets new bindings...
      this.operands[0] = new ParallelIteratorMultipleQueryResults();

      for (final OperatorIDTuple opId : this.succeedingOperators) {
        opId.processAll(result);
      }
    } else if (!this.operands[0].isEmpty()) { // happens when the group constraint which follows the minus is empty
      final QueryResult result = this.operands[0].getQueryResult();

      // if the operator is in a cycle: it is no problem if the left operand gets new bindings...
      this.operands[0] = new ParallelIteratorMultipleQueryResults();

      for (final OperatorIDTuple opId : this.succeedingOperators) {
View Full Code Here

  @Override
  public Message preProcessMessage(final EndOfEvaluationMessage msg) {
    this.endOfStreamMsg = msg;
    if (!this.operands[0].isEmpty() && !this.operands[1].isEmpty()) {
      final QueryResult qr = join();
      if (qr != null) {
        if (this.succeedingOperators.size() > 1)
          qr.materialize();
        for (final OperatorIDTuple opId : this.succeedingOperators) {
          opId.processAll(qr);
        }
      }
    }
View Full Code Here

  @Override
  public Message preProcessMessageDebug(final EndOfEvaluationMessage msg, final DebugStep debugstep) {
    this.endOfStreamMsg = msg;
    if (!this.operands[0].isEmpty() && !this.operands[1].isEmpty()) {
      final QueryResult qr = join();
      if (qr != null) {
        if (this.succeedingOperators.size() > 1)
          qr.materialize();
        for (final OperatorIDTuple opId : this.succeedingOperators) {
          final QueryResultDebug qrDebug = new QueryResultDebug(qr,
              debugstep, this, opId.getOperator(), true);
          ((Operator) opId.getOperator()).processAllDebug(qrDebug,
              opId.getId(), debugstep);
View Full Code Here

  }

  @Override
  public Message preProcessMessageDebug(final EndOfEvaluationMessage msg, final DebugStep debugstep) {
    if (!this.operands[0].isEmpty() && !this.operands[1].isEmpty()) {
      final QueryResult result = QueryResult.createInstance();
      final Iterator<Bindings> iteratorLeftChild = this.operands[0].getQueryResult().oneTimeIterator();
      while (iteratorLeftChild.hasNext()) {
        final Bindings leftItem = iteratorLeftChild.next();
        boolean found = false;
        for (final Bindings rightItem : this.operands[1].getQueryResult()) {
          if(this.rightAndLeftBindingsIsMinusEqual(leftItem, rightItem)){
            found = true;
            break;
          }
        }
        if (!found){
          result.add(leftItem);
        }
      }

      for (final OperatorIDTuple opId : this.succeedingOperators) {
        opId.processAllDebug(new QueryResultDebug(result, debugstep, this, opId.getOperator(), true), debugstep);
View Full Code Here

    private Iterator<Bindings> nextIterator() {
      while(this.rightOperandIt.hasNext()){
        Iterator<Bindings> result = null;
        final Bindings bindings = this.rightOperandIt.next();
        final String keyJoin = IndexOnLeftOperandJoin.getKey(bindings, this.joinVariables);
        final QueryResult fromLeft;
        if(keyJoin != null){
          fromLeft = this.leftOperandsData.get(keyJoin);
        } else {
          if(this.cartesianProduct!=null && this.cartesianProduct.size()>0){
            fromLeft = this.cartesianProduct;
          } else {
            fromLeft = null;
          }
        }
        if(fromLeft!=null){
          result = new ImmutableIterator<Bindings>(){
            final Iterator<Bindings> it = fromLeft.oneTimeIterator();
            Bindings next = null;
            @Override
            public boolean hasNext() {
              if(this.next!=null){
                return true;
View Full Code Here

    public void run() {
      this.joiner.setIntersectionVariables(ParallelJoin.this.intersectionVariables);
      this.joiner.process(this.left, LEFT);
      // System.out.println("ParallelJoiner.run()leftsize: " + left.size()
      // + " rightsize: " + right.size());
      final QueryResult res = this.joiner.process(this.right, RIGHT);
      if (res != null) {
        ParallelJoin.this.col.process(res, LEFT);
      }
      ParallelJoin.this.endOfStreamMsg = (EndOfEvaluationMessage) this.joiner.preProcessMessage(ParallelJoin.this.endOfStreamMsg);
      ParallelJoin.this.col.incNumberOfThreads();
View Full Code Here

          .size() == 0) ? MergeJoin
          .cartesianProductIterator(this.operandResults) : MergeJoin
          .mergeJoinIterator(itb, this.comp, this.intersectionVariables,
              this.minimum, this.maximum, this.bindingsFactory);
      if (currentResult != null && currentResult.hasNext()) {
        final QueryResult result = QueryResult
            .createInstance(new SIPParallelIterator<Bindings, Bindings>() {

              int number = 0;

              @Override
View Full Code Here

  public Message preProcessMessage(EndOfEvaluationMessage msg) {

    if (!this.isSortable || this.operands[1].isEmpty()) {
      return super.preProcessMessage(msg);
    } else if (!this.operands[0].isEmpty() && !this.operands[1].isEmpty()) {
      QueryResult result = QueryResult.createInstance();

      Iterator<Bindings> leftIt = this.operands[0].getQueryResult().iterator();
      Iterator<Bindings> rightIt = this.operands[1].getQueryResult().iterator();
      Bindings leftBindings = null, rightBindings = null;
      if (leftIt.hasNext()) {
        leftBindings = leftIt.next();
      }
      if (rightIt.hasNext()) {
        rightBindings = rightIt.next();
      }

      while (rightBindings != null && leftBindings != null) {
        int difference = this.comp.compare(leftBindings, rightBindings);
        if (difference > 0) {
          rightBindings = rightIt.hasNext() ? rightIt.next() : null;
        } else if (difference == 0) {
          leftBindings = leftIt.hasNext() ? leftIt.next() : null;
        } else if (difference < 0) {
          result.add(leftBindings);
          leftBindings = leftIt.hasNext() ? leftIt.next() : null;
        }

      }

      while (leftBindings != null) {
        result.add(leftBindings);
        leftBindings = leftIt.hasNext() ? leftIt.next() : null;
      }

      for (final OperatorIDTuple opId : this.succeedingOperators) {
        opId.processAll(result);
View Full Code Here

TOP

Related Classes of lupos.datastructures.queryresult.QueryResult

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.