Package lupos.datastructures.bindings

Examples of lupos.datastructures.bindings.Bindings


    }

    @Override
    public Bindings next() {
      if(this.next!=null){
        Bindings znext = this.next;
        this.next = null;
        return znext;
      } else {
        return computeNext();     
      }
View Full Code Here


        return computeNext();     
      }
    }
   
    public Bindings computeNext(){
      Bindings inter;
      boolean flag;
      do {
        flag = false;
        if(this.originalIterator.hasNext()){
          inter = this.originalIterator.next();
        } else {
          return null;
        }
        for(Variable v: this.bindingsToAdd.getVariableSet()){
          Literal literal = inter.get(v);
          if(literal!=null){
            flag = (literal.compareToNotNecessarilySPARQLSpecificationConform(this.bindingsToAdd.get(v))!=0);
          }
          inter.add(v, this.bindingsToAdd.get(v));
        }
        inter.addAllTriples(this.bindingsToAdd.getTriples());
      } while(flag);
      return inter;
    }
View Full Code Here

  @Override
  protected QueryResult postProcess(final QueryResult bindings, final int id) {
    for (final Iterator<Bindings> iter = bindings.iterator(); iter
        .hasNext();) {
      /* if( bindings.getSorted() ){merge( bindings ); return null; } */
      final Bindings binding = iter.next();
      try {

        if (this.list.isEmpty()) {
          this.list.add(binding);
          break;
View Full Code Here

  }

  @Override
  protected QueryResult merge(final QueryResult bind) {
    final Iterator<Bindings> iterBind = bind.iterator();
    Bindings binding = iterBind.next();
    for (int i = 0; i < this.list.size(); i++) {
      if (this.comparator.compare(binding, this.list.get(i)) <= 0) {
        this.list.add(i, binding);
        i++;
        if (iterBind.hasNext())
View Full Code Here

      @Override
      public Bindings next() {
        if (!this.itbold.hasNext()) {
          return null;
        }
        final Bindings bind1 = this.itbold.next();
        if (!this.itbold.hasNext()) {
          if (this.itbold instanceof ParallelIterator) {
            ((ParallelIterator) this.itbold).close();
          }
        }
        final Bindings bnew = Projection.this.bindingsFactory.createInstance();

        final Iterator<Variable> it = Projection.this.s.iterator();
        while (it.hasNext()) {
          final Variable elem = it.next();
          bnew.add(elem, bind1.get(elem));
        }
        bnew.addAllTriples(bind1);
        bnew.addAllPresortingNumbers(bind1);
        return bnew;
      }

      @Override
      public void remove() {
View Full Code Here

            deltaIndex = new HashSet<Triple>();
          }
          // iterate through the solution and its query triples
          final Iterator<Bindings> itBindings = queryResult.oneTimeIterator();
          while(itBindings.hasNext()){
            final Bindings bindings = itBindings.next();
            for(final Triple triple: bindings.getTriples()){
              // Add the triple to the delta index and check if it is already in the delta index at the same time!
              // (Previously sent triples are eliminated as well as duplicates within the query triples of the same query result.)
              if(deltaIndex.add(triple)){
                // if the triple is not already in the delta index, then send it to the client!
                os.write(triple.toN3String().getBytes());
View Full Code Here

  @Override
  public QueryResult process(final QueryResult bindings, final int operandID) {
    final Iterator<Bindings> itb = bindings.oneTimeIterator();
    while (this.pos < this.smallestBindings.length && itb.hasNext()) {
      final Bindings b = itb.next();
      if (this.max == null || this.comparator.compare(b, this.max) > 0) {
        this.posMax = this.pos;
        this.max = b;
      }
      this.smallestBindings[this.pos++] = b;
    }
    if (itb.hasNext()) {
      while (itb.hasNext()) {
        final Bindings b = itb.next();
        if (this.comparator.compare(b, this.max) < 0) {
          this.smallestBindings[this.posMax] = b;
          this.max = b;
          // find new maximum
          for (int i = 0; i < this.smallestBindings.length; i++) {
View Full Code Here

      return this.iterator.hasNext();
    }

    @Override
    public Bindings next() {
      final Bindings bindings = this.iterator.next();
      if(bindings==null){
        return null;
      }
      if(bindings.getClass() == Bindings.instanceClass){
        return bindings;
      } else {
        final Bindings bnew = bindings.clone();
        return bnew;
      }
    }
View Full Code Here

          return (this.next != null);
        }

        @Override
        public Bindings next() {
          final Bindings zNext = this.next;
          this.next = this.computeNext();
          return zNext;
        }

        private Bindings computeNext() {
          while (this.bindIt.hasNext()) {
            final Bindings bind = this.bindIt.next();
            try {
              if (bind != null) {
                for (final Map.Entry<Variable, Filter> entry: AddComputedBinding.this.projections.entrySet()) {
                  bind.add(entry.getKey(), Helper
                      .getLiteral(Filter.staticEvalTree(
                          bind, entry.getValue()
                              .getNodePointer(),
                          null)));
                }
View Full Code Here

        return (this.next != null);
      }

      @Override
      public Bindings next() {
        final Bindings zNext = this.next;
        this.next = this.computeNext();
        return zNext;
      }

      private Bindings computeNext() {
        while (this.bindIt.hasNext()) {
          final Bindings bind = this.bindIt.next();
          try {
            if (bind != null) {
              final Bindings bindNew = bind.clone();
              final Iterator<HashMap<lupos.sparql1_1.Node, Object>> resultsOfAggregationFunctionsIterator = resultsOfAggregationFunctionsList.iterator();
              for (final Map.Entry<Variable, Filter> entry: AddComputedBinding.this.projections
                  .entrySet()) {
                final HashMap<lupos.sparql1_1.Node, Object> resultsOfAggregationFunctions = resultsOfAggregationFunctionsIterator.next();
                bindNew.add(entry.getKey(),
                    Helper.getLiteral(Filter.staticEvalTree(
                        bind,
                        entry.getValue().getNodePointer(),
                        resultsOfAggregationFunctions, entry.getValue().getUsedEvaluationVisitor())));
              }
View Full Code Here

TOP

Related Classes of lupos.datastructures.bindings.Bindings

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.