Package lupos.rif

Examples of lupos.rif.BasicIndexRuleEvaluator


public final class ResultPanelHelper {
  /**
   * This is just for external use an easy way to display the result of a RIF rules application...
   */
  public static void appyRIFRules(final String ruleset, final JPanel resultpanel, final BooleanReference usePrefixes,  final ViewerPrefix prefixInstance) throws Exception {   
    final BasicIndexRuleEvaluator ruleEvaluator = new BasicIndexRuleEvaluator();
    ruleEvaluator.prepareInputData(new LinkedList<URILiteral>(), new LinkedList<URILiteral>());
    ruleEvaluator.compileQuery(ruleset);
    ruleEvaluator.logicalOptimization();
    ruleEvaluator.physicalOptimization();
    QueryResult[] resultQueryEvaluator = ruleEvaluator.getResults();
   
    ResultPanelHelper.setupResultPanel(resultpanel, resultQueryEvaluator, null, null, null, null, null, usePrefixes, prefixInstance, resultpanel);
  }
View Full Code Here


    private BasicIndexRuleEvaluator ruleEvaluator;

    public RIFEvaluation(final QueryEvaluator<Node> evaluator) {
      super();
      try {
        this.ruleEvaluator = new BasicIndexRuleEvaluator((CommonCoreQueryEvaluator<Node>)evaluator);
      } catch (final Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

      }
      Demo_Applet.this.ruleApplicationsForMaterialization = null;
      Demo_Applet.this.materializationInfo = null;
      Demo_Applet.this.inferenceRules = ((SPARQLINFERENCE)Demo_Applet.this.comboBox_sparqlInference.getSelectedItem()).getRuleSet(Demo_Applet.this.rulesets);
      if(Demo_Applet.this.inferenceRules != null){
        final BasicIndexRuleEvaluator birqe = new BasicIndexRuleEvaluator((CommonCoreQueryEvaluator<Node>)this.evaluator);
        birqe.compileQuery(Demo_Applet.this.inferenceRules);
        Demo_Applet.this.materializationInfo = new RIFDebugViewerCreator(Demo_Applet.this.webdemo != DEMO_ENUM.ECLIPSE, Demo_Applet.this.prefixInstance, Demo_Applet.this.usePrefixes,
            new RulesGetter(){
              @Override
              public List<DebugContainer<BasicOperatorByteArray>> getRuleApplications() {
                return Demo_Applet.this.ruleApplications;
              }
            }, Demo_Applet.getIcon(Demo_Applet.this.webdemo), birqe.getCompilationUnit(), birqe.getDocument());

        // TODO improve RIF logical optimization such that it is fast enough for large operator graphs!
        // as workaround here only use the logical optimization of the underlying evaluator!
        System.out.println("Logical optimization...");
        if (Demo_Applet.this.ruleApplicationsForMaterialization != null) {
          Demo_Applet.this.ruleApplicationsForMaterialization.addAll(this.evaluator.logicalOptimizationDebugByteArray(Demo_Applet.this.prefixInstance));
        } else {
          Demo_Applet.this.ruleApplicationsForMaterialization = this.evaluator.logicalOptimizationDebugByteArray(Demo_Applet.this.prefixInstance);
        }

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

        if (Demo_Applet.this.ruleApplicationsForMaterialization != null) {
          Demo_Applet.this.ruleApplicationsForMaterialization.addAll(birqe.physicalOptimizationDebugByteArray(Demo_Applet.this.prefixInstance));
        } else {
          Demo_Applet.this.ruleApplicationsForMaterialization = birqe.physicalOptimizationDebugByteArray(Demo_Applet.this.prefixInstance);
        }

        if(Demo_Applet.this.comboBox_sparqlInferenceMaterialization.getSelectedItem() == SPARQLINFERENCEMATERIALIZATION.MATERIALIZEALL){
          Demo_Applet.this.errorsInOntology = birqe.inferTriplesAndStoreInDataset();
        } else {
          this.rootInference = birqe.getRootNode();
          this.resultInference = birqe.getResultOperator();
        }
      }
    }
View Full Code Here

      evaluator.getArgs().set("distinct",CommonCoreQueryEvaluator.DISTINCT.HASHSET);
      evaluator.getArgs().set("join",CommonCoreQueryEvaluator.JOIN.HASHMAPINDEX);
      evaluator.getArgs().set("optional",CommonCoreQueryEvaluator.JOIN.HASHMAPINDEX);
      evaluator.getArgs().set("datastructure",Indices.DATA_STRUCT.HASHMAP);
      evaluator.init();
      final BasicIndexRuleEvaluator rifEvaluator = new BasicIndexRuleEvaluator(evaluator);
     
      LinkedList<URILiteral> dataIRIs=new LinkedList<URILiteral>();
      dataIRIs.add(LiteralFactory.createStringURILiteral("<inlinedata:"+data+">"));
      rifEvaluator.prepareInputData(dataIRIs, new LinkedList<URILiteral>());
           
      System.out.println("Evaluate rules...");
     
      // evaluate rules and print out the result!
      evaluateQueryAndPrintOut(rifEvaluator, rules);
View Full Code Here

      LinkedList<URILiteral> dataIRIs = new LinkedList<URILiteral>();

      dataIRIs.add(LiteralFactory.createStringURILiteral("<inlinedata:"
          + ontology + ">"));

      BasicIndexRuleEvaluator rifEvaluator = new BasicIndexRuleEvaluator(
          evaluator);
      rifEvaluator.prepareInputData(dataIRIs,
          new LinkedList<URILiteral>());

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

      return rifEvaluator;
View Full Code Here

  /**
   * start the evaluation and emitting of inference rules
   * @param ontology
   */
  public void start(String ontology) {
    BasicIndexRuleEvaluator ruleEvaluator=initAndGetEvaluator(ontology)
    start(ruleEvaluator);
  }
View Full Code Here

  private void evaluate(
      HashMap<Integer, LinkedList<BoundVariable>> resultVariables,
      BasicIndexRuleEvaluator evaluator,
      HashMap<Integer, LinkedList<String>> listOfOccuringOWLLists,
      HashMap<Integer, LinkedHashMap<String, LinkedList<BoundVariable>>> listRuleResults) {
      BasicIndexRuleEvaluator rifEvaluator = evaluator;
      String query = "";
      // query_startTime=System.currentTimeMillis();
      TemplateRule currentTemplateRule;
      // for every Name
      for (int i = 0; i < this.parsedValues.getNames().length; i++) {
View Full Code Here

TOP

Related Classes of lupos.rif.BasicIndexRuleEvaluator

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.