Package lupos.datastructures.bindings

Examples of lupos.datastructures.bindings.Bindings$Blanks


        this.commentLabelElement.remove();
      }
      final Vector<Vector<String>> data = new Vector<Vector<String>>();
      final Vector<String> columnNames = new Vector<String>();
      if (stepContainer.getObject() instanceof Bindings) {
        final Bindings b = (Bindings) stepContainer.getObject();
        final Vector<String> columns = new Vector<String>();
        for (final Variable v : b.getVariableSet()) {
          columnNames.add(v.getName());
          columns.add(b.get(v).toString(
              this.operatorGraphViewer.getOperatorGraph()
              .getPrefix()));
        }
        data.add(columns);
        this.commentLabelElement = new CommentLabelElement(
View Full Code Here


        this.br_list.add(br);
        final Iterator<Bindings> itb = res.oneTimeIterator();
        if (!itb.hasNext()) {
          this.updateCommentPanel();
        } else {
          final Bindings b = itb.next();
          this.qr.add(b);
          this.updateCommentPanel();
        }
      } else {
        if (this.qr == null) {
          this.qr = QueryResult.createInstance();
        }
        final Iterator<Bindings> itb = res.oneTimeIterator();
        if (!itb.hasNext()) {
          this.updateCommentPanel();
        }
        while (itb.hasNext()) {
          final Bindings b = itb.next();
          this.qr.add(b);
          this.updateCommentPanel();
        }
      }
    }
View Full Code Here

    // System.out.println(solutions);
    try {
      String varname;
      QuerySolution sol;
      final QueryResult result = QueryResult.createInstance();
      Bindings binding;
      // System.out.println(solutions.hasNext());
      while (solutions.hasNext()) {
        sol = solutions.nextSolution();
        binding = new BindingsMap(); // Bindings.createNewInstance();
        final Iterator<String> it = sol.varNames();
        while (it.hasNext()) {
          varname = it.next();
          if (sol.contains(varname)) {
            if (sol.get(varname).isLiteral()) {
              if (sol.getLiteral(varname).getDatatypeURI() != null)
                binding
                    .add(
                        new Variable(varname),
                        TypedLiteralOriginalContent
                            .createTypedLiteral(
                                "\""
                                    + sol
                                        .getLiteral(
                                            varname)
                                        .getLexicalForm()
                                    + "\"",
                                "<"
                                    + sol
                                        .getLiteral(
                                            varname)
                                        .getDatatypeURI()
                                    + ">"));
              else {
                if (sol.getLiteral(varname).getLanguage() != null
                    && sol.getLiteral(varname)
                        .getLanguage().length() > 0) {
                  binding
                      .add(
                          new Variable(varname),
                          lupos.datastructures.items.literal.LiteralFactory
                              .createLanguageTaggedLiteral(
                                  "\""
                                      + sol
                                          .getLiteral(
                                              varname)
                                          .getLexicalForm()
                                      + "\"",
                                  sol
                                      .getLiteral(
                                          varname)
                                      .getLanguage()));
                } else
                  binding
                      .add(
                          new Variable(varname),
                          lupos.datastructures.items.literal.LiteralFactory
                              .createLiteral("\""
                                  + sol
                                      .getLiteral(
                                          varname)
                                      .getLexicalForm()
                                  + "\""));
              }
            } else {
              if (sol.get(varname).isAnon())
                binding
                    .add(
                        new Variable(varname),
                        new lupos.datastructures.items.literal.AnonymousLiteral(
                            sol
                                .getResource(
                                    varname)
                                .toString()));
              else
                binding
                    .add(
                        new Variable(varname),
                        lupos.datastructures.items.literal.LiteralFactory
                            .createURILiteral("<"
                                + sol
View Full Code Here

        return this.itb.hasNext();
      }

      @Override
      public Bindings next() {
        final Bindings b = this.itb.next();
        if (b != null) {
          final Literal literal = b.get(AddBinding.this.var);
          if (literal == null) {
            b.add(AddBinding.this.var, AddBinding.this.literalName);
          }
          // if the item is a variable which is already bound
          // and the value differs from the value of the triple
          // which would be used as binding, a conflict is
          // detected
View Full Code Here

  public static void indexQueryResult(final QueryResult toIndex, final Collection<Variable> joinVariables, final Map<String, QueryResult> index, final QueryResult cartesianProduct){
    final Iterator<Bindings> itbindings = toIndex.oneTimeIterator();
    while (itbindings.hasNext()) {

      final Bindings bindings = itbindings.next();

      final String keyJoin = IndexOnLeftOperandJoin.getKey(bindings, joinVariables);

      if (keyJoin == null){
        cartesianProduct.add(bindings);
View Full Code Here

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

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

      return result;
    }

    @Override
    public Bindings next() {
      final Bindings result = this.innerIterator.next();
      System.out.println(this.id+".next():"+result);
      return result;
    }
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;
              }
              this.next = this.next();
              return (this.next!=null);
            }

            @Override
            public Bindings next() {
              if(this.next!=null){
                final Bindings zBindings = this.next;
                this.next = null;
                return zBindings;
              }
              if(!this.it.hasNext()){
                return null;
              }
              Bindings bnew;
              do {
                bnew = bindings.clone();
                final Bindings bindings2 = this.it.next();
                bnew = Join.joinBindingsAndReturnBindings(bnew, bindings2);
              } while(bnew==null && this.it.hasNext());
              return bnew;
            }
          };
View Full Code Here

      final long numberOfThreads = this.b.length;
      final BoundedBuffer<Bindings>[] leftBuff = this.b;
      final Iterator<Bindings> leftIter = this.qres.oneTimeIterator();
      // share the rest of the bindings
      while (leftIter.hasNext()) {// share left
        final Bindings bindings = leftIter.next();
        if (bindings != null) {
          final long key = ParallelJoin.this.hashFun.hash(HashFunction.getKey(bindings, ParallelJoin.this.intersectionVariables));
          final int resultNumber = (int) (key % numberOfThreads);
          leftBuff[resultNumber].put(bindings);
        }
View Full Code Here

TOP

Related Classes of lupos.datastructures.bindings.Bindings$Blanks

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.