Search code examples
javajenarule-enginejena-rules

Using Jena Rules File on inferred model to create a validator for an ontology


What I want to do: Create a validator for an ontology in Java. For this I want to use Jena Rules on a inferred model. Unfortunately I can't use both the standard reasoner (ReasonerRegistry.getOWLReasoner()) and after this my own reasoner (new GenericRuleReasoner(Rule.rulesFromURL("file:rulefile.txt"))). Is this possible somehow?


Solution

  • The answer from @Joshua is absolutely correct. The only thing you need to know is that you can parse the rdf reasoner to GenericRuleReasoner or the owl reasoner to OWLFBRuleReasoner. From GenericRuleReasoner/OWLFBRuleReasoner you can get the list of the rules. List<Rule> rules = new ArrayList<>((OWLFBRuleReasoner)ReasonerRegistry.getOWLReasoner().getRules()); rules.addAll(Rule.rulesFromURL("file:JENA_RULES_FILE")); GenericRuleReasoner completeReasoner = new GenericRuleReasoner(rules);