Package lupos.datastructures.bindings

Examples of lupos.datastructures.bindings.Bindings


          currentOuterElements[i] = itb[i].next();
        }
        if (!itb[itb.length - 1].hasNext()) {
          itb[itb.length - 1] = operands[itb.length - 1].iterator();
        }
        final Bindings bnew = itb[itb.length - 1].next().clone();
        for (int j = 0; j < currentOuterElements.length; j++) {
          bnew.addAll(currentOuterElements[j]);
          bnew.addAllTriples(currentOuterElements[j]);
          bnew.addAllPresortingNumbers(currentOuterElements[j]);
        }
        return bnew;
      }

      @Override
View Full Code Here


                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) {
View Full Code Here

      lastIteration.addAll(closure);
      while(!lastIteration.isEmpty()){
        final SetImplementation<Bindings> thisIteration = new SetImplementation<Bindings>();
        final Iterator<Bindings> itsubject = lastIteration.iterator();
        while (itsubject.hasNext()){
          final Bindings closureElement = itsubject.next();
          if(this.allowedSubjects==null || this.allowedSubjects.contains(closureElement.get(this.subject))){
            Set<Literal> potentialNewBindings = reachabilityMap.get(closureElement.get(this.object));

            if (potentialNewBindings != null){
              final SetImplementation<Literal> updatedMapEntry= new SetImplementation<Literal>(reachabilityMap.get(closureElement.get(this.subject)));
              final Iterator<Literal> itobject = potentialNewBindings.iterator();
              while(itobject.hasNext()){
                final Literal tempObject = itobject.next();
                final Bindings newBind = new BindingsCollection();
                newBind.add(this.subject, closureElement.get(this.subject));
                newBind.add(this.object, tempObject);
                if(closure.add(newBind)){
                  thisIteration.add(newBind);
                  updatedMapEntry.add(tempObject);
                }
              }
View Full Code Here

      lastIteration.addAll(closure);
      while(!lastIteration.isEmpty()){
        final SetImplementation<Bindings> thisIteration = new SetImplementation<Bindings>();
        final Iterator<Bindings> itobject = lastIteration.iterator();
        while (itobject.hasNext()){
          final Bindings closureElement = itobject.next();
          if(this.allowedObjects==null || this.allowedObjects.contains(closureElement.get(this.object))){
            Set<Literal> potentialNewBindings = reachabilityMap.get(closureElement.get(this.subject));
            if (potentialNewBindings != null){
              final SetImplementation<Literal> updatedMapEntry= new SetImplementation<Literal>(reachabilityMap.get(closureElement.get(this.object)));
              final Iterator<Literal> itsubject = potentialNewBindings.iterator();
              while(itsubject.hasNext()){
                final Literal tempSubject = itsubject.next();
                final Bindings newBind = new BindingsCollection();
                newBind.add(this.subject, tempSubject);
                newBind.add(this.object, closureElement.get(this.object));
                if (closure.add(newBind)){
                  thisIteration.add(newBind);
                  updatedMapEntry.add(tempSubject);
                }
              }
View Full Code Here

    final SetImplementation<Bindings> closure = new SetImplementation<Bindings>();
    final ReachabilityMap<Literal, SetImplementation<Literal>> reachabilityMap = new ReachabilityMap<Literal, SetImplementation<Literal>>();

    final Iterator<Bindings> itb = bindings.oneTimeIterator();
    while(itb.hasNext()){
      final Bindings closureElement = itb.next();
      if(this.shouldBeLeftCalculation()){
        SetImplementation<Literal> newEntry = reachabilityMap.get(closureElement.get(this.subject));
        if(newEntry==null){
          newEntry = new SetImplementation<Literal>();
        }
        newEntry.add(closureElement.get(this.object));
        reachabilityMap.put(closureElement.get(this.subject), newEntry);
      }
      else{
        SetImplementation<Literal> newEntry = reachabilityMap.get(closureElement.get(this.object));
        if(newEntry==null){
          newEntry = new SetImplementation<Literal>();
        }
        newEntry.add(closureElement.get(this.subject));
        reachabilityMap.put(closureElement.get(this.object), newEntry);
      }
      closure.add(closureElement);
    }
    return new Tuple<SetImplementation<Bindings>, ReachabilityMap<Literal, SetImplementation<Literal>>>(closure, reachabilityMap);
  }
View Full Code Here

    // This looks awful. I know. Don't know how to do this properly with
    // generic Collections/Sets though ...
    Object[] bArray = bindings.toArray();
    Object[] vArray = vars.toArray();
    for (int i = 0; i < bArray.length; i++) {
      Bindings b = (Bindings) bArray[i];
     
      // separate bindings by newlines
      if (i > 0) {
        msg += '\n';
      }

      for (int j = 0; j < vArray.length; j++) {
        Variable v = (Variable) vArray[j];

        // separate variables in a binding by semicolon
        if (j > 0) {
          msg += "; ";
        }
        msg += b.get(v).originalString();
      }
    }

    return msg;
  }
View Full Code Here

    if(bindingsIterator.hasNext()){
      result = result.substring(0, result.length()-2);
      result += "}Filter(";
      boolean oneOrMoreResults=false;
      while (bindingsIterator.hasNext()) {
        Bindings b = bindingsIterator.next();
        Iterator<Variable> it = FederatedQuery.getVariablesInIntersectionOfSetOfVariablesAndBindings(variablesInServiceCall, b).iterator();
        if(it.hasNext()){
          result += "(";
          while (it.hasNext()) {
            oneOrMoreResults=true;
View Full Code Here

          }
          result +="("+this.toStringHelper.functionCallBeginning()+variable+this.toStringHelper.functionCallEnd();
          result +=" IN (";
          HashSet<String> results = new HashSet<String>();
          while (bindingsIterator.hasNext()) {
            Bindings b = bindingsIterator.next();
            Literal literal = variable.getLiteral(b);
            if(literal!=null){
              oneOrMoreResults=true;
              String hashResult = this.toStringHelper.valueConverter(literal);
              results.add(hashResult);
View Full Code Here

          return null;
        }

        private URILiteral nextEndpoint(){
          while(this.it.hasNext()){
            final Bindings service = this.it.next();
            Literal endpointURI = service.get((Variable) endpoint);
            if (endpointURI instanceof LazyLiteral) {
              endpointURI = ((LazyLiteral) endpointURI).getLiteral();
            }
            if (endpointURI instanceof URILiteral) {
              final URILiteral result = (URILiteral) endpointURI;
View Full Code Here

        return this.it.hasNext();
      }

      @Override
      public Bindings next() {
        final Bindings bindings = this.it.next();
        if(bindings==null){
          return null;
        }
        bindings.add(endpointVariable, endpointURI);
        return bindings;
      }

      @Override
      public void remove() {
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.