Package lupos.engine.operators.index

Examples of lupos.engine.operators.index.BasicIndexScan


  protected BasicIndexScan getIndex(final LeafNodePlan plan,
      final BasicIndexScan indexScan,
      final Collection<Variable> sortCriterium,
      final Map<Variable, Literal> minima,
      final Map<Variable, Literal> maxima) {
    final BasicIndexScan index1 = new QueryClientIndexScan((OperatorIDTuple) null, plan.getTriplePatterns(), indexScan.getGraphConstraint(), indexScan.getRoot());
    index1.setIntersectionVariables(plan.getVariables());
    index1.setUnionVariables(plan.getVariables());
    return index1;
  }
View Full Code Here


    final List<OperatorIDTuple> c = new LinkedList<OperatorIDTuple>();

    for (final OperatorIDTuple oit : this.succeedingOperators) {
      if (oit.getOperator() instanceof BasicIndexScan) {
        final BasicIndexScan indexScan = (BasicIndexScan) oit.getOperator();

        if(indexScan.joinOrderToBeOptimized()){
          final lupos.engine.operators.index.Root root;
          switch (opt) {
          default:
          case BasicIndexScan.BINARY:
            root = QueryClientCostBasedOptimizer.rearrangeJoinOrder(indexScan);
View Full Code Here

            rootNodeOfSubGraph, key, subgraphExecutor);
       
        /*
         * store new basic index scan instead of using it n-times, because same object used
         */
        BasicIndexScan indexScan = new QueryClientIndexScan(_indexScan.getRoot(),_indexScan.getTriplePattern());
       
        /*
         * store variables
         */
        final HashSet<Variable> variables = new HashSet<Variable>(
            _indexScan.getIntersectionVariables());
        container.setUnionVariables(variables);
        container.setIntersectionVariables(variables);

       
        // generate new connections...
        final Filter filter = this.getFilterFromIndexScan(indexScan);
        if (filter != null) {
          if (indexScan.getUnionVariables().containsAll(
              filter.getUsedVariables())) {
            Filter newFilter;
            try {
              newFilter = new Filter(filter.toString().substring(
                  0, filter.toString().length() - 2));
              indexScan
                  .setSucceedingOperator(new OperatorIDTuple(
                      newFilter, 0));
              newFilter
                  .setSucceedingOperator(new OperatorIDTuple(
                      new Result(), 0));
            } catch (final ParseException e) {
              e.printStackTrace();
            }

          } else {
            indexScan.setSucceedingOperator(new OperatorIDTuple(
                new Result(), 0));
          }
        } else {
          indexScan.setSucceedingOperator(new OperatorIDTuple(
              new Result(), 0));
        }

        // indexScan.setSucceedingOperator(new OperatorIDTuple(new
        // Result(),
View Full Code Here

    // prepare the initial subgraphs containing an index scan operator for each triple pattern
    for(TriplePattern tp: indexScan.getTriplePattern()){
      Collection<TriplePattern> tps = new LinkedList<TriplePattern>();
      tps.add(tp);
      BasicIndexScan is = indexScan.getRoot().newIndexScan(null, tps, indexScan.getGraphConstraint());
      HashSet<Variable> vars = tp.getVariables();
      HashSet<Variable> intersection = new HashSet<Variable>(vars);
      HashSet<Variable> union = new HashSet<Variable>(vars);
      is.setIntersectionVariables(intersection);
      is.setUnionVariables(union);
      is.setGraphConstraint(indexScan.getGraphConstraint());
      T additionalInformation = this.initAdditionalInformation(tp);
      jointree.add(new Tuple<BasicOperator, T>(is, additionalInformation));
      newRoot.addSucceedingOperator(is);
    }
       
View Full Code Here

  protected BasicIndexScan getIndex(final LeafNodePlan plan,
      final BasicIndexScan indexScan,
      final Collection<Variable> sortCriterium,
      final Map<Variable, Literal> minima,
      final Map<Variable, Literal> maxima) {
    final BasicIndexScan index1 = new MemoryIndexScan((OperatorIDTuple) null, plan.getTriplePatterns(), indexScan.getGraphConstraint(), indexScan.getRoot());
    return index1;
  }
View Full Code Here

      final Collection<Variable> sortCriterium,
      final Map<Variable, Literal> minima,
      final Map<Variable, Literal> maxima,
      final Map<TriplePattern, Map<Variable, VarBucket>> selectivity) {
    if (plan instanceof LeafNodePlan) {
      final BasicIndexScan index1 = getIndex((LeafNodePlan) plan, indexScan, sortCriterium, minima, maxima);
      selectivity.put(plan.getTriplePatterns().iterator().next(), plan.getSelectivity());
      root.addSucceedingOperator(new OperatorIDTuple(index1, 0));
      return index1;
    } else {
      final InnerNodePlan inp = (InnerNodePlan) plan;
View Full Code Here

     * luposdate.operators.formatter.OperatorFormatter#serialize(lupos.engine
     * .operators.BasicOperator, int)
     */
    @Override
    public JSONObject serialize(final BasicOperator operator, final int node_id) {
      final BasicIndexScan indexScan = (BasicIndexScan) operator;
      try {
        final JSONObject json = Helper.createTriplePatternsJSONObject(indexScan.getTriplePattern());

        json.put("type", BasicIndexScan.class.getName());
        json.put("node_id", node_id);

        return json;
View Full Code Here

  private boolean compareTripplePatternVariable(String keyToCheck,
      SubgraphContainer<?> sg1, SubgraphContainer<?> sg2) {
    /*
     * get the index scan's and their triple pattern
     */
    BasicIndexScan bis1 = this.getIndexScan(sg1.getRootOfSubgraph());
    BasicIndexScan bis2 = this.getIndexScan(sg2.getRootOfSubgraph());
    /*
     * should never be null, but avoid faults by default :D
     */
    if (bis1 == null || bis2 == null || keyToCheck.length() < 1)
      return false;

    /*
     * get the triple pattern of both subgraph containers, iterate through
     * the variables used in the first subgraph, then check whether the
     * variables in the 2nd subgraph are used in first subgraph (so in key
     * S0 the variable in subject of sg1 and sg2 have to be the same, in P1
     * the predicate and so on)
     */
    Collection<TriplePattern> tripple1 = bis1.getTriplePattern();
    Collection<TriplePattern> tripple2 = bis2.getTriplePattern();
    Set<Variable> boundVariabled = new HashSet<Variable>();

    /*
     * just from textual representation into position in triple (S = subject
     * = position:0)
View Full Code Here

          union2.removePrecedingOperator(prec2);

          /*
           * get the index scan in first subgraph
           */
          BasicIndexScan bis = getIndexScan(sg1.getRootOfSubgraph());
          if (bis == null)
            continue;
          /*
           * you have to clone this list, because if changing
           * something, the list is updated immediately, but we want
           * to access the removed items later!
           */
          List<OperatorIDTuple> _bisSucc = bis
              .getSucceedingOperators();
          List<OperatorIDTuple> bisSucc = new ArrayList<>(
              _bisSucc.size());
          for (OperatorIDTuple toClone : _bisSucc) {
            bisSucc.add(toClone);
          }

          /*
           * now add the 2nd subgraph container in the first subgraph
           * container
           */
          sg1.getRootOfSubgraph().addSucceedingOperator(sg2);

          /*
           * remove old connections of the 2nd subgraph (because it
           * should be included into the subgraph)
           */
          for (OperatorIDTuple op : bisSucc) {
            bis.removeSucceedingOperator(op);
            op.getOperator().removePrecedingOperator(bis);
          }
          /*
           * connect the basic index scan and the 2nd subgraph
           * container in the join-operator in the 1st subgraph
           * container
           */
          bis.addSucceedingOperator(smallJoin, 0);
          smallJoin.addPrecedingOperator(sg2);
          sg2.addSucceedingOperator(smallJoin, 1);
          smallJoin.addPrecedingOperator(bis);
          /*
           * now connect the join with the succeeding operators of the
View Full Code Here

    for (final OperatorIDTuple succ : succs) {
      final BasicOperator op = succ.getOperator();
      if (op instanceof BasicIndexScan) {
        return (BasicIndexScan) op;
      } else {
        BasicIndexScan res = null;
        /*
         * some recursive call for the succeeding's of the succeeding
         * operator
         */
        if ((res = getIndexScan(op)) != null)
View Full Code Here

TOP

Related Classes of lupos.engine.operators.index.BasicIndexScan

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.