/** * 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"); } }
/** * Set the direction of rule inference desired. * If set to a pure mode (FORWARD, BACKWARD) then the rules will be * interpreted as operating in that direction which ever direction * they were written in. In HYBRID mode then the direction of the rule * itself which control whether it is used in forward or backward mode. * In addition, HYBRID mode allows forward rules to generate addition * backward rules. */ public void setMode(RuleMode mode) { if (schemaGraph != null) { throw new ReasonerException("Can't change mode of a reasoner bound to a schema"); } this.mode = mode; preload = null; bRuleStore = null; }
/** * Set the direction of rule inference desired. * If set to a pure mode (FORWARD, BACKWARD) then the rules will be * interpreted as operating in that direction which ever direction * they were written in. In HYBRID mode then the direction of the rule * itself which control whether it is used in forward or backward mode. * In addition, HYBRID mode allows forward rules to generate addition * backward rules. */ public void setMode(RuleMode mode) { if (schemaGraph != null) { throw new ReasonerException("Can't change mode of a reasoner bound to a schema"); } this.mode = mode; preload = null; bRuleStore = null; }
/** * 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 builtin in rule " + rule); // TODO: Remove // if (clause instanceof Functor) { // context.setEnv(env); // context.setRule(rule); // return((Functor)clause).evalAsBodyClause(context); // } else { // throw new ReasonerException("Illegal builtin predicate: " + clause + " in rule " + rule); // } }
/** * 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 builtin in rule " + rule); // TODO: Remove // if (clause instanceof Functor) { // context.setEnv(env); // context.setRule(rule); // return((Functor)clause).evalAsBodyClause(context); // } else { // throw new ReasonerException("Illegal builtin predicate: " + clause + " in rule " + rule); // } }
/** * 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()); }
/** * Return the RDFS rule set, loading it in if necessary. * @param level a string defining the processing level required */ public static List<Rule> loadRulesLevel(String level) { List<Rule> ruleSet = ruleSets.get(level); if (ruleSet == null) { String file = ruleFiles.get(level); if (file == null) { throw new ReasonerException("Illegal RDFS conformance level: " + level); } ruleSet = loadRules( file ); ruleSets.put(level, ruleSet); } return ruleSet; }
/** * Return the RDFS rule set, loading it in if necessary. * @param level a string defining the processing level required */ public static List<Rule> loadRulesLevel(String level) { List<Rule> ruleSet = ruleSets.get(level); if (ruleSet == null) { String file = ruleFiles.get(level); if (file == null) { throw new ReasonerException("Illegal RDFS conformance level: " + level); } ruleSet = loadRules( file ); ruleSets.put(level, ruleSet); } return ruleSet; }
/** * Return the SKOS rule set, loading it in if necessary. * @param level a string defining the processing level required */ public static List<Rule> loadRulesLevel(String level) { List<Rule> ruleSet = ruleSets.get(level); if (ruleSet == null) { String file = ruleFiles.get(level); if (file == null) { throw new ReasonerException("Illegal SKOS conformance level: " + level); } ruleSet = loadRules( file ); ruleSets.put(level, ruleSet); } return ruleSet; } }
/** * Set to true to enable translation of selected parts of an OWL schema * to additional rules. At present only intersection statements are handled this way. * The translation is only applicable in HYBRID mode. */ public void setOWLTranslation(boolean enableOWLTranslation) { if (enableOWLTranslation && (mode != HYBRID)) { throw new ReasonerException("Can only enable OWL rule translation in HYBRID mode"); } this.enableOWLTranslation = enableOWLTranslation; if (enableOWLTranslation) { addPreprocessingHook(owlTranslator); } else { removePreprocessingHook(owlTranslator); } }