Package lupos.engine.operators.index

Examples of lupos.engine.operators.index.Root


   * Static method to call the cost-based optimizer for the QueryClient query evaluator
   * @param indexScan the IndexScan operator with at least two triple patterns to join....
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(final BasicIndexScan indexScan){
    final Root newRoot = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);
    final QueryClientCostBasedOptimizer optimizer = new QueryClientCostBasedOptimizer();
    optimizer.rearrangeJoinOrder(newRoot, indexScan);
    return newRoot;
  }
View Full Code Here


  private void replaceIndexScanOperatorWithSubGraphContainer(
      final BasicIndexScan _indexScan) {

    try {
      // get root
      final Root rootNodeOfOuterGraph = _indexScan.getRoot();

      Object[] keys = distribution.getKeysForQuerying(_indexScan
          .getTriplePattern().iterator().next());
      // TODO: 2) catch TriplePatternNotSupportedError and make union of
      // SubgraphContainer to all possible nodes...

      // remember original connections and connect new graph with these
      // connections
      final Collection<BasicOperator> preds = _indexScan
          .getPrecedingOperators();
      final List<OperatorIDTuple> succs = _indexScan
          .getSucceedingOperators();

      // create union - operation
      final Collection<Variable> v = _indexScan.getIntersectionVariables();
      final Union union = new Union();
      // the succeding of the union of all subgraphs is the succeding of the indexScan
      union.addSucceedingOperators(succs);
      union.setIntersectionVariables(v);
      union.setUnionVariables(v);
     
      /*
       * here we collect all used subgraphs
       */
      Collection<BasicOperator> subgraphs = new ArrayList<BasicOperator>();
     

      /*
       * for each key for the given triple pattern ...
       */
      int countingSubgraphs = 0;
      for (Object key : keys) {
        /*
         * create new inner root
         */
        final Root rootNodeOfSubGraph = rootNodeOfOuterGraph
            .newInstance(rootNodeOfOuterGraph.dataset);
        /*
         * create subgraph
         */
        final SubgraphContainer container = new SubgraphContainer(
            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(),
        // 0));
       
        //connect indexScan in subgraph container
        rootNodeOfSubGraph.setSucceedingOperator(new OperatorIDTuple(
            indexScan, countingSubgraphs));
        rootNodeOfSubGraph.deleteParents();
        rootNodeOfSubGraph.setParents();

        // original connections set at new graph
        /*
         * create Operator for union of all subgraphs
         */
 
View Full Code Here

   */
  private void replaceIndexScanOperatorWithSubGraphContainer_old(
      final BasicIndexScan indexScan) {

    try {
      final Root rootNodeOfOuterGraph = indexScan.getRoot();
      final Root rootNodeOfSubGraph = rootNodeOfOuterGraph
          .newInstance(rootNodeOfOuterGraph.dataset);

      // TODO: 1) for several keys: union of different SubgraphContainer!
      Object[] keys = distribution.getKeysForQuerying(indexScan
          .getTriplePattern().iterator().next());
      // TODO: 2) catch TriplePatternNotSupportedError and make union of
      // SubgraphContainer to all possible nodes...
      final SubgraphContainer container = new SubgraphContainer(
          rootNodeOfSubGraph, keys[0], subgraphExecutor);
      final HashSet<Variable> variables = new HashSet<Variable>(
          indexScan.getIntersectionVariables());

      container.setUnionVariables(variables);
      container.setIntersectionVariables(variables);

      // remember original connections and connect new graph with these
      // connections
      final Collection<BasicOperator> preds = indexScan
          .getPrecedingOperators();
      final List<OperatorIDTuple> succs = indexScan
          .getSucceedingOperators();

      for (final BasicOperator pred : preds) {
        pred.getOperatorIDTuple(indexScan).setOperator(container);
      }

      // 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(),
      // 0));
      rootNodeOfSubGraph.setSucceedingOperator(new OperatorIDTuple(
          indexScan, 0));

      rootNodeOfSubGraph.setParents();

      // original connections set at new graph
      container.setSucceedingOperators(succs);

      // iterate through the new predecessors of the successors of the
View Full Code Here

   * Static method to call the cost-based optimizer for the memory index query evaluator
   * @param indexScan the IndexScan operator with at least two triple patterns to join....
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(BasicIndexScan indexScan){
    Root newRoot = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);
    MemoryIndexCostBasedOptimizer optimizer = new MemoryIndexCostBasedOptimizer();
    optimizer.rearrangeJoinOrder(newRoot, indexScan);
    return newRoot;
  }
View Full Code Here

   * Static method to call the optimizer for join ordering according to least new variables for the next best chosen combination of subgraphs
   * @param indexScan the IndexScan operator with at least two triple patterns to join....
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(final BasicIndexScan indexScan){
    Root root = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);
    BuildJoinTreeLeastNewVariables optimizer = new BuildJoinTreeLeastNewVariables();
    optimizer.rearrangeJoinOrder(root, indexScan);
    return root;
  }
View Full Code Here

   * @param RDF3XSORT true, if merge joins should be enforced by eventual preceding sorting phases; false, if other join algorithms are used whenever the data is not already sorted in the right way
   * @param NARYMERGEJOIN n-ary (true) versus binary (false) merge joins
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(BasicIndexScan indexScan, final boolean RDF3XSORT, final boolean NARYMERGEJOIN){
    Root newRoot = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);   
    RDF3XCostBasedOptimizer optimizer = new RDF3XCostBasedOptimizer(RDF3XSORT, NARYMERGEJOIN);
    optimizer.rearrangeJoinOrder(newRoot, indexScan);
    return newRoot;
  }
View Full Code Here

    final SubgraphContainerFormatter serializer = new SubgraphContainerFormatter(
        this.dataset, this.operatorCreator, this.application);

    final JSONObject _serializedOperator = serializedOperator
        .getJSONObject("subgraph");
    final Root r = serializer.deserialize(_serializedOperator);
    /*
     * deserialize the key of the subgraph container
     */
    final String subgraphKey = (String) serializedOperator.get("key");
    Object obj = null;
View Full Code Here

   * Static method to call the optimizer for join ordering according to least solutions for the next best chosen triple pattern
   * @param indexScan the IndexScan operator with at least two triple patterns to join....
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(final BasicIndexScan indexScan){
    Root root = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);
    RearrangeTriplePatternsInIndexScanLeastEntries optimizer = new RearrangeTriplePatternsInIndexScanLeastEntries();
    optimizer.rearrangeJoinOrder(root, indexScan);
    return root;
  }
View Full Code Here

   * Static method to call the optimizer for join ordering according to primarily least new variables and secondary least solutions for the next best chosen triple pattern
   * @param indexScan the IndexScan operator with at least two triple patterns to join....
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(final BasicIndexScan indexScan){
    Root root = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);
    RearrangeTriplePatternsInIndexScanLeastNewVariablesAndLeastEntries optimizer = new RearrangeTriplePatternsInIndexScanLeastNewVariablesAndLeastEntries();
    optimizer.rearrangeJoinOrder(root, indexScan);
    return root;
  }
View Full Code Here

   * Static method to call the optimizer for join ordering according to least new variables for the next best chosen triple pattern
   * @param indexScan the IndexScan operator with at least two triple patterns to join....
   * @return the root operator under which the subgraph with the reordered joins are inserted
   */
  public static Root rearrangeJoinOrder(final BasicIndexScan indexScan){
    Root root = indexScan.getRoot().newInstance(indexScan.getRoot().dataset);
    RearrangeTriplePatternsInIndexScanLeastNewVariables optimizer = new RearrangeTriplePatternsInIndexScanLeastNewVariables();
    optimizer.rearrangeJoinOrder(root, indexScan);
    return root;
  }
View Full Code Here

TOP

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

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.