Package org.apache.stanbol.rules.manager

Examples of org.apache.stanbol.rules.manager.KB


        TcManager tcm = new SpecialTcManager(qe, wtcp);

        // broken recipe
        String recipe = "rule[is(<http://kres.iks-project.eu/ontology.owl#Person>) -> is(<http://xmlns.com/foaf/0.1/Person>, ?x)]";

        KB kb = null;
        try {
            kb = RuleParserImpl.parse(recipe);
        } catch (IllegalStateException e) {
            assertTrue(true);
        }
View Full Code Here


    return kb;
  }

  public static KB parse(InputStream inStream) {

    kb = new KB();
    Reader reader = new InputStreamReader(inStream);
    RuleParserImpl parser = new RuleParserImpl(reader);
    try {
      parser.start();
    } catch (TokenMgrError e) {
View Full Code Here

        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

        /**
         * Finally also the in-memory representation of the Recipe passed as input is modified.
         */
        KB kb = RuleParserImpl.parse(stanbolSyntaxRule);
        RuleList ruleList = kb.getkReSRuleList();
        for (Rule rule : ruleList) {

            /**
             * The rule must be added to the ontology, so 1. an IRI is created from its name 2. the rule
             * in Stanbol syntax is added to the rule as a literal through the hasBobyAndHe data property. 3. the rule is
View Full Code Here

        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

        /**
         * Finally also the in-memory representation of the Recipe passed as input is modified.
         */
        KB kb = RuleParserImpl.parse(rulesStream);
        RuleList ruleList = kb.getkReSRuleList();
        for (Rule rule : ruleList) {

            /**
             * The rule must be added to the ontology, so 1. an IRI is created from its name 2. the rule
             * in Stanbol syntax is added to the rule as a literal through the hasBobyAndHe data property. 3. the rule is
View Full Code Here

    }

    @Override
    public void createRecipe(String recipeID, String stanbolRule) {
        log.debug("Create recipe " + recipeID + " with rules in Stanbol sytnax " + stanbolRule, this);
        KB kb = RuleParserImpl.parse(stanbolRule);
        RuleList rules = kb.getkReSRuleList();

        AddRule addRule = new AddRule(this);

        Vector<IRI> ruleVectorIRIs = new Vector<IRI>();
        log.debug("Rules are " + rules.size());
View Full Code Here

    protected void deactivate(ComponentContext context) {
        log.info("in " + RuleStoreImpl.class + " deactivate with context " + context);
    }

    private RuleList generateKnowledgeBase(String stanbolRule) {
        KB kb = RuleParserImpl.parse(stanbolRule);
        return kb.getkReSRuleList();
    }
View Full Code Here

  static KB kb;

  public static KB parse(String inString) {

    kb = new KB();
    Reader reader = new StringReader(inString);
    RuleParserImpl parser = new RuleParserImpl(reader);
    try {
      parser.start();
    } catch (TokenMgrError e) {
View Full Code Here

  }
 
  @Test
  public void testParser(){
    try{
      KB kReSKB = RuleParserImpl.parse(kReSRule);
      if(kReSKB != null){
        RuleList kReSRuleList = kReSKB.getkReSRuleList();
        if(kReSRuleList != null){
          for(Rule kReSRule : kReSRuleList){
              log.debug("RULE : "+kReSRule.toString());
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.manager.KB

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.