/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.reasoner.rulesys; import org.apache.jena.graph.Graph ; import org.apache.jena.graph.Triple ; import org.apache.jena.reasoner.Finder ; /** * Implementors of this interface can be used as proprocessing passes * during intialization of (hybrid) rule systems. They are typically * used to generate additional data-dependent rules or additional * deductions (normally from comprehension axioms) which are cheaper * this way than using the generic rule engines. */ public interface RulePreprocessHook { /** * Invoke the preprocessing hook. This will be called during the * preparation time of the hybrid reasoner. * @param infGraph the inference graph which is being prepared, * the hook code can use this to add pure deductions or add additional * rules (using addRuleDuringPrepare). * @param dataFind the finder which packages up the raw data (both * schema and data bind) and any cached transitive closures. * @param inserts a temporary graph into which the hook should insert * all new deductions that should be seen by the rules. */ public void run(FBRuleInfGraph infGraph, Finder dataFind, Graph inserts); /** * Validate a triple add to see if it should reinvoke the hook. If so * then the inference will be restarted at next prepare time. Incremental * re-processing is not yet supported. */ public boolean needsRerun(FBRuleInfGraph infGraph, Triple t); }