Package lupos.engine.operators

Examples of lupos.engine.operators.OperatorIDTuple


                  if (collectPredTPs(prec,
                      new LinkedList<TriplePattern>())) {
                    final int operandID = prec
                    .getOperatorIDTuple(tj).getId();
                    idx
                    .setSucceedingOperator(new OperatorIDTuple(
                        tj, operandID));
                  }
                }
                // delete joins which otherwise would have one
                // operand
                for (final TriplePattern tp2 : tps) {
                  for (final OperatorIDTuple oidtuple : tp2
                      .getSucceedingOperators()) {
                    final BasicOperator bo = oidtuple
                    .getOperator();
                    if (bo instanceof Join) {
                      bo.removePrecedingOperator(tp2);
                      if (!bo.equals(tj)) {
                        bo.removeFromOperatorGraph();
                      }
                    }
                  }
                }
              }
            } else {
              idx = createBasicIndex(ic, succ, tp);
            }
          } else {
            idx = createBasicIndex(ic, succ, tp);
          }
        } else {
          idx = createBasicIndex(ic, succ, tp);
          // throw new IllegalArgumentException(
          // "TP had more than one succeeding operator.");
        }
        visited.add(tp);
        ic.getSucceedingOperators().add(new OperatorIDTuple(idx, 0));
      } else {

      }
    }
    ic.deleteParents();
View Full Code Here


      root = SPARQL1_1Parser.parse(corequery);

      if(root==null){
        this.result = new Result();
        root_param.setSucceedingOperator(new OperatorIDTuple(this.result,0));
      } else {
        final IndexOperatorGraphGenerator spvi = IndexOperatorGraphGenerator.createOperatorGraphGenerator(root_param, this);
        spvi.visit((ASTQuery)root);

        this.result = spvi.getResult();
View Full Code Here

       * has no join found, the next "level" will be added to this iterator!
       */
      ListIterator<OperatorIDTuple> _succeedingsOfUnionIt = _succeedingsOfUnion.listIterator();
      while (true) {
        if (!_succeedingsOfUnionIt.hasNext()) break;
        OperatorIDTuple _eachSucceedingsOfUnion = _succeedingsOfUnionIt.next();
        /*
         * Search for a join as succeding of "union"
         */
        if (!(_eachSucceedingsOfUnion.getOperator() instanceof lupos.engine.operators.multiinput.join.Join)) {
          continue;
        }
       
       
        this.join = (lupos.engine.operators.multiinput.join.Join) _eachSucceedingsOfUnion
            .getOperator();

       
        /*
         * Now search in join's preceding operators for a new "union" operator (so ignore
         * the same way back to the already stored union)
         */
        List<BasicOperator> _precedingsOfJoin = this.join.getPrecedingOperators();
        for (BasicOperator _eachPrecedingsOfJoin : _precedingsOfJoin) {
          /*
           * search for an union
           */
          if (!(_eachPrecedingsOfJoin instanceof lupos.engine.operators.multiinput.Union)) {
            continue;
          }
          /*
           * that is not equal to our already stored "union", because if, we walk the tree back
           */
          if (((lupos.engine.operators.multiinput.Union) _eachPrecedingsOfJoin)
              .equals(this.u1))
            continue;

          /*
           * store the found second union, as 2nd union
           */
          this.u2 = (lupos.engine.operators.multiinput.Union) _eachPrecedingsOfJoin;

          /*
           * Now search for a SubgraphContainer with the same key, as our already
           * stored SubgraphContainer, in the precedings of the 2nd "union"-operator.
           */
          List<BasicOperator> _precedingOf2ndUnion = this.u2.getPrecedingOperators();
          for (BasicOperator _eachPrecedingOf2ndUnion : _precedingOf2ndUnion) {
            if (_eachPrecedingOf2ndUnion.getClass() != lupos.distributed.operator.SubgraphContainer.class) {
              continue;
            }
            /*
             * we have to avoid, that the two SubgraphContainer are equal (so we walked back in tree)
             */
            if (((lupos.distributed.operator.SubgraphContainer<?>) _eachPrecedingOf2ndUnion)
                .equals(this.sg1)) {
             
              continue;
            }
            /*
             * store the key of the 2nd SubgraphContainer
             */
            keySg2 = ((lupos.distributed.operator.SubgraphContainer<?>) _eachPrecedingOf2ndUnion)
                .getKey();
            /*
             * now: both keys have to be same!
             */
            if (!keySg1.equals(keySg2)) {
              /*
               * we didn't found any useful "join" at this level of the operator graph,
               * so we add next level to the iterator (deep-search-algorithm)
               */
              for (OperatorIDTuple nextDeep :  _eachSucceedingsOfUnion.getOperator().getSucceedingOperators()) {
                /*
                 * add and rewind, so that this would be the next item in iterator
                 */
                _succeedingsOfUnionIt.add(nextDeep);
                _succeedingsOfUnionIt.previous();
 
View Full Code Here

      final SimpleNode root_CoreSPARQL = SPARQL1_1Parser.parse(corequery);

      if(root_CoreSPARQL==null){
        this.result = new Result();
        root_param.setSucceedingOperator(new OperatorIDTuple(this.result,0));
      } else {
        final IndexOperatorGraphGenerator spvi = IndexOperatorGraphGenerator.createOperatorGraphGenerator(root_param, this);
        spvi.visit((ASTQuery)root_CoreSPARQL);

        this.result = spvi.getResult();
View Full Code Here

       */
      sgc.setSucceedingOperators(join.getSucceedingOperators());
      /*
       * the join in the subgraph container will return the result
       */
      join.setSucceedingOperator(new OperatorIDTuple(new Result(), 0));

      root.removeSucceedingOperator(sg1);
      root.removeSucceedingOperator(sg2);

     
View Full Code Here

  @Override
  protected void init() {
    final ReplaceLit replaceLit = new ReplaceLit();
    final Filter filter = new Filter();

    replaceLit.setSucceedingOperator(new OperatorIDTuple(filter, -1));
    filter.setPrecedingOperator(replaceLit);

    subGraphMap = new HashMap<BasicOperator, String>();
    subGraphMap.put(replaceLit, "replaceLit");
    subGraphMap.put(filter, "filter");
View Full Code Here

    // deleted
    if (replaceLit.getSubstitutionsLiteralLeft().size() == 0) {
      BasicOperator pre;
      for (int i = 0; i < pres.size(); i++) {
        pre = pres.get(i);
        pre.addSucceedingOperator(new OperatorIDTuple(filter, index));
        pre.removeSucceedingOperator(replaceLit);
        filter.addPrecedingOperator(pre);
      }
      filter.removePrecedingOperator(replaceLit);
      deleted.add(replaceLit);
    }

    // Insert the new ReplaceLit under the Join
    filter.setSucceedingOperator(new OperatorIDTuple(replaceLitUnder, 0));

    replaceLitUnder.setPrecedingOperator(filter);
    replaceLitUnder.setSucceedingOperators(succs);

    BasicOperator succ;
View Full Code Here

  @Override
  protected void init() {
    final TriplePattern pat = new TriplePattern();
    final ReplaceVar replaceVar = new ReplaceVar();

    pat.setSucceedingOperator(new OperatorIDTuple(replaceVar, 0));
    replaceVar.setPrecedingOperator(pat);

    subGraphMap = new HashMap<BasicOperator, String>();
    subGraphMap.put(pat, "pat");
    subGraphMap.put(replaceVar, "replaceVar");
View Full Code Here

      }
    }

    // Delete empty ReplaceVar
    if (replaceVar.getSubstitutionsVariableLeft().size() == 0) {
      final OperatorIDTuple succ = replaceVar.getSucceedingOperators()
          .get(0);
      pat.addSucceedingOperator(succ);
      pat.removeSucceedingOperator(replaceVar);
      succ.getOperator().removePrecedingOperator(replaceVar);
      succ.getOperator().addPrecedingOperator(pat);

      rootOperator.deleteParents();
      rootOperator.setParents();
      rootOperator.detectCycles();
      rootOperator.sendMessage(new BoundVariablesMessage());
View Full Code Here

  protected Tuple<Collection<BasicOperator>, Collection<BasicOperator>> transformOperatorGraph(
      final Map<String, BasicOperator> mso,
      final BasicOperator rootOperator) {
    final Collection<BasicOperator> deleted = new LinkedList<BasicOperator>();
    final Collection<BasicOperator> added = new LinkedList<BasicOperator>();
    OperatorIDTuple tuple;
    final BasicOperator join = mso.get("join");
    final List<BasicOperator> pre = join.getPrecedingOperators();

    join.setPrecedingOperators(new LinkedList<BasicOperator>());

    for (final BasicOperator op : pre) {
      if (op instanceof ParallelOperand
          || op instanceof QueryResultInBlocks) {
        join.addPrecedingOperator(op);
        continue;
      }

      final Operator par = new ParallelOperand();
      par.addPrecedingOperator(op);
      added.add(par);

      final Operator maybequeryresultinblocks;
      if (isBLOCKWISE()) {
        maybequeryresultinblocks = new QueryResultInBlocks();
        added.add(maybequeryresultinblocks);
        par.setSucceedingOperator(new OperatorIDTuple(
            maybequeryresultinblocks, 0));
        maybequeryresultinblocks.addPrecedingOperator(par);
      } else {
        maybequeryresultinblocks = par;
      }
      tuple = op.getOperatorIDTuple(join);
      op.replaceOperatorIDTuple(tuple, new OperatorIDTuple(par, 0));

      join.addPrecedingOperator(maybequeryresultinblocks);
      maybequeryresultinblocks.addSucceedingOperator(new OperatorIDTuple(
          join, tuple.getId()));
    }

    rootOperator.detectCycles();
    rootOperator.sendMessage(new BoundVariablesMessage());
    if (deleted.size() > 0 || added.size() > 0)
View Full Code Here

TOP

Related Classes of lupos.engine.operators.OperatorIDTuple

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.