Package lupos.engine.operators.singleinput

Examples of lupos.engine.operators.singleinput.Result


      final String corequery = (root==null)?"":(String) spvid.visit(root);

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


                final long physicalOptimization = evaluator.physicalOptimization();

                if (mode == EvaluationMode.DEMO) {
                  final EvaluationDemoToolBar bottomToolBar = new EvaluationDemoToolBar(this.webdemo != DEMO_ENUM.ECLIPSE);

                  final Result result = (evaluator instanceof BasicIndexRuleEvaluator)? ((BasicIndexRuleEvaluator)evaluator).getResultOperator() : ((CommonCoreQueryEvaluator<Node>)evaluator).getResultOperator();

                  final ShowResult sr = new ShowResult(bottomToolBar, result);

                  evaluator.prepareForQueryDebugSteps(bottomToolBar);

                  System.out.println("Evaluate query ...");
                  final Thread thread = new Thread() {
                    @Override
                    public void run() {
                      try {
                        evaluator.evaluateQueryDebugSteps(bottomToolBar, sr);
                        bottomToolBar.endOfEvaluation();
                        Demo_Applet.this.enableOrDisableButtons(evaluation instanceof SPARQLEvaluation);
                      } catch (final Exception e) {
                        System.err
                        .println(e);
                        e.printStackTrace();
                      }
                    }
                  };
                  bottomToolBar.setEvaluationThread(thread);
                  thread.start();

                  final BasicOperator root = (evaluator instanceof BasicIndexRuleEvaluator)? ((BasicIndexRuleEvaluator)evaluator).getRootNode() :((CommonCoreQueryEvaluator<Node>) evaluator).getRootNode();

                  this.operatorGraphViewer = new Viewer(
                      new GraphWrapperBasicOperator(
                          root),
                          this.prefixInstance,
                          "Evaluation Demo",
                          false,
                          this.webdemo != DEMO_ENUM.ECLIPSE,
                          bottomToolBar);
                  bottomToolBar.setOperatorGraphViewer(this.operatorGraphViewer);
                } else {

                  final JTextArea ta_prefixes = new JTextArea();
                  ta_prefixes.setEditable(false);
                  ta_prefixes.setFont(new Font("Courier New", Font.PLAIN, 12));

                  System.out.println("Evaluate query ...");
                  if(evaluator instanceof CommonCoreQueryEvaluator){
                    ((CommonCoreQueryEvaluator)evaluator).getResultOperator().addApplication(new IterateOneTimeThrough());
                  }

                  final long evaluateQuery = evaluator.evaluateQuery();
                  final int times = xpref.datatypes.IntegerDatatype.getFirstValue("repetitionsOfExecution");
                  if(times >1){
                    long compileQueryTime = 0;
                    long logicalOptimizationTime = 0;
                    long physicalOptimizationTime = 0;
                    long evaluateQueryTime = 0;
                    long totalTime = 0;
                    final long[] compileQueryTimeArray = new long[times];
                    final long[] logicalOptimizationTimeArray = new long[times];
                    final long[] physicalOptimizationTimeArray = new long[times];
                    final long[] evaluateQueryTimeArray = new long[times];
                    final long[] totalTimeArray = new long[times];
                    for (int i = 0; i < times; i++) {
                      compileQueryTimeArray[i] = evaluator.compileQuery(this.query);
                      compileQueryTime += compileQueryTimeArray[i];
                      logicalOptimizationTimeArray[i] = evaluator.logicalOptimization();
                      logicalOptimizationTime += logicalOptimizationTimeArray[i];
                      physicalOptimizationTimeArray[i] = evaluator.physicalOptimization();
                      physicalOptimizationTime += physicalOptimizationTimeArray[i];
                      if(evaluator instanceof CommonCoreQueryEvaluator){
                        ((CommonCoreQueryEvaluator)evaluator).getResultOperator().addApplication(new IterateOneTimeThrough());
                      }
                      evaluateQueryTimeArray[i] = evaluator.evaluateQuery();
                      evaluateQueryTime += evaluateQueryTimeArray[i];
                      totalTimeArray[i] = compileQueryTimeArray[i] + logicalOptimizationTimeArray[i] + physicalOptimizationTimeArray[i] + evaluateQueryTimeArray[i];
                      totalTime += totalTimeArray[i];
                    }
                    String result = "Evaluator " + this.cobo_evaluator.getSelectedItem().toString() + "\n\nBuild indices              : " + ((double) prepareInputData / 1000);
                    result += "\n\n(I) Time in seconds to compile query:\nAvg" + QueryEvaluator.toString(compileQueryTimeArray) + "/1000 = " + (((double) compileQueryTime) / times) / 1000;
                    result += "\nStandard deviation of the sample: " + QueryEvaluator.computeStandardDeviationOfTheSample(compileQueryTimeArray) / 1000;
                    result += "\nSample standard deviation       : " + QueryEvaluator.computeSampleStandardDeviation(compileQueryTimeArray) / 1000;
                    result += "\n\n(II) Time in seconds used for logical optimization:\nAvg" + QueryEvaluator.toString(logicalOptimizationTimeArray) + "/1000 = " + (((double) logicalOptimizationTime) / times) / 1000;
                    result += "\nStandard deviation of the sample: " + QueryEvaluator.computeStandardDeviationOfTheSample(logicalOptimizationTimeArray) / 1000;
                    result += "\nSample standard deviation       : " + QueryEvaluator.computeSampleStandardDeviation(logicalOptimizationTimeArray) / 1000;
                    result += "\n\n(III) Time in seconds used for physical optimization:\nAvg" + QueryEvaluator.toString(physicalOptimizationTimeArray) + "/1000 = " + (((double) physicalOptimizationTime) / times) / 1000;
                    result += "\nStandard deviation of the sample: " + QueryEvaluator.computeStandardDeviationOfTheSample(physicalOptimizationTimeArray) / 1000;
                    result += "\nSample standard deviation       : " + QueryEvaluator.computeSampleStandardDeviation(physicalOptimizationTimeArray) / 1000;
                    result += "\n\n(IV) Time in seconds to evaluate query:\nAvg" + QueryEvaluator.toString(evaluateQueryTimeArray) + "/1000 = " + (((double) evaluateQueryTime) / times) / 1000;
                    result += "\nStandard deviation of the sample: " + QueryEvaluator.computeStandardDeviationOfTheSample(evaluateQueryTimeArray) / 1000;
                    result += "\nSample standard deviation       : " + QueryEvaluator.computeSampleStandardDeviation(evaluateQueryTimeArray) / 1000;
                    result += "\n\nTotal time in seconds (I)+(II)+(III)+(IV):\nAvg" + QueryEvaluator.toString(totalTimeArray) + "/1000 = " + (((double) totalTime) / times) / 1000;
                    result += "\nStandard deviation of the sample: " + QueryEvaluator.computeStandardDeviationOfTheSample(totalTimeArray) / 1000;
                    result += "\nSample standard deviation       : " + QueryEvaluator.computeSampleStandardDeviation(totalTimeArray) / 1000;
                    ta_prefixes.setText(result);
                  } else {
                    ta_prefixes.setText("Evaluator "
                        + this.cobo_evaluator.getSelectedItem().toString()
                        + "\n\nBuild indices              : " + ((double) prepareInputData / 1000)
                        + "\n\nTotal time query processing: " + ((double) (compileQuery + logicalOptimization + physicalOptimization + evaluateQuery) / 1000)
                        + ((evaluator instanceof JenaQueryEvaluator || evaluator instanceof SesameQueryEvaluator) ? ""
                            : "\n    - Compile query        : "
                            + ((double) compileQuery / 1000)
                            + "\n    - Logical optimization : "
                            + ((double) logicalOptimization / 1000)
                            + "\n    - Physical optimization: "
                            + ((double) physicalOptimization / 1000)
                            + "\n    - Evaluation           : "
                            + ((double) evaluateQuery / 1000)));
                  }
                  final JFrame frame1 = new JFrame("Execution times in seconds");
                  frame1.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
                  frame1.setLocationRelativeTo(Demo_Applet.this);

                  final JScrollPane scroll = new JScrollPane(ta_prefixes);

                  frame1.add(scroll);
                  frame1.pack();
                  frame1.setVisible(true);
                }
              } catch (final Throwable t) {
                this.dealWithThrowable(t, mode, evaluation instanceof SPARQLEvaluation);
              }
            } catch (final Throwable t) {
              this.dealWithThrowable(t, mode, evaluation instanceof SPARQLEvaluation);
            }
            evaluation.enableButtons();

          } else {

            try {
              this.prefixInstance = new ViewerPrefix(this.usePrefixes.isTrue());
              evaluation.prepareInputData(this.defaultGraphs, new LinkedList<URILiteral>());

              System.out.println("Compile query...");
              try {
                try {

                  this.debugViewerCreator = evaluation.compileQueryDebugByteArray(this.query);

                  if (this.debugViewerCreator != null) {
                    this.ruleApplications = this.debugViewerCreator.getCorrectOperatorGraphRules();
                  } else {
                    this.ruleApplications = null;
                  }

                  System.out.println("Logical optimization...");

                  if (this.ruleApplications != null) {
                    this.ruleApplications.addAll(evaluator.logicalOptimizationDebugByteArray(this.prefixInstance));
                  } else {
                    this.ruleApplications = evaluator.logicalOptimizationDebugByteArray(this.prefixInstance);
                  }

                  System.out.println("Physical optimization...");

                  if (this.ruleApplications != null) {
                    this.ruleApplications.addAll(evaluator.physicalOptimizationDebugByteArray(this.prefixInstance));
                  } else {
                    this.ruleApplications = evaluator.physicalOptimizationDebugByteArray(this.prefixInstance);
                  }

                  System.out.println("Evaluate query ...");

                  if (evaluator instanceof CommonCoreQueryEvaluator || evaluator instanceof BasicIndexRuleEvaluator) {
                    final CollectRIFResult crr = new CollectRIFResult(false);
                    final Result resultOperator = (evaluator instanceof CommonCoreQueryEvaluator)?((CommonCoreQueryEvaluator<Node>)evaluator).getResultOperator(): ((BasicIndexRuleEvaluator)evaluator).getResultOperator();
                    resultOperator.addApplication(crr);
                    evaluator.evaluateQuery();
                    this.resultQueryEvaluator = crr.getQueryResults();
                  } else {
                    this.resultQueryEvaluator = new QueryResult[1];
                    this.resultQueryEvaluator[0] = evaluator.getResult();
View Full Code Here

      }

      /*
       * get the two results, remove them, and add the join
       */
      Result r1 = getResult(root);
      for (BasicOperator p : r1.getPrecedingOperators()) {
        p.removeSucceedingOperator(r1);
        // p.addSucceedingOperator(join);
      }
      Result r2 = getResult(root);
      for (BasicOperator p : r2.getPrecedingOperators()) {
        p.removeSucceedingOperator(r2);
        // p.addSucceedingOperator(join);
      }

      for (BasicOperator p : r1.getPrecedingOperators()) {
        p.addSucceedingOperator(join);
      }
      for (BasicOperator p : r2.getPrecedingOperators()) {
        p.addSucceedingOperator(join);
      }

      /*
       * succedings of the join will be the succedings of the subgraph
       * container
       */
      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

  public static boolean processSimpleSubquery(final SimpleNode node, final Bindings bindings,
      final Map<Node, Object> d, final Root collection,
      final CommonCoreQueryEvaluator<Node> evaluator) {

    final BasicOperator oldRoot = evaluator.getRootNode();
    final Result oldResult = evaluator.getResultOperator();
    final Map<Variable, Integer> oldBindingsFactory = evaluator.getBindingsFactory().getPosVariables();

    final Root collectionClone = (Root) collection.deepClone();
    collectionClone.visit(new SimpleOperatorGraphVisitor() {
;
      @Override
      public Object visit(final BasicOperator basicOperator) {

        if (basicOperator instanceof BasicIndexScan) {
          final BasicIndexScan basicIndex = (BasicIndexScan) basicOperator;
          final Collection<TriplePattern> triplePatterns = basicIndex
              .getTriplePattern();
          final Collection<TriplePattern> newTriplePatterns = new LinkedList<TriplePattern>();
          for (final TriplePattern t : triplePatterns) {
            final Item[] itemArray = t.getItems().clone();
            for (int i = 0; i < 3; i++) {
              if (itemArray[i].isVariable()) {
                final Literal literal = bindings
                    .get((Variable) itemArray[i]);
                if (literal != null) {
                  itemArray[i] = literal;
                }
              }
            }
            newTriplePatterns.add(new TriplePattern(itemArray));
          }
          basicIndex.setTriplePatterns(newTriplePatterns);
        } else {
          // TODO Filter
          // node.clone(false)
        }
        return null;
      }
    });

    final Result result = setupEvaluator(evaluator, collectionClone);

    result.clearApplications();
    final NonEmptyApplication application = new NonEmptyApplication();
    result.addApplication(application);

    evaluator.logicalOptimization();
    evaluator.physicalOptimization();
    try {
      evaluator.evaluateQuery();
View Full Code Here

    }

    // TODO: nur eine Regel enthalten, welche direkt auf die conclusion
    // passt,
    // sp�ter auswahl der richtigen Regel
    final Result result = new Result();

    BasicOperator subOperator = null;
    for (final Rule rule : obj.getRules())
      if (rule.isImplication()) {
        subOperator = (BasicOperator) obj.getRules().iterator().next().accept(this,
View Full Code Here

  public BasicOperator getOperatorgraphRoot(){
    return this.indexScanCreator.getRoot();
  }

  public SPARQLCoreParserVisitorImplementation() {
    this.result = new Result();
    try {
      this.serviceGenerator = serviceGeneratorClass.newInstance();
    } catch (final InstantiationException e) {
      this.serviceGenerator = new ServiceGenerator();
      System.err.println();
View Full Code Here

          final Root collectionClone = (Root) isc.getRoot().clone();
          collectionClone.setSucceedingOperators(new LinkedList<OperatorIDTuple>());

          this.indexScanCreator = new IndexScanCreator_BasicIndex(collectionClone);

          final Result newResult = new Result();
          final OperatorConnection connection = new OperatorConnection(newResult);
          this.visit((ASTGroupConstraint) n.jjtGetChild(0), connection, graphConstraint);

          collectionClone.deleteParents();
          collectionClone.setParents();
View Full Code Here

    this.rifDocument.accept(dependencyVisitor, null);
    this.rifDocument.accept(filteringVisitor, null);

    final Class<? extends Bindings> clazz = Bindings.instanceClass;
    Bindings.instanceClass = BindingsMap.class;
    final Result res = (Result) this.rifDocument.accept(forward, null);
    this.evaluator.setResult(res);
    Bindings.instanceClass = clazz;

    final BasicOperator root = indexScanCreator.getRoot();
    this.evaluator.setRootNode(root);
View Full Code Here

  public long compileQueryAndInferenceIntoOneOperatorgraph(final String inferenceRuleset, final String query) throws Exception {
    final Date a = new Date();
    this.compileQuery(inferenceRuleset);
    final BasicOperator rootInference = this.getRootNode();
    final Result resultInference = this.getResultOperator();
    this.evaluator.compileQuery(query);
    integrateInferenceOperatorgraphIntoQueryOperatorgraph(rootInference, resultInference, this.evaluator.getRootNode(), this.evaluator.getResultOperator());
    this.evaluator.setBindingsVariablesBasedOnOperatorgraph();
    return ((new Date()).getTime() - a.getTime());
  }
View Full Code Here

    evaluator.setBindingsVariablesBasedOnOperatorgraph();

    final GetResult getResult = new GetResult();
    collection.visit(getResult);
    final Result result = getResult.getResult();

    evaluator.setResult(result);
    result.clearApplications();

    return result;
  }
View Full Code Here

TOP

Related Classes of lupos.engine.operators.singleinput.Result

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.