/** * Process a call to a builtin predicate * @param clause the Functor representing the call * @param env the BindingEnvironment for this call * @param rule the rule which is invoking this call * @return true if the predicate succeeds */ @Override public boolean processBuiltin(ClauseEntry clause, Rule rule, BindingEnvironment env) { throw new ReasonerException("Internal error in FBLP rule engine, incorrect invocation of building in rule " + rule); }
/** * Test a global boolean property of the graph. This might included * properties like consistency, OWLSyntacticValidity etc. * It remains to be seen what level of generality is needed here. We could * replace this by a small number of specific tests for common concepts. * @param property the URI of the property to be tested * @return a Node giving the value of the global property, this may * be a boolean literal, some other literal value (e.g. a size). */ @Override public Node getGlobalProperty(Node property) { throw new ReasonerException("Global property not implemented: " + property); }
/** * Process a call to a builtin predicate * @param clause the Functor representing the call * @param env the BindingEnvironment for this call * @param rule the rule which is invoking this call * @return true if the predicate succeeds */ @Override public boolean processBuiltin(ClauseEntry clause, Rule rule, BindingEnvironment env) { throw new ReasonerException("Internal error in FBLP rule engine, incorrect invocation of building in rule " + rule); }
/** * Test a global boolean property of the graph. This might included * properties like consistency, OWLSyntacticValidity etc. * It remains to be seen what level of generality is needed here. We could * replace this by a small number of specific tests for common concepts. * @param property the URI of the property to be tested * @return a Node giving the value of the global property, this may * be a boolean literal, some other literal value (e.g. a size). */ @Override public Node getGlobalProperty(Node property) { throw new ReasonerException("Global property not implemented: " + property); }
/** * Set (or change) the rule set that this reasoner should execute. * @param rules a list of Rule objects */ @Override public void setRules(List<Rule> rules) { this.rules = rules; preload = null; if (schemaGraph != null) { // The change of rules invalidates the existing precomputed schema graph // This might be recoverable but for now simply flag the error and let the // user reorder their code to set the rules before doing a bind! throw new ReasonerException("Cannot change the rule set for a bound rule reasoner.\nSet the rules before calling bindSchema"); } }
/** * Set (or change) the rule set that this reasoner should execute. * @param rules a list of Rule objects */ @Override public void setRules(List<Rule> rules) { this.rules = rules; preload = null; if (schemaGraph != null) { // The change of rules invalidates the existing precomputed schema graph // This might be recoverable but for now simply flag the error and let the // user reorder their code to set the rules before doing a bind! throw new ReasonerException("Cannot change the rule set for a bound rule reasoner.\nSet the rules before calling bindSchema"); } }
/** * Deletes a new Backward rule as a rules of a forward rule process. Only some * infgraphs support this. */ @Override public void deleteBRule(Rule brule) { throw new ReasonerException("Forward reasoner does not support hybrid rules - " + brule.toShortString()); }
/** * Adds a new Backward rule as a rules of a forward rule process. Only some * infgraphs support this. */ @Override public void addBRule(Rule brule) { throw new ReasonerException("Forward reasoner does not support hybrid rules - " + brule.toShortString()); }
/** * Deletes a new Backward rule as a rules of a forward rule process. Only some * infgraphs support this. */ @Override public void deleteBRule(Rule brule) { throw new ReasonerException("Forward reasoner does not support hybrid rules - " + brule.toShortString()); }
/** * Return the schema graph, if any, bound into this inference graph. */ @Override public Graph getSchemaGraph() { if (tbox == null) return null; if (tbox instanceof FGraph) { return ((FGraph)tbox).getGraph(); } else { throw new ReasonerException("Transitive reasoner got into an illegal state"); } }
/** * Return the schema graph, if any, bound into this inference graph. */ @Override public Graph getSchemaGraph() { if (tbox == null) return null; if (tbox instanceof FGraph) { return ((FGraph)tbox).getGraph(); } else { throw new ReasonerException("Transitive reasoner got into an illegal state"); } }
/** * Adds a new Backward rule as a rules of a forward rule process. Only some * infgraphs support this. */ @Override public void addBRule(Rule brule) { throw new ReasonerException("Forward reasoner does not support hybrid rules - " + brule.toShortString()); }
/** Answer the list of rules loaded from the given filename. May throw a ReasonerException wrapping an IOException. */ public static List<Rule> loadRules( String fileName ) { try { return Rule.parseRules(Util.loadRuleParserFromResourceFile( fileName ) ); } catch (WrappedIOException e) { throw new ReasonerException("Can't load rules file: " + fileName, e.getCause() ); } }
/** * Add a single rule to the store. * N.B. This will invalidate current partial results and the engine * should be reset() before future queries. */ public synchronized void addRule(Rule rule) { checkSafeToUpdate(); if (rule.headLength() > 1) { throw new ReasonerException("Backward rules only allowed one head clause"); } ruleStore.addRule(rule); }
/** * Add a single rule to the store. * N.B. This will invalidate current partial results and the engine * should be reset() before future queries. */ public synchronized void addRule(Rule rule) { checkSafeToUpdate(); if (rule.headLength() > 1) { throw new ReasonerException("Backward rules only allowed one head clause"); } ruleStore.addRule(rule); }
/** Answer the list of rules loaded from the given filename. May throw a ReasonerException wrapping an IOException. */ public static List<Rule> loadRules( String fileName ) { try { return Rule.parseRules(Util.loadRuleParserFromResourceFile( fileName ) ); } catch (WrappedIOException e) { throw new ReasonerException("Can't load rules file: " + fileName, e.getCause() ); } }
/** Return the bitflag corresponding to the given reasoner factory */ public int flagFor(ReasonerFactory rf) { if (rf.equals(OWLFBRuleReasonerFactory.theInstance())) { return FB; } else if (rf.equals(OWLMiniReasonerFactory.theInstance())) { return MINI; } else if (rf.equals(OWLMicroReasonerFactory.theInstance())) { return MICRO; } else { throw new ReasonerException("Unrecognized OWL reasoner config in unit test"); } }
/** Return the bitflag corresponding to the given reasoner factory */ public int flagFor(ReasonerFactory rf) { if (rf.equals(OWLFBRuleReasonerFactory.theInstance())) { return FB; } else if (rf.equals(OWLMiniReasonerFactory.theInstance())) { return MINI; } else if (rf.equals(OWLMicroReasonerFactory.theInstance())) { return MICRO; } else { throw new ReasonerException("Unrecognized OWL reasoner config in unit test"); } }
/** * Precompute the implications of a schema graph. The statements in the graph * will be combined with the data when the final InfGraph is created. */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { checkArgGraph(tbox); if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an OWLRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); graph.addPreprocessingHook(new OWLRuleTranslationHook()); graph.prepare(); return new OWLFBRuleReasoner(this, graph); }
/** * Precompute the implications of a schema graph. The statements in the graph * will be combined with the data when the final InfGraph is created. */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { checkArgGraph(tbox); if (schemaGraph != null) { throw new ReasonerException("Can only bind one schema at a time to an OWLRuleReasoner"); } FBRuleInfGraph graph = new FBRuleInfGraph(this, rules, getPreload(), tbox); graph.addPreprocessingHook(new OWLRuleTranslationHook()); graph.prepare(); return new OWLFBRuleReasoner(this, graph); }