Package com.hp.hpl.jena.reasoner.rulesys

Examples of com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner


    // load rules and initialise reasoner
    InputStream rules = GlozeURL.class.getResourceAsStream(RULES);
    BufferedReader br = new BufferedReader(new InputStreamReader(rules));
    List<Rule> l = Rule.parseRules(Rule.rulesParserFromReader(br));
    GenericRuleReasoner r = new GenericRuleReasoner(l);
    r.setTraceOn(trace!=null && trace.equals("true"));
    ctx.setReasoner(r);
   
    OntModel m = xs.toOWL(target, name, false, ctx);
//    ctx.getModel().write(System.out,"RDF/XML-ABBREV");
    return m;
View Full Code Here


    // load rules and initialise reasoner
    InputStream rules = Gloze.class.getResourceAsStream(RULES);
    BufferedReader br = new BufferedReader(new InputStreamReader(rules));
    List l = Rule.parseRules(Rule.rulesParserFromReader(br));
    GenericRuleReasoner r = new GenericRuleReasoner(l);
    r.setTraceOn(trace!=null && trace.equals("true"));
    ctx.setReasoner(r);
   
    OntModel m = xs.toOWL(target, name, false, ctx);
//    ctx.getModel().write(System.out,"RDF/XML-ABBREV");
    return m;
View Full Code Here

    BuiltinRegistry.theRegistry.register(new CountValues());

    InputStream in = TestOWL.class.getResourceAsStream(RULES);
    BufferedReader b = new BufferedReader(new InputStreamReader(in));
    List rules = Rule.parseRules(Rule.rulesParserFromReader(b));
    reasoner = new GenericRuleReasoner(rules);     
  }
View Full Code Here

    if ( rulesSrc == null ) {
      return null;
    }
    log.info("Creating InfModel with rules:\n\t" +rulesSrc.replaceAll("\n", "\n\t"));
    List<Rule> rules = Rule.parseRules(rulesSrc);
    Reasoner reasoner = new GenericRuleReasoner(rules);
    InfModel im = ModelFactory.createInfModel(reasoner, _model);
    return im;
  }
View Full Code Here

    if ( rulesSrc == null ) {
      return;
    }
    log.info("_createInfModel: Creating InfModel with rules:\n\t" +rulesSrc.replaceAll("\n", "\n\t"));
    List<Rule> rules = Rule.parseRules(rulesSrc);
    Reasoner reasoner = new GenericRuleReasoner(rules);
    _infModel = ModelFactory.createInfModel(reasoner, _model);
  }
View Full Code Here

  }

  public void testCreateInfModel()
  {
    final String rule = "-> (eg:r eg:p eg:v).";
    final Reasoner r = new GenericRuleReasoner(Rule.parseRules(rule));
    final InfGraph ig = r
        .bind(ModelFactory.createDefaultModel().getGraph());
    final InfModel im = ModelFactory.createInfModel(ig);
    JenaTestBase.assertInstanceOf(InfModel.class, im);
    Assert.assertEquals(1, im.size());
  }
View Full Code Here

      log.debug("@@ " +stmt);
    }
     

    String rules = SYM_RULE;
    Reasoner ruleReasoner = new GenericRuleReasoner(Rule.parseRules(rules));
    InfModel inf = ModelFactory.createInfModel(ruleReasoner, model);
    for ( Statement stmt : inf.listStatements().toList() ) {
      log.debug("^^ " +stmt);
    }
  }
View Full Code Here

          + "\n" + VINE_UNREIFICATION_RULE
          + "\n" + SYM_RULE
      ;
     
      Parser parser = Rule.rulesParserFromReader(new BufferedReader(new StringReader(rules)));
      ruleReasoner = new GenericRuleReasoner(Rule.parseRules(parser));
    }
    else {
      rules = RDF_UNREIFICATION_RULE
          + "\n" + SYM_RULE
      ;
      ruleReasoner = new GenericRuleReasoner(Rule.parseRules(rules));
    }
    log.debug("\n" +"RULES:\n" +rules);
    InfModel inf = ModelFactory.createInfModel(ruleReasoner, model);
    log.debug("\n" +JenaUtil2.getOntModelAsString(inf, "N3"));
    int noTotal = 0;
View Full Code Here

            //Model model = FileManager.get().loadModel("/Users/mac/Documents/workspaceMyStanbol/sssw2012/events.rdf");
            Model model = FileManager.get().loadModel("/Users/mac/Documents/CNR/SSSW2012/datasets_new/Exercise1.rdf");
            //GenericRuleReasoner reasoner = new GenericRuleReasoner(jenaRules);
           
            //GenericRuleReasoner reasoner = new GenericRuleReasoner(com.hp.hpl.jena.reasoner.rulesys.Rule.parseRules(rules));
            GenericRuleReasoner reasoner = new GenericRuleReasoner(jenaRules);
           
            reasoner.setOWLTranslation(true);               // not needed in RDFS case
            reasoner.setTransitiveClosureCaching(true);
           
           
            InfModel infModel = ModelFactory.createInfModel(reasoner, model);
           
            infModel.prepare();
View Full Code Here

     */
    protected Reasoner customReasoner(List<Rule> customRules) {
        log.debug(" customReasoner(List<Rule> customRules)");
        List<Rule> standardRules = ((FBRuleReasoner) this.reasoner).getRules();
        standardRules.addAll(customRules);
        return new GenericRuleReasoner(standardRules);
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner

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.