Package lupos.datastructures.queryresult

Examples of lupos.datastructures.queryresult.QueryResult


      this.comp.setVariables(this.intersectionVariables);
      final ParallelIterator<Bindings> currentResult = (this.intersectionVariables.size() == 0) ?
          MergeJoin.cartesianProductIterator(QueryResult.createInstance(this.left.iterator()), QueryResult.createInstance(this.right.iterator())) :
            MergeJoin.mergeJoinIterator(this.left.iterator(), this.right.iterator(), this.comp, this.intersectionVariables, this.bindingsFactory);
      if (currentResult != null && currentResult.hasNext()) {
        final QueryResult result = QueryResult.createInstance(new ParallelIterator<Bindings>() {

              int number = 0;

              @Override
              public void close() {
                currentResult.close();
              }

              @Override
              public boolean hasNext() {
                if (!currentResult.hasNext()) {
                  MergeJoin.this.realCardinality = this.number;
                  this.close();
                }
                return currentResult.hasNext();
              }

              @Override
              public Bindings next() {
                final Bindings b = currentResult.next();
                if (!currentResult.hasNext()) {
                  MergeJoin.this.realCardinality = this.number;
                  this.close();
                }
                if (b != null) {
                  this.number++;
                }
                return b;
              }

              @Override
              public void remove() {
                currentResult.remove();
              }

              @Override
              public void finalize() {
                this.close();
              }
            });

        if (this.succeedingOperators.size() > 1) {
          result.materialize();
        }
        for (final OperatorIDTuple opId : this.succeedingOperators) {
          final QueryResultDebug qrDebug = new QueryResultDebug(result, debugstep, this, opId.getOperator(), true);
          ((Operator) opId.getOperator()).processAllDebug(qrDebug, opId.getId(), debugstep);
        }
View Full Code Here


  protected Iterator<Bindings>[] getArray(
      final List<QueryResult> operandResults, final boolean moreThanOnce) {
    final Iterator<Bindings>[] ita = new Iterator[operandResults.size()];
    final Iterator<QueryResult> itqr = operandResults.iterator();
    for (int i = 0; i < operandResults.size(); i++) {
      final QueryResult qr = itqr.next();
      ita[i] = (moreThanOnce) ? qr.iterator() : qr.oneTimeIterator();
    }
    return ita;
  }
View Full Code Here

    if (!this.operands[0].isEmpty()) {
      if (!this.operands[1].isEmpty()) {
        return this.joinOptionalResult(this.operands[0].getQueryResult(), this.operands[1].getQueryResult());
      } else {
        final OptionalResult or = new OptionalResult();
        final QueryResult left = this.operands[0].getQueryResult();
        left.materialize();
        or.setJoinPartnerFromLeftOperand(left);
        or.setJoinResult(left);
      }
    }
    return null;
View Full Code Here

  }

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

    ServiceApproaches.Semijoin_Approach.setup();
    for(int i=1; i<args.length; i+=2){
      final String query = FileHelper.readFile(args[i]);
      System.out.println("\nProcess SPARQL query:");
      System.out.println(query);
      final QueryResult queryResult = evaluator.getResult(query, true);
      System.out.println("\nSave result into file: "+args[i+1]);
      final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(args[i+1]));
      formatter.writeResult(outputStream, evaluator.getVariablesOfQuery(), queryResult);
      outputStream.close();
      evaluator.writeOutIndexFileAndModifiedPages(args[0]);
      queryResult.release();
    }
    System.out.println("\nDone!");
  }
View Full Code Here

    return msg;
  }

  public void computeResult(){
    if(this.operand!=null){
      final QueryResult result = this.getClosure(this.operand);
      if(result!=null){
        for (final OperatorIDTuple opId : this.succeedingOperators) {
          opId.processAll(result);
        }
        result.release();
      }
    }
  }
View Full Code Here

        public void close() {
        }
      };
    }

    final QueryResult result = this.getClosure(this.operand);

    final Iterator<Bindings> itb = result.iterator();
    return new ParallelIterator<Bindings>() {

      @Override
      public void close() {
        // derived classes may override the above method in order to
View Full Code Here

    this.computeDebugStep(debugstep);
    return msg;
  }

  public void computeDebugStep(final DebugStep debugstep){
    final QueryResult qr = QueryResult.createInstance(this.getIterator());
    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

    this.sendEMail.sendContent(queryResult.toString());
  }


  public static void main(String[] args) {
    new XmppMessageAction().execute(new QueryResult());
  }
View Full Code Here

          otherVars.remove(FederatedQueryFetchAsNeededWithCache.this.endpoint);
          for(final Variable var: otherVars){
            bindingsKey.add(var, null);
          }

          final QueryResult cached = FederatedQueryFetchAsNeededWithCache.this.cache.get(bindingsKey);
          if(cached!=null){
            return cached.iterator();
          }

          final String fQuery = FederatedQueryFetchAsNeededWithCache.this.toStringQuery(bindingsTemp);
          if (!FederatedQueryFetchAsNeededWithCache.this.endpoint.isVariable()) {
            final QueryResult queryResult = QueryResult.createInstance(new IteratorQueryResultAndOneBindings(Client.submitQuery(((URILiteral)FederatedQueryFetchAsNeededWithCache.this.endpoint).getString(), fQuery, FederatedQueryFetchAsNeededWithCache.this.bindingsFactory), bindingsTemp));
            queryResult.materialize();
            FederatedQueryFetchAsNeededWithCache.this.cache.put(bindingsKey, queryResult);
            return queryResult.iterator();
          } else {
            Literal endpointURI = bindingsTemp.get((Variable) FederatedQueryFetchAsNeededWithCache.this.endpoint);
            if (endpointURI instanceof LazyLiteral) {
              endpointURI = ((LazyLiteral) endpointURI).getLiteral();
            }
            if (endpointURI instanceof URILiteral) {
              final QueryResult queryResult = QueryResult.createInstance(new IteratorQueryResultAndOneBindings(Client.submitQuery(((URILiteral) endpointURI).getString(), fQuery, FederatedQueryFetchAsNeededWithCache.this.bindingsFactory), bindingsTemp));
              queryResult.materialize();
              FederatedQueryFetchAsNeededWithCache.this.cache.put(bindingsKey, queryResult);
              return queryResult.iterator();
            } else {
              // ignore or error message?
            }
          }
        } catch(final IOException e){
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.